/* ===================================================
   INDEMNITÉS KILOMÉTRIQUES
   Barème fiscal (arrêté du 27 mars 2023, inchangé
   pour les revenus 2023, 2024 et 2025).

   Le calculateur est construit en étapes numérotées :
   le barème dépend de trois variables (type de
   véhicule, puissance fiscale, motorisation) avant
   même qu'on parle de kilomètres. Les présenter à
   plat ferait un formulaire de 8 champs illisible.
   =================================================== */

/* Plusieurs blocs de cet outil sont masqués via l'attribut [hidden] alors que
   leurs classes leur donnent un display grid/flex — qui l'emporterait sur la
   règle [hidden] de la feuille par défaut du navigateur. On la réaffirme. */
[hidden] { display: none !important; }

/* ---------- Étapes ---------- */
.ik-step {
    padding: var(--ho-space-5) 0;
    border-bottom: 1px solid var(--ho-border-default);
}
.ik-step:first-of-type { padding-top: 0; }
.ik-step:last-of-type  { border-bottom: none; padding-bottom: 0; }

.ik-step-head {
    display: flex;
    align-items: baseline;
    gap: var(--ho-space-3);
    margin-bottom: var(--ho-space-4);
}

.ik-step-num {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: var(--ho-radius-full);
    background: var(--ho-primary-500);
    color: var(--ho-text-inverse);
    font-size: var(--ho-text-sm);
    font-weight: var(--ho-font-bold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.ik-step-title {
    font-size: var(--ho-text-md);
    font-weight: var(--ho-font-semibold);
    color: var(--ho-text-primary);
    margin: 0;
}
.ik-step-hint {
    display: block;
    font-size: var(--ho-text-sm);
    font-weight: var(--ho-font-regular);
    color: var(--ho-text-muted);
    margin-top: 2px;
}

/* ---------- Tuiles de choix (radios stylées) ---------- */
.ik-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    gap: var(--ho-space-3);
}
.ik-choices--wide {
    grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
}

.ik-choice {
    position: relative;
    display: block;
    margin: 0;
    padding: var(--ho-space-4);
    background: var(--ho-gray-50);
    border: 2px solid var(--ho-border-default);
    border-radius: var(--ho-radius-md);
    cursor: pointer;
    text-align: center;
    transition: border-color .2s, background .2s, transform .2s;
}
.ik-choice:hover { border-color: var(--ho-primary-300); }

/* Le radio reste dans le flux pour rester focusable au clavier,
   mais invisible : c'est la tuile entière qui sert de cible. */
.ik-choice input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.ik-choice:focus-within {
    outline: 3px solid rgba(26, 125, 109, .35);
    outline-offset: 2px;
}

.ik-choice.is-selected {
    border-color: var(--ho-primary-500);
    background: var(--ho-primary-50);
}

.ik-choice i {
    display: block;
    font-size: 1.6rem;
    color: var(--ho-primary-500);
    margin-bottom: var(--ho-space-2);
}
.ik-choice-label {
    display: block;
    font-weight: var(--ho-font-semibold);
    color: var(--ho-text-primary);
    line-height: 1.25;
}
.ik-choice-sub {
    display: block;
    font-size: var(--ho-text-xs);
    color: var(--ho-text-muted);
    margin-top: 4px;
}

/* Variante compacte : puissances fiscales, sur une ligne */
.ik-choice--compact { padding: var(--ho-space-3) var(--ho-space-2); }
.ik-choice--compact .ik-choice-label { font-size: var(--ho-text-sm); }

/* Badge « +20 % » de la motorisation électrique */
.ik-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 10px;
    border-radius: var(--ho-radius-full);
    background: var(--ho-success-bg);
    color: var(--ho-success);
    font-size: var(--ho-text-xs);
    font-weight: var(--ho-font-semibold);
}

/* ---------- Onglets de saisie du kilométrage ---------- */
.ik-tabs {
    display: inline-flex;
    padding: 4px;
    background: var(--ho-gray-100);
    border-radius: var(--ho-radius-full);
    margin-bottom: var(--ho-space-4);
    flex-wrap: wrap;
    gap: 4px;
}
.ik-tab {
    border: none;
    background: transparent;
    color: var(--ho-text-secondary);
    font-size: var(--ho-text-sm);
    font-weight: var(--ho-font-semibold);
    padding: var(--ho-space-2) var(--ho-space-5);
    border-radius: var(--ho-radius-full);
    cursor: pointer;
    transition: background .2s, color .2s;
}
.ik-tab:hover { color: var(--ho-primary-600); }
.ik-tab.is-active {
    background: #fff;
    color: var(--ho-primary-600);
    box-shadow: var(--ho-shadow-sm);
}

