:root {
    --cfdt-orange: #f37021;
    --cfdt-orange-hover: #d65b13;
    --cfdt-bg: #f4f7f6;
    --text-color: #333333;
    --text-light: #666666;
    --card-shadow: 0 10px 25px rgba(0,0,0,0.05);
    --border-radius: 12px;
    --danger-color: #e74c3c; /* Rouge pour effacer */
}

/* GLOBAL */
body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    background: var(--cfdt-bg);
    color: var(--text-color);
    line-height: 1.5;
    padding-top: 40px;
}

/* --- TOOLTIPS (INFOBULLES) --- */
.tooltip-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #eee;
    color: #666;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 6px;
    cursor: help;
    position: relative;
    vertical-align: middle;
}

.tooltip-icon:hover {
    background: var(--cfdt-orange);
    color: white;
}

/* Le texte de l'infobulle */
.tooltip-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 135%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: normal;
    width: 220px;
    text-align: center;
    line-height: 1.4;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    font-weight: normal;
}

/* Petite flèche en bas de l'infobulle */
.tooltip-icon:hover::before {
    content: "";
    position: absolute;
    bottom: 110%; /* Juste en dessous du tooltip */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* BANDEAU HEADER - TEXTE À DROITE */
header {
    max-width: 850px;
    margin: 0 auto 30px;
    background: white;
    box-shadow: var(--card-shadow);
    border-radius: var(--border-radius);
    padding: 20px 30px;
    box-sizing: border-box;
}

.header-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between; 
    gap: 20px;
}

.cfdt-logo {
    width: 250px;
    height: auto;
    flex-shrink: 0;
}

.header-content {
    text-align: right; 
    flex: 1;
}

.header-content h1 {
    font-size: 1.5rem;
    color: var(--cfdt-orange);
    margin: 0 0 5px 0;
    font-weight: 800;
    line-height: 1.2;
}

.subtitle-group {
    margin-bottom: 12px;
}

.main-subtitle {
    font-size: 1rem;
    font-weight: 700;
    color: #222;
    margin: 0;
}

.sub-subtitle {
    font-size: 0.9rem;
    font-weight: 700;
    color: #222;
    margin: 0;
}

.contact-info {
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 8px;
    justify-content: flex-end; 
}

