/* ============================================================
   MLTC - Circulations
   Layout: carte en haut, compositions en dessous pleine largeur
   ============================================================ */

/* ---- Hero ---- */
.circ-hero {
    padding: 140px 0 24px;
    text-align: left;
}
.circ-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5.5vw, 3.5rem);
    margin-bottom: var(--spacing-xs);
    background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.circ-subtitle {
    margin-top: 8px;
    color: var(--text-secondary);
    max-width: 720px;
    font-size: 1.05rem;
    line-height: 1.55;
}

/* ---- Map skeleton loader ---- */
.circ-map-skeleton {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 0;
}
.circ-skeleton-shape {
    width: 260px;
    height: 180px;
    border-radius: var(--radius-lg, 12px);
    background: linear-gradient(110deg, var(--border, #e5e7eb) 30%, var(--surface-alt, #f3f4f6) 50%, var(--border, #e5e7eb) 70%);
    background-size: 200% 100%;
    animation: circ-shimmer 1.5s ease-in-out infinite;
}
.circ-skeleton-text {
    font-size: 0.88rem;
    color: var(--text-muted);
}
.circ-map-skeleton.hidden {
    display: none;
}
@keyframes circ-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Map section ---- */
.circ-map-section {
    padding: 24px 0 0;
}
.circ-map-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px 24px 20px;
    box-shadow: var(--shadow-sm);
    max-width: 820px;
    margin: 0 auto;
}
.circ-map {
    width: 100%;
    height: auto;
    display: block;
}

/* ---- Country shapes (geographic) ---- */
.circ-country {
    cursor: pointer;
    outline: none;
}
.circ-shape {
    fill: #c8c8c8;
    stroke: var(--surface, #fff);
    stroke-width: 1.2;
    stroke-linejoin: round;
    transition: fill .2s, stroke .25s;
}

/* Hover */
.circ-country:hover .circ-shape,
.circ-country:focus .circ-shape {
    fill: var(--primary-200, #e9d5ff);
}

/* Active (selected) */
.circ-country.active .circ-shape {
    fill: var(--primary-500, #a855f7);
    stroke: var(--primary-600, #9333ea);
    stroke-width: 1.5;
}

/* Dimmed (search/filter) */
.circ-country.dimmed {
    pointer-events: none;
    opacity: .15;
}
.circ-country.dimmed .circ-shape {
    fill: #e8e8e8;
}

/* Hint */
.circ-map-hint {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.88rem;
    text-align: center;
}

/* ---- Country bar (between map & compositions) ---- */
.circ-bar {
    padding: 20px 0 0;
}
.circ-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 18px 24px;
    box-shadow: var(--shadow-sm);
}
.circ-bar-country h2 {
    margin: 0;
    font-size: 1.35rem;
    font-family: var(--font-display);
    line-height: 1.3;
}
.circ-bar-country p {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.45;
}
.circ-bar-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.circ-bar-controls input[type="search"] {
    padding: 8px 14px;
    border-radius: 0;
    border: 1px solid var(--border);
    background: var(--surface-elevated);
    font-size: .92rem;
    color: var(--text-primary);
    width: 200px;
}
.circ-bar-controls select {
    padding: 8px 12px;
    border-radius: 0;
    border: 1px solid var(--border);
    background: var(--surface-elevated);
    font-size: .9rem;
    color: var(--text-primary);
}

/* ---- Compositions section (full width, below map) ---- */
.circ-compositions {
    padding: 20px 0 48px;
}
/* Compositions section - 80% viewport width, centered */
.circ-compositions > .container {
    max-width: 90%;
    padding: 0;
}

.circ-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.circ-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 0;
    font-size: .95rem;
}
.circ-empty.hidden {
    display: none;
}

/* Composition - flat, separator between items */
.circ-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
.circ-item + .circ-item {
    border-top: 1px solid var(--border);
}

/* Top row: badge + name + detail */
.circ-item-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.circ-item-service {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 2px 8px;
    border-radius: 0;
    background: var(--primary-100, #dbeafe);
    color: var(--primary-700, #7c3aed);
    white-space: nowrap;
    flex-shrink: 0;
}
.circ-item-head h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

/* Route expand toggle */
.circ-route {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}
.circ-route-origin,
.circ-route-dest {
    white-space: nowrap;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.circ-route-stops {
    display: inline;
    transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1), transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    opacity: 1;
    transform: translateX(0);
}
.circ-route-stops[hidden] {
    display: none;
}
.circ-route-stops.circ-route-entering {
    opacity: 0;
    transform: translateX(-12px);
}
.circ-route-stops.circ-route-leaving {
    opacity: 0;
    transform: translateX(-12px);
}
.circ-route-mid {
    color: var(--text-secondary);
    font-weight: 400;
}
.circ-route-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px;
    margin-left: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.circ-route-toggle svg {
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.circ-route-toggle:hover {
    color: var(--primary-500);
    border-color: var(--primary-500);
}
.circ-route-toggle.circ-route-open svg {
    transform: rotate(180deg);
}

.circ-item-detail {
    font-size: .85rem;
    color: var(--text-muted);
    margin: 0;
    margin-left: auto;
}

/* ---- Consist frame (black, 66px, scroll) ---- */
/* wrapper keeps frame + scrollbar together */
.circ-consist-wrap { position: relative; }

.circ-consist {
    background: #0a0a10;
    height: 66px;
    overflow: hidden;          /* scrollbar NO LONGER here */
    display: flex;
    align-items: flex-end;
    position: relative;
}

/* separate scroll track below the rail - mirrors .lv-scroll-track */
.circ-scroll {
    width: 100%;
    height: 14px;
    overflow-x: scroll;
    overflow-y: hidden;
    background: rgba(124,58,237,0.06);
    border-top: 1px solid rgba(124,58,237,0.25);
    scrollbar-width: auto;
    scrollbar-color: var(--primary-400) rgba(124,58,237,0.08);
    box-sizing: border-box;
}
.circ-scroll-spacer { height: 1px; }

/* violet scrollbar - Webkit */
.circ-scroll::-webkit-scrollbar { height: 100%; }
.circ-scroll::-webkit-scrollbar-track { background: rgba(124,58,237,0.06); }
.circ-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-500);
    border-radius: 0;
    border: 2px solid rgba(124,58,237,0.08);
}
.circ-scroll::-webkit-scrollbar-thumb:hover { background: var(--primary-400); }

.circ-consist-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    min-width: 100%;
    height: 100%;
    flex-shrink: 0;
}

/* Row of individual vehicles side-by-side */
.circ-vehicle-row {
    display: flex;
    align-items: flex-end;
    flex-shrink: 0;
    padding-left: 10px;
    padding-right: 10px;
}

/* Train panoramic image - native pixel size, no drag */
.circ-train-img {
    display: block;
    max-width: none;
    image-rendering: pixelated;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    position: relative;
    z-index: 0;
}

.circ-coupler-img {
    display: block;
    max-width: none;
    image-rendering: pixelated;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

/* Track - always fills full width of the frame */
.circ-track {
    width: 100%;
    height: 8px;
    background: url(../mltc/assets/1-Voie_Bois.png) repeat-x left center;
    background-size: auto 8px;
    flex-shrink: 0;
}

/* ---- Segment label (loco change mid-route) ---- */
.circ-segment-label {
    display: block;
    font-size: .78rem;
    color: var(--text-muted);
    padding: 6px 0 2px;
    font-style: italic;
}

/* ---- Multi-segment group (e.g. locomotive change) ---- */
.circ-segments-group {
    border-left: 3px solid var(--primary-300, #a78bfa);
    padding-left: 12px;
    margin: 4px 0;
    border-radius: 2px;
}

[data-theme="dark"] .circ-segments-group {
    border-left-color: var(--primary-500, #7c3aed);
}

.circ-segments-group .circ-consist-wrap + .circ-consist-wrap {
    margin-top: 2px;
}

.circ-segments-group .circ-segment-label {
    padding-top: 8px;
}

.circ-footer {
    margin-top: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: .82rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .circ-compositions > .container {
        max-width: 95%;
    }
    .circ-bar-inner {
        flex-direction: column;
        align-items: stretch;
    }
    .circ-bar-controls {
        flex-direction: column;
    }
    .circ-bar-controls input[type="search"] {
        width: 100%;
    }
    .circ-map-wrap {
        padding: 16px 12px 12px;
    }
    .circ-item-head {
        flex-direction: column;
        gap: 4px;
    }
    .circ-item-detail {
        margin-left: 0;
    }
    /* Mobile: scroll directly on consist, hide separate scrollbar */
    .circ-consist {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .circ-consist::-webkit-scrollbar { display: none; }
    .circ-scroll { display: none; }
}
@media (max-width: 500px) {
    .circ-hero {
        padding: 48px 0 16px;
    }

}