.ik-pane { display: none; }
.ik-pane.is-active { display: block; }

/* ---------- Champs ---------- */
.ik-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: var(--ho-space-4);
}
.ik-field label {
    display: block;
    font-size: var(--ho-text-sm);
    font-weight: var(--ho-font-medium);
    color: var(--ho-text-secondary);
    margin-bottom: var(--ho-space-2);
}
.ik-field .input-group-text {
    background: var(--ho-gray-100);
    border-color: var(--ho-border-strong);
    color: var(--ho-text-secondary);
    font-weight: var(--ho-font-medium);
}
.ik-field .form-control,
.ik-field .form-select {
    border-color: var(--ho-border-strong);
    font-weight: var(--ho-font-semibold);
    color: var(--ho-text-primary);
}
.ik-field-note {
    display: block;
    font-size: var(--ho-text-xs);
    color: var(--ho-text-muted);
    margin-top: 6px;
}

/* ---------- Panneau dépliant (frais annexes, comparateur) ---------- */
.ik-panel {
    border: 1px solid var(--ho-border-default);
    border-radius: var(--ho-radius-md);
    overflow: hidden;
    margin-top: var(--ho-space-4);
    background: #fff;
}
.ik-panel-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--ho-space-3);
    padding: var(--ho-space-4);
    background: var(--ho-gray-50);
    border: none;
    text-align: left;
    cursor: pointer;
    font-weight: var(--ho-font-semibold);
    color: var(--ho-text-primary);
}
.ik-panel-toggle:hover { background: var(--ho-gray-100); }
.ik-panel-toggle .fa-chevron-down { transition: transform .25s; }
.ik-panel.is-open .ik-panel-toggle .fa-chevron-down { transform: rotate(180deg); }
.ik-panel-toggle small {
    display: block;
    font-weight: var(--ho-font-regular);
    color: var(--ho-text-muted);
    font-size: var(--ho-text-xs);
    margin-top: 2px;
}
.ik-panel-body { display: none; padding: var(--ho-space-5); }
.ik-panel.is-open .ik-panel-body { display: block; }

/* ---------- Résultat ---------- */
.ik-result {
    background: linear-gradient(135deg, var(--ho-primary-600), var(--ho-primary-800));
    border-radius: var(--ho-radius-lg);
    color: var(--ho-text-inverse);
    padding: var(--ho-space-6);
    margin-top: var(--ho-space-6);
}
.ik-result-label {
    font-size: var(--ho-text-sm);
    text-transform: uppercase;
    letter-spacing: var(--ho-tracking-wider);
    color: rgba(255, 255, 255, .8);
    margin-bottom: var(--ho-space-2);
}
.ik-result-total {
    font-size: clamp(2.25rem, 1.2rem + 4vw, 3.25rem);
    font-weight: var(--ho-font-bold);
    line-height: 1.05;
    letter-spacing: var(--ho-tracking-tight);
}
.ik-result-sub {
    color: rgba(255, 255, 255, .82);
    font-size: var(--ho-text-sm);
    margin-top: var(--ho-space-2);
}

.ik-formula {
    display: inline-block;
    margin-top: var(--ho-space-4);
    padding: var(--ho-space-2) var(--ho-space-4);
    background: rgba(255, 255, 255, .12);
    border-radius: var(--ho-radius-sm);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--ho-text-sm);
}

.ik-breakdown {
    margin-top: var(--ho-space-5);
    border-top: 1px solid rgba(255, 255, 255, .22);
    padding-top: var(--ho-space-4);
}
.ik-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--ho-space-4);
    padding: var(--ho-space-2) 0;
    font-size: var(--ho-text-sm);
    color: rgba(255, 255, 255, .88);
}
.ik-line span:last-child {
    font-weight: var(--ho-font-semibold);
    white-space: nowrap;
    color: #fff;
}
.ik-line--total {
    border-top: 1px solid rgba(255, 255, 255, .22);
    margin-top: var(--ho-space-2);
    padding-top: var(--ho-space-3);
    font-size: var(--ho-text-md);
    font-weight: var(--ho-font-semibold);
    color: #fff;
}
.ik-line--muted { color: rgba(255, 255, 255, .6); }