.contact-info span {
    background: #f4f4f4;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

/* CONTENEUR PRINCIPAL */
main {
    max-width: 850px;
    margin: 0 auto 50px;
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    box-sizing: border-box;
}

/* SECTION INFO */
.info-section {
    background: #fff8f3;
    border-left: 5px solid var(--cfdt-orange);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.info-section h2 {
    font-size: 1.1rem;
    color: var(--cfdt-orange);
    margin: 0 0 5px 0;
}

.info-section p {
    margin: 0;
    font-size: 0.9rem;
    color: #555;
}

/* FORMULAIRE */
.calculator-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #444;
    display: flex;
    align-items: center; /* Aligne le texte et le tooltip */
}

.form-group input, 
.form-group select {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    background-color: #fcfcfc;
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: var(--cfdt-orange);
    outline: none;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(243, 112, 33, 0.15);
}

/* DATES (GRID LAYOUT) */
.dates-section {
    background: #fdfdfd;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
}

.dates-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-label {
    display: block;
    font-weight: 700;
    color: var(--cfdt-orange);
    margin: 0;
}

.btn-reset-dates {
    background: none;
    border: none;
    color: #999;
    font-size: 0.75rem;
    text-decoration: underline;
    cursor: pointer;
}
.btn-reset-dates:hover { color: var(--danger-color); }

.dates-header-row,
.date-row {
    display: grid;
    grid-template-columns: 1fr 1fr 160px 40px; 
    gap: 15px;
    align-items: center;
}

.dates-header-row {
    font-weight: 600;
    font-size: 0.9rem;
    color: #444;
    margin-bottom: 10px;
}

.date-row {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #f0f0f0;
}

.date-input-group input {
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Montserrat', sans-serif;
}

.mobile-label {
    display: none;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 4px;
    color: #666;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.checkbox-wrapper label {
    font-size: 0.85rem;
    line-height: 1.2;
    cursor: pointer;
    color: #555;
    margin: 0;
}

.checkbox-wrapper small {
    color: #28a745; 
    font-weight: bold;
    display: block;
}

.btn-remove {
    background: #ffecec;
    color: #cc0000;
    border: 1px solid #ffcccc;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    justify-self: center;
}

.btn-remove:hover { background: #ffcccc; }

.btn-placeholder { width: 32px; }

.btn-add-date {
    background: none;
    border: 2px dashed #ddd;
    color: #666;
    padding: 10px;
    width: 100%;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
    margin-top: 5px;
}

.btn-add-date:hover {
    border-color: var(--cfdt-orange);
    color: var(--cfdt-orange);
    background: #fff8f3;
}

/* BOUTONS ACTIONS */
.button-row {
    margin-top: 20px;
    display: flex;
    gap: 15px;
}

.btn-primary {
    flex: 2;
    background: var(--cfdt-orange);
    color: white;
    border: none;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    box-shadow: 0 4px 6px rgba(243, 112, 33, 0.2);
}
.btn-primary:hover {
    background: var(--cfdt-orange-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    flex: 1;
    background: white;
    color: #555;
    border: 2px solid #eee;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-secondary:hover {
    border-color: var(--cfdt-orange);
    color: var(--cfdt-orange);
    background: #fff8f3;
}

/* Bouton Reset */
.btn-reset {
    flex: 0.8;
    background: #fdfdfd;
    color: var(--danger-color);
    border: 1px solid #eee;
    padding: 14px 10px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-reset:hover {
    background: #fff5f5;
    border-color: #ffcccc;
}

/* RÉSULTATS */
.result-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px dashed #eee;
}

.result-section h3 {
    color: var(--cfdt-orange);
    font-size: 1.3rem;
    margin-bottom: 20px;
    text-align: center;
}

.placeholder-text {
    text-align: center;
    color: #999;
    font-style: italic;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.results-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.results-table tr:last-child td {
    border-bottom: none;
    background-color: #fff8f3;
    padding: 20px 15px;
}

.total-amount {
    color: var(--cfdt-orange);
    font-weight: 700;
    font-size: 1.4rem;
}

.details-list {
    list-style: none;
    padding: 0;
    margin-top: 15px;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #666;
}

.details-list li {
    margin-bottom: 5px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

footer {
    margin-top: 40px;
    text-align: center;
    color: #999;
    font-size: 0.8rem;
}

footer hr {
    border: 0;
    border-top: 1px solid #eee;
    margin-bottom: 20px;
}

/* MOBILE */
@media (max-width: 650px) {
    .header-inner {
        flex-direction: column;
        text-align: center;
    }
    .header-content { text-align: center; }
    .contact-info { justify-content: center; }

    .form-row { flex-direction: column; gap: 0; }
    .form-group { margin-bottom: 15px; width: 100%; }

    /* Dates sur mobile */
    .dates-header-row { display: none; }
    .date-row {
        display: flex;
        flex-direction: column;
        gap: 10px;
        border: 1px solid #eee;
        padding: 15px;
        border-radius: 8px;
        background: #fafafa;
    }
    .mobile-label { display: block; }
    .btn-remove { align-self: flex-end; margin-top: -40px; }
    .btn-placeholder { display: none; }

    .button-row { flex-direction: column; }
    
    header, main { padding: 20px; margin: 10px auto; width: auto; }
}

/* IMPRESSION */
@media print {
    body { background: white; padding-top: 0; }
    main { box-shadow: none; border: none; width: 100%; max-width: 100%; padding: 0; margin: 0; }
    header { 
        box-shadow: none; 
        border-bottom: 2px solid var(--cfdt-orange); 
        padding-bottom: 10px; 
        margin: 0 0 20px 0; 
        max-width: 100%;
        padding: 0;
    }
    .btn-primary, .btn-secondary, .btn-reset, .btn-add-date, .btn-remove, footer hr, .btn-reset-dates, .tooltip-icon { display: none; }
    .form-group input, .date-input-group input { border: none; padding: 0; font-weight: bold; background: none; }
    .result-section { border-top: 2px solid #333; }
}