/**
 * Page Évolution des valeurs pilotes (/driver-costs)
 * Accordéon par GP, mobile-first
 */

/* ---- Header ---- */
.dc-header {
    margin-bottom: 1.75rem;
}

.dc-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* ---- Rounds list ---- */
.dc-rounds {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ---- Individual round accordion ---- */
.dc-round {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.15s;
}

.dc-round[open] {
    border-color: color-mix(in srgb, var(--accent) 38%, transparent);
}

.dc-round--future {
    opacity: 0.45;
}

/* ---- Summary (clickable header) ---- */
.dc-round-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--surface-muted);
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    min-height: 52px;
}

.dc-round--future .dc-round-summary {
    cursor: default;
    pointer-events: none;
}

/* Remove default marker in all browsers */
.dc-round-summary::-webkit-details-marker { display: none; }
.dc-round-summary::marker { display: none; }

.dc-round-summary:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: -2px;
}

/* Left side: badge + name */
.dc-round-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.dc-round-badge {
    flex-shrink: 0;
    font-family: var(--font-title);
    font-size: 0.85rem;
    color: var(--bg-dark);
    background: var(--accent);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    line-height: 1.3;
}

.dc-round-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.dc-round-name {
    font-family: var(--font-title);
    font-size: 1.05rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-round-country {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Right side: meta + chevron */
.dc-round-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.dc-drivers-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.dc-future-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-card-mid);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.dc-chevron {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.dc-round[open] .dc-chevron {
    transform: rotate(180deg);
}

/* ---- Drivers list ---- */
.dc-drivers-list {
    list-style: none;
    background: var(--surface-overlay);
    border-top: 1px solid var(--border);
    padding: 0;
}

.dc-driver-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.dc-driver-row:last-child {
    border-bottom: none;
}

.dc-driver-row:hover {
    background: var(--surface-muted);
}

.dc-driver-name {
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

/* Right side of a driver row */
.dc-driver-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Round 1 — single value */
.dc-cost-single {
    font-family: var(--font-title);
    font-size: 1rem;
    color: var(--color-gold);
}

/* Round 2+ — prev → curr */
.dc-cost-change {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-title);
    font-size: 0.95rem;
}

.dc-prev {
    color: var(--text-muted);
}

.dc-arrow {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.dc-curr {
    color: var(--font-header);
}

/* Delta badge */
.dc-delta {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    line-height: 1.4;
    white-space: nowrap;
    font-family: var(--font-body);
}

.dc-delta--up {
    color: var(--bg-dark);
    background: var(--color-success);
}

.dc-delta--down {
    color: var(--bg-dark);
    background: var(--color-danger);
}

.dc-delta--flat {
    color: var(--text-muted);
    background: var(--bg-card-mid);
}

/* ---- Manual edit badge (✏️) ---- */
.dc-manual-badge {
    font-size: 0.78rem;
    opacity: 0.75;
    flex-shrink: 0;
    cursor: default;
}

/* ---- Locked badge (🔒) in round header ---- */
.dc-locked-badge {
    font-size: 0.85rem;
    opacity: 0.7;
    flex-shrink: 0;
    cursor: default;
}

/* ---- No data fallback ---- */
.dc-no-data {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ---- Back link ---- */
.dc-back {
    margin-top: 2rem;
}

/* ---- Tablet (768px) ---- */
@media (min-width: 768px) {
    .dc-drivers-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .dc-driver-row {
        border-right: 1px solid var(--border);
    }

    /* Reset right border on the second column */
    .dc-driver-row:nth-child(2n) {
        border-right: none;
    }

    /* Ensure border-bottom stays correct in grid context */
    .dc-driver-row:nth-last-child(-n+2):nth-child(odd):last-child,
    .dc-drivers-list:has(.dc-driver-row:nth-child(odd):last-child) .dc-driver-row:last-child {
        border-bottom: none;
    }

    .dc-round-name {
        font-size: 1.15rem;
    }
}

/* ---- Desktop (1024px) ---- */
@media (min-width: 1024px) {
    .dc-rounds {
        gap: 0.6rem;
    }
}
