/* ========================================
   PROGRAM STATION CARDS
   CSS for the top 6 individual program cards
   with large stops and compact CEFR blobs
   ======================================== */

/* Program Station Cards Grid */
.programs-grid-station-cards {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin: 0 auto 60px auto;
    max-width: 100%;
    justify-content: center;
    padding: 40px;
    background: white;
    border-radius: 20px;
}

/* Program Row - Card + Image Block */
.program-row {
    display: flex;
    gap: 30px;
    align-items: stretch;
    width: 100%;
    min-height: 300px;
}

/* Reverse layout for alternating rows - using order instead of flex-direction */

/* Force complete swapping with CSS order property */
.program-row .program-card-container {
    order: 1 !important;
}

.program-row .program-image-block {
    order: 2 !important;
}

.program-row.reverse .program-card-container {
    order: 2 !important;
}

.program-row.reverse .program-image-block {
    order: 1 !important;
}

/* Debug backgrounds removed - staggering is working! */


/* Image Block Styling */
.program-image-block {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 15px;
}

.image-large {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 8px;
    border: 2px solid #ddd;
}

.image-large .main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-small-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.image-small-grid .small-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #ddd;
}

/* Program Card Container - wraps card and carousel */
.program-card-container {
    flex: 0 0 60%;
    display: flex;
    flex-direction: column;
    height: 100%;
    align-items: stretch;
    min-height: 300px;
}

/* Individual Carousel Styling */
.individual-carousel {
    width: 100%;
    height: 200px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;

    flex-shrink: 0;
}

/* New DRY Level Carousel inside cards */
.level-carousel { width: 100%; }
.level-carousel .level-viewport {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;

}
/* 16:9 aspect ratio */
.level-carousel .level-viewport::before {
    content: "";
    display: block;
    padding-top: 56.25%;
}
.level-carousel .level-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.level-carousel .level-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.55) 60%);
    color: #fff;
    padding: 12px 14px;
}
.level-carousel .level-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.level-carousel .level-meta-line { opacity: 0.9; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.level-carousel .dot-sep { opacity: .6; }
.level-carousel .level-blurb {
    margin-top: 6px; font-size: 13px; opacity: .95;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    line-clamp: 2;
}
.level-carousel .level-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,0.92); color: #333; font-size: 20px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.level-carousel .level-nav.prev { left: 10px; }
.level-carousel .level-nav.next { right: 10px; }
.level-carousel .level-nav:hover { background: #fff; }

@media (max-width: 768px) {
    .level-carousel .level-viewport::before { padding-top: 62%; }
    .level-carousel .level-nav { width: 40px; height: 40px; font-size: 18px; }
}

.individual-carousel .carousel-track-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.individual-carousel .carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
}

.individual-carousel .carousel-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.individual-carousel .carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.individual-carousel .carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.individual-carousel .carousel-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.individual-carousel .carousel-btn-prev {
    left: 10px;
}

.individual-carousel .carousel-btn-next {
    right: 10px;
}

/* Top Program Cards - Individual cards with large stops */
.program-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    width: 100%;
    height: 100%;

    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
    text-decoration: none !important;
    color: inherit !important;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    flex: 1;
    min-height: 336px; /* 20% taller (280px * 1.2) */
    justify-content: space-between;
    position: relative;
}

/* Level Display Area - top section with nav buttons */
.program-card .level-display-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    flex: 0 0 50%;
    justify-content: center;
    width: 100%;
}

/* Top row: Large stop + title + CEFR blobs */
.program-card .level-display-area .level-header-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    justify-content: space-between;
    width: 100%;
}

.program-card .level-display-area .book-cover {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #ddd;
    flex-shrink: 0;
}

.program-card .level-display-area .level-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;

    transition: all 0.3s ease;
    z-index: 20;
    pointer-events: auto;
}

.program-card .level-display-area .level-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.program-card .level-display-area .level-nav.prev {
    left: -15px;
}

.program-card .level-display-area .level-nav.next {
    right: -15px;
}

/* Program Info Footer - always visible at bottom */
.program-card .program-info {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 15px;
    width: 100%;
}

/* Navigation buttons in footer */
        .program-card .program-info .level-nav {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 72px;
            height: 72px;
            border-radius: 50%;
            border: none;
            cursor: pointer;
            background: rgba(255, 255, 255, 0.9);
            color: #333;
            font-size: 32px;
            font-weight: 700;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            z-index: 20;
            pointer-events: auto;
        }

.program-card .program-info .level-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.program-card .program-info .level-nav.prev {
    left: -10px;
}

.program-card .program-info .level-nav.next {
    right: -10px;
}

/* Program Link Overlay - invisible but clickable */
.program-card .program-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    text-decoration: none;
    pointer-events: auto;
}

/* Ensure navigation buttons are clickable */
.program-card .level-display-area .level-nav {
    pointer-events: auto !important;
}

/* Level Meta Line - Top Left Corner */
.program-card > .level-meta-line {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 15;
    font-size: 10px;
    font-weight: 800;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;

    display: flex;
    align-items: center;
    gap: 4px;
}

/* Program-specific background colors for level meta line */
.program-card.w > .level-meta-line {
    background: #1ABC9C;
}

.program-card.rh > .level-meta-line {
    background: #8A2BE2;
}

.program-card.bck > .level-meta-line {
    background: #FF69B4;
}

.program-card.tc > .level-meta-line {
    background: #E74C3C;
}

.program-card.bb > .level-meta-line {
    background: #FFD700;
}

.program-card.gt > .level-meta-line {
    background: #34495E;
}