/* Vignettes chiffrées sous le total */
.ik-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: var(--ho-space-3);
    margin-top: var(--ho-space-5);
}
.ik-metric {
    background: rgba(255, 255, 255, .1);
    border-radius: var(--ho-radius-md);
    padding: var(--ho-space-3) var(--ho-space-4);
}
.ik-metric-value {
    font-size: var(--ho-text-lg);
    font-weight: var(--ho-font-bold);
    color: #fff;
}
.ik-metric-label {
    font-size: var(--ho-text-xs);
    color: rgba(255, 255, 255, .75);
    margin-top: 2px;
}

/* ---------- Encarts d'information ---------- */
.ik-notice {
    display: flex;
    gap: var(--ho-space-3);
    padding: var(--ho-space-4);
    border-radius: var(--ho-radius-md);
    font-size: var(--ho-text-sm);
    line-height: var(--ho-leading-snug);
    margin-top: var(--ho-space-4);
}
.ik-notice i { flex: 0 0 auto; margin-top: 3px; }
.ik-notice p:last-child { margin-bottom: 0; }
.ik-notice--info    { background: var(--ho-info-bg);    color: var(--ho-info); }
.ik-notice--warning { background: var(--ho-warning-bg); color: #8a5a00; }
.ik-notice--warning i { color: var(--ho-warning); }
.ik-notice--success { background: var(--ho-success-bg); color: var(--ho-success); }
.ik-notice strong { color: inherit; }

/* Verdict du comparateur frais réels / abattement 10 % */
.ik-verdict {
    border-radius: var(--ho-radius-md);
    padding: var(--ho-space-5);
    margin-top: var(--ho-space-4);
    background: var(--ho-gray-50);
    border-left: 4px solid var(--ho-gray-400);
}
.ik-verdict.is-favorable   { background: var(--ho-success-bg); border-left-color: var(--ho-success); }
.ik-verdict.is-unfavorable { background: var(--ho-warning-bg); border-left-color: var(--ho-warning); }
.ik-verdict-title {
    font-weight: var(--ho-font-bold);
    font-size: var(--ho-text-md);
    margin-bottom: var(--ho-space-2);
    color: var(--ho-text-primary);
}
.ik-verdict-compare {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
    gap: var(--ho-space-3);
    margin-top: var(--ho-space-4);
}
.ik-verdict-cell {
    background: rgba(255, 255, 255, .7);
    border-radius: var(--ho-radius-sm);
    padding: var(--ho-space-3);
}
.ik-verdict-cell b {
    display: block;
    font-size: var(--ho-text-lg);
    color: var(--ho-text-primary);
}
.ik-verdict-cell small { color: var(--ho-text-muted); }

/* ---------- Tableau du barème ---------- */
.ik-table-scroll { overflow-x: auto; }
.ik-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
    font-size: var(--ho-text-sm);
}
.ik-table th,
.ik-table td {
    padding: var(--ho-space-3) var(--ho-space-4);
    text-align: left;
    border-bottom: 1px solid var(--ho-border-default);
}
.ik-table thead th {
    background: var(--ho-gray-100);
    color: var(--ho-text-secondary);
    font-weight: var(--ho-font-semibold);
    white-space: nowrap;
}
.ik-table tbody th {
    font-weight: var(--ho-font-semibold);
    color: var(--ho-text-primary);
    white-space: nowrap;
}
.ik-table td { font-variant-numeric: tabular-nums; color: var(--ho-text-secondary); }
.ik-table tbody tr.is-active { background: var(--ho-primary-50); }
.ik-table tbody tr.is-active th { color: var(--ho-primary-700); }
.ik-table td.is-active {
    background: var(--ho-primary-500);
    color: #fff;
    font-weight: var(--ho-font-bold);
    border-radius: var(--ho-radius-sm);
}
.ik-table caption {
    caption-side: bottom;
    padding-top: var(--ho-space-3);
    font-size: var(--ho-text-xs);
    color: var(--ho-text-muted);
    text-align: left;
}

/* ---------- Grille d'infos ---------- */
.ik-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: var(--ho-space-5);
}
.ik-info-card {
    background: var(--ho-gray-50);
    border-radius: var(--ho-radius-md);
    padding: var(--ho-space-5);
}
.ik-info-card h4 {
    font-size: var(--ho-text-base);
    font-weight: var(--ho-font-semibold);
    color: var(--ho-text-primary);
    margin-bottom: var(--ho-space-3);
}
.ik-info-card h4 i { color: var(--ho-primary-500); margin-right: 8px; }
.ik-info-card p,
.ik-info-card li {
    font-size: var(--ho-text-sm);
    color: var(--ho-text-secondary);
    line-height: var(--ho-leading-normal);
}
.ik-info-card ul { padding-left: 1.1rem; margin-bottom: 0; }

/* ---------- FAQ ---------- */
.ik-faq details {
    border-bottom: 1px solid var(--ho-border-default);
    padding: var(--ho-space-4) 0;
}
.ik-faq details:last-child { border-bottom: none; }
.ik-faq summary {
    cursor: pointer;
    font-weight: var(--ho-font-semibold);
    color: var(--ho-text-primary);
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: var(--ho-space-4);
}
.ik-faq summary::-webkit-details-marker { display: none; }
.ik-faq summary::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
    font-weight: 900;
    font-size: .75rem;
    color: var(--ho-primary-500);
    transition: transform .25s;
}
.ik-faq details[open] summary::after { transform: rotate(180deg); }
.ik-faq details p {
    margin: var(--ho-space-3) 0 0;
    color: var(--ho-text-secondary);
    font-size: var(--ho-text-sm);
    line-height: var(--ho-leading-normal);
}

/* ---------- Actions ---------- */
.ik-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ho-space-3);
    justify-content: center;
    margin-top: var(--ho-space-6);
}
/* Bouton plein autonome : la classe .btn-reset de _tools-base.css se fait
   écraser ici par une règle .btn globale (fond transparent, texte blanc),
   ce qui rendait le bouton invisible sur la carte blanche. */
.ik-btn-primary {
    background: linear-gradient(135deg, var(--ho-primary-500), var(--ho-primary-700));
    border: none;
    color: var(--ho-text-inverse);
    padding: var(--ho-space-3) var(--ho-space-6);
    border-radius: var(--ho-radius-full);
    font-weight: var(--ho-font-semibold);
    transition: transform .2s, box-shadow .2s;
}
.ik-btn-primary:hover {
    color: var(--ho-text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--ho-shadow-md);
}

.ik-btn-ghost {
    background: transparent;
    border: 2px solid var(--ho-border-strong);
    color: var(--ho-text-secondary);
    padding: var(--ho-space-3) var(--ho-space-5);
    border-radius: var(--ho-radius-full);
    font-weight: var(--ho-font-semibold);
    transition: all .2s;
}
.ik-btn-ghost:hover {
    border-color: var(--ho-primary-500);
    color: var(--ho-primary-600);
}

.ik-source {
    font-size: var(--ho-text-xs);
    color: var(--ho-text-muted);
    text-align: center;
    margin-top: var(--ho-space-4);
}
.ik-source a { color: var(--ho-primary-600); }

/* ---------- Impression : on ne garde que le calcul ---------- */
@media print {
    .breadcrumb-custom,
    .ik-actions,
    .ik-tabs,
    .ad-unit,
    footer,
    .navbar { display: none !important; }
    .ho-tools-wrapper { background: #fff !important; padding: 0 !important; }
    .ik-result {
        background: #fff !important;
        color: #000 !important;
        border: 2px solid #000;
    }
    .ik-result-label,
    .ik-result-sub,
    .ik-line,
    .ik-metric-label { color: #333 !important; }
    .ik-line span:last-child,
    .ik-metric-value { color: #000 !important; }
    .ik-metric, .ik-formula { background: #f2f2f2 !important; }
}

@media (max-width: 575.98px) {
    .ik-choices { grid-template-columns: repeat(2, 1fr); }
    .ik-tabs { display: flex; width: 100%; }
    .ik-tab { flex: 1 1 auto; text-align: center; }
}