.program-card > .level-meta-line .dot-sep {
    opacity: 0.8;
    font-weight: 600;
    color: white;
}

.program-card:hover {
    transform: translateY(-5px);

    border-color: #ccc;
}

.program-card h3 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0;
    padding-top: 2rem;
}

.program-card .program-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    text-align: center;
    margin: 0;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: pre-line;
}

.program-card .program-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 60px;
    align-items: center;
}

.program-card .program-info > div:first-child {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Level count in brackets - 50% smaller */
.program-card .program-info .level-count {
    font-size: 12px; /* 50% of 16px */
    font-weight: 400;
    color: #666;
}

.program-card .cefr-blobs {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Compact CEFR Display for Top Program Cards */
.program-card .tpd-cefr-level-display {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

.program-card .tpd-cefr-text {
    font-size: 10px;
    font-weight: 700;
    color: #666;
    margin-left: .3rem;
	margin-bottom: .3rem;
}

/* Colored Large Stops for Top Program Cards */
.program-card.w .large-stop {
    border-color: #1ABC9C;
    color: #1ABC9C;
}

.program-card.rh .large-stop {
    border-color: #8A2BE2;
    color: #8A2BE2;
}

.program-card.bb .large-stop {
    border-color: #FFD700;
    color: #333;
}

.program-card.bck .large-stop {
    border-color: #FF69B4;
    color: #FF69B4;
}

.program-card.tc .large-stop {
    border-color: #E74C3C;
    color: #E74C3C;
}

.program-card.gt .large-stop {
    border-color: #34495E;
    color: #34495E;
}

/* Large Stops */
.large-stop {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 16px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    position: relative;
    flex-shrink: 0;
}

/* Title and CEFR container - to the right of large stop */
.program-card .level-display-area .level-title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.program-card .level-display-area .level-title {
    text-align: center;
}

.program-card .level-display-area .tpd-cefr-level-display {
    justify-content: center;
}

/* Description section - full width below header */
.program-card .level-description {
    flex: 0 0 50%;
    width: 100%;
    padding: 0 20px;
}

.large-stop .stop-program {
    font-size: 60px;
    font-weight: bold;
    color: #333;
    line-height: 0.9;
    margin-bottom: 4px;
    margin-top: 8px;
}

.large-stop .stop-number {
    font-size: 60px;
    font-weight: bold;
    color: #333;
    line-height: 0.9;
    margin-bottom: 6px;
}

/* Station Demo Styles */
.station-demo {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 5px;
    position: relative;
}

.medium-stop {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 12px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;

    position: relative;
    flex-shrink: 0;
}

.small-stop {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 6px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;

    position: relative;
    flex-shrink: 0;
}

.bck-station {
    border-color: #FF69B4;
    color: #FF69B4;
}

.medium-stop.cefr-station {
    border: 22px solid transparent !important;
    border-radius: 50%;
    background: linear-gradient(white, white) padding-box, 
               linear-gradient(45deg, #FFB6C1, #FFA07A, #FF9A9E, #98FB98, #87CEEB, #DDA0DD, #F0A0A0) border-box !important;
    background-origin: border-box;
    background-clip: padding-box, border-box;
    color: #333333;
}

.station-code {
    font-size: 55px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.station-number {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.station-info {
    flex: 1;
}

.info-line {
    display: flex;
    font-size: 14px;
    margin-bottom: 4px;
    color: #666;
}

.info-label {
    width: 80px;
    color: #999;
    font-weight: 400;
}

.info-value {
    color: #333;
    font-weight: 400;
}

.feature-list {
    list-style: none;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.feature-item::before {
    content: '•';
    color: #0066cc;
    font-size: 16px;
    margin-right: 12px;
    margin-top: -2px;
}

/* Responsive font scaling for station codes */
@media (max-width: 1024px) {
    .station-code {
        font-size: 45px;
    }
}

@media (max-width: 768px) {
    .programs-grid-station-cards {
        gap: 20px;
        max-width: 100%;
        padding: 20px;
    }
    
    .program-row {
        flex-direction: column !important;
        gap: 20px;
    }
    
    .program-row.reverse {
        flex-direction: column !important;
    }
    
    .program-card-container {
        flex: none !important;
    }
    
    .program-image-block {
        flex: none !important;
    }
    
    .program-card {
        padding: 20px;
    }
    
    /* Stack large stop and title vertically on mobile */
    .program-card .level-display-area {
        flex-direction: column !important;
    }
    
    .program-card .level-display-area .level-header-row {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .program-card h3 {
        font-size: 20px;
    }
    
    .program-card .program-description {
        font-size: 13px;
    }
    
    .program-card-container {
        gap: 15px;
        height: 100%;
    }
    
    .individual-carousel {
        height: 150px;
        flex-shrink: 0;
    }
    
    .program-card {
        min-height: 300px; /* 20% taller mobile (250px * 1.2) */
    }
    
    .program-card .program-info .level-nav {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }
    
    .program-card .program-info .level-nav.prev {
        left: -10px;
    }

    .program-card .program-info .level-nav.next {
        right: -10px;
    }
    
    .program-card .program-description {
        min-height: 50px;
    }
    
    .program-card .program-info {
        min-height: 50px;
    }
    
    .individual-carousel .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .individual-carousel .carousel-btn-prev {
        left: 8px;
    }
    
    .individual-carousel .carousel-btn-next {
        right: 8px;
    }
    
    .station-demo {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .station-code {
        font-size: 35px;
    }
}

@media (max-width: 480px) {
    .station-code {
        font-size: 25px;
    }
}
