/* Shared Episode Card Styles for Polyglot Files
 * This file eliminates 1,400+ lines of duplicate CSS across pages
 * Include this file in all pages that display episode cards
 */

/* ===== EPISODE GRID LAYOUTS ===== */
.episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 60px;
}

.episodes-grid.large {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

.episodes-grid.small {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* ===== EPISODE CARD COMPONENT ===== */
.episode-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    user-select: none; /* Prevent text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.episode-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
    border-color: #5eb3f5;
}

/* ===== EPISODE IMAGE SECTION - INCREASED HEIGHTS ===== */
.episode-image {
    width: 100%;
    height: 200px; /* Increased from 160px */
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #e1e5e9;
    overflow: hidden;
    position: relative;
}

.episode-image.large {
    height: 240px; /* Increased from 200px */
}

.episode-image.small {
    height: 180px; /* Increased from 140px */
}

.episode-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: auto;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
}

.episode-card:hover .episode-image img {
    transform: scale(1.05);
}

.episode-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #999;
    font-size: 36px;
}

/* Language-specific gradient backgrounds */
.episode-image.russian-gradient {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.episode-image.georgian-gradient {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

.episode-image.portuguese-gradient {
    background: linear-gradient(135deg, #00b894, #00a085);
}

.episode-image.french-gradient {
    background: linear-gradient(135deg, #6c5ce7, #5f3dc4);
}

.episode-image.croatia-gradient {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.episode-image.food-gradient {
    background: linear-gradient(135deg, #ff9a56, #ff6b35);
}

.episode-image.shopping-gradient {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
}

/* ===== EPISODE CONTENT SECTION ===== */
.episode-content {
    padding: 16px;
    position: relative; /* For absolute positioning of difficulty badge */
    min-height: 160px; /* Increased height for better spacing */
    /* Using normal block layout with absolute positioned badge */
}

.episode-content.large {
    padding: 20px;
    min-height: 180px; /* Increased height for large cards */
}

.episode-content.small {
    padding: 12px;
    min-height: 140px; /* Increased height for small cards */
}

/* ===== EPISODE TITLE COMPONENT ===== */
.episode-title {
    margin-bottom: 10px;
    /* Removed flex-shrink since we're not using flex */
}

.episode-title .foreign,
.episode-title .russian,
.episode-title .georgian,
.episode-title .portuguese,
.episode-title .french {
    color: #5eb3f5;
    font-size: 18px;
    font-weight: bold;
    display: block;
    line-height: 1.2;
    user-select: none; /* Prevent text selection on titles */
}

.episode-title .foreign.large,
.episode-title .russian.large {
    font-size: 22px;
}

.episode-title .foreign.small,
.episode-title .russian.small {
    font-size: 16px;
}

.episode-title .english {
    color: #666;
    font-size: 14px;
    font-weight: 500;
    display: block;
    margin-top: 3px;
    line-height: 1.3;
    user-select: none; /* Prevent text selection on titles */
}

.episode-title .english.large {
    font-size: 16px;
}

.episode-title .english.small {
    font-size: 13px;
}

/* ===== EPISODE DESCRIPTION ===== */
.episode-description {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 15px; /* Normal spacing between description and bottom */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    user-select: none; /* Prevent text selection on descriptions */
    /* Removed flex-grow: 1 to prevent expansion */
}

.episode-description.large {
    font-size: 14px;
    -webkit-line-clamp: 3;
    margin-bottom: 15px;
    padding-bottom: 50px; /* More space for large cards */
}

.episode-description.small {
    font-size: 12px;
    margin-bottom: 12px;
    padding-bottom: 40px; /* Less space for small cards */
}

/* ===== DIFFICULTY BADGE CONTAINER - ANCHORED TO BOTTOM-LEFT ===== */
.episode-meta {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    justify-content: flex-start; /* Align to left */
    align-items: center;
    font-size: 11px;
    color: #999;
    user-select: none; /* Prevent text selection on metadata */
    margin: 0; /* Remove any margin since it's absolutely positioned */
}

.episode-meta.large {
    bottom: 20px;
    left: 20px;
    right: 20px;
    font-size: 12px;
}

.episode-meta.small {
    bottom: 12px;
    left: 12px;
    right: 12px;
    font-size: 10px;
}

/* ===== DIFFICULTY BADGES - NOW POSITIONED BOTTOM-LEFT ===== */
.difficulty {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    text-transform: lowercase;
    user-select: none; /* Prevent text selection on badges */
    white-space: nowrap; /* Prevent wrapping */
}

.difficulty.large {
    padding: 5px 10px;
    border-radius: 14px;
    font-size: 11px;
}

.difficulty.small {
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 9px;
}

.difficulty.beginner {
    background: #e8f5e8;
    color: #2e7d2e;
}

.difficulty.intermediate {
    background: #fff3cd;
    color: #856404;
}

.difficulty.advanced {
    background: #f8d7da;
    color: #721c24;
}

/* ===== EPISODE COUNT INDICATOR ===== */
.episode-count {
    background: #f0f0f0;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    user-select: none; /* Prevent text selection on count */
    margin-left: 8px; /* Space between difficulty and episode count */
    white-space: nowrap; /* Prevent wrapping */
}

/* ===== EPISODE TAGS - HIDDEN FOR NOW ===== */
.episode-tags {
    display: none; /* Hidden but keeping structure for future use */
    margin-top: 8px;
}

.episode-tags.large {
    margin-top: 10px;
}

.tag {
    display: inline-block;
    background: #f0f0f0;
    color: #666;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 10px;
    margin-right: 4px;
    margin-top: 3px;
    user-select: none; /* Prevent text selection on tags */
}

.tag.large {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-right: 5px;
    margin-top: 5px;
}

/* ===== MISSING FILES WARNING ===== */
.missing-files {
    margin-top: 10px;
    padding: 8px;
    background: #fff3cd;
    border-radius: 4px;
    font-size: 12px;
    color: #856404;
    border-left: 3px solid #f1c40f;
}

/* ===== EMPTY STATE COMPONENT ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #999;
    font-size: 18px;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto 20px auto;
}

.empty-state code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: #333;
}

.empty-state-help {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    font-size: 13px;
    color: #856404;
    line-height: 1.5;
}

.empty-state-help strong {
    color: #664d03;
    display: block;
    margin-bottom: 8px;
}

/* ===== SECTION HEADERS ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.view-all-link {
    color: #5eb3f5;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* ===== SERIES CARDS (for lesson grids) ===== */
.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.lesson-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    user-select: none; /* Prevent text selection on lesson cards */
}

.lesson-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.lesson-image {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
}

/* Lesson image gradients */
.lesson-image.takeout {
    background: linear-gradient(135deg, #ff9a56, #ff6b35);
}

.lesson-image.croatia {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.lesson-image.clothes {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
}

.lesson-image.generic {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.lesson-content {
    padding: 20px;
}

.lesson-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    user-select: none; /* Prevent text selection on lesson titles */
}

.lesson-subtitle {
    font-size: 14px;
    color: #666;
    user-select: none; /* Prevent text selection on lesson subtitles */
}

/* ===== SERIES CARDS COMPONENT ===== */
.series-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 60px;
}

.series-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    user-select: none;
}

.series-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    transform: translateY(-3px);
    border-color: #5eb3f5;
}

.series-image {
    width: 100%;
    height: 240px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-bottom: 1px solid #e1e5e9;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.series-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.series-card:hover .series-image img {
    transform: scale(1.05);
}

.series-image-placeholder {
    font-size: 48px;
    color: rgba(255,255,255,0.8);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.series-content {
    padding: 30px;
    position: relative;
    cursor: pointer;
}

.series-title {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.series-title .foreign,
.series-foreign-title {
    color: #5eb3f5;
    font-size: 22px;
    font-weight: bold;
    display: block;
    line-height: 1.2;
    margin-bottom: 5px;
    order: 1;
}

.series-title .english,
.series-english-title {
    color: #666;
    font-size: 16px;
    font-weight: 500;
    display: block;
    line-height: 1.3;
    order: 2;
}

.series-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.series-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
}

.series-difficulty {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.series-difficulty.beginner {
    background: #e8f5e8;
    color: #2e7d2e;
}

.series-difficulty.intermediate {
    background: #fff3cd;
    color: #856404;
}

.series-difficulty.advanced {
    background: #f8d7da;
    color: #721c24;
}

.series-episode-count {
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 8px;
    border-radius: 8px;
    font-weight: 600;
}

/* Episode Preview Section Within Series Cards */
.series-episodes-preview {
    margin-top: 15px;
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
    cursor: auto;
}

.episodes-preview-header {
    font-size: 12px;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.mini-episode-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-episode-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    background: #f8f9fa;
    position: relative;
    z-index: 10;
}

.mini-episode-item:hover {
    background: #f0f6ff;
    transform: translateX(2px);
}

.mini-episode-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e1e5e9;
}

.mini-episode-thumbnail img {
    width: 40px !important;
    height: 40px !important;
    object-fit: cover !important;
    display: block !important;
    max-width: 40px !important;
    max-height: 40px !important;
    border-radius: 3px !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

.mini-episode-placeholder {
    font-size: 16px;
    color: rgba(255,255,255,0.8);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.mini-episode-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.mini-episode-title {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.mini-episode-title .english {
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

.mini-episode-title .foreign {
    color: #5eb3f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    margin-left: 12px;
}

.mini-episode-description {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.view-all-episodes {
    margin-top: 10px;
    text-align: left;
}

.view-all-episodes-text {
    color: #5eb3f5 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    z-index: 10;
    position: relative;
}

.view-all-episodes-text:hover {
    text-decoration: underline !important;
    color: #5eb3f5 !important;
}

/* ===== CLEAN SERIES CARDS - ENGLISH TITLES ONLY ===== */
.series-english-only-title {
    color: #333;
    font-size: 22px;
    font-weight: bold;
    display: block;
    line-height: 1.2;
    margin-bottom: 12px;
}

.mini-episode-title-english {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== MOBILE RESPONSIVE STYLES ===== */
@media (max-width: 768px) {
    .episodes-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 40px;
    }
    
    .episodes-grid.large,
    .episodes-grid.small {
        grid-template-columns: 1fr;
    }
    
    .lesson-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 40px;
    }
    
    .episode-image {
        height: 210px; /* Increased more for mobile */
    }
    
    .episode-image.large {
        height: 230px; /* Increased more for mobile large */
    }
    
    .episode-content {
        padding: 14px;
        min-height: 140px; /* Increased mobile height */
    }
    
    .episode-content.large {
        padding: 16px;
        min-height: 160px; /* Increased mobile large height */
    }
    
    .episode-title .foreign,
    .episode-title .russian {
        font-size: 16px;
    }
    
    .episode-title .english {
        font-size: 13px;
    }
    
    .episode-description {
        font-size: 12px;
        margin-bottom: 12px;
        padding-bottom: 40px; /* Space for difficulty badge on mobile */
    }
    
    .episode-meta {
        bottom: 14px;
        left: 14px;
        right: 14px;
    }
    
    .episode-meta.large {
        bottom: 16px;
        left: 16px;
        right: 16px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        margin-bottom: 20px;
    }
    
    .empty-state {
        padding: 40px 15px;
    }
    
    .empty-state h3 {
        font-size: 16px;
    }
    
    .empty-state p {
        font-size: 13px;
    }

    .empty-state-help {
        margin-top: 15px;
        padding: 12px;
        font-size: 12px;
    }

    /* ===== MOBILE SERIES CARDS - HIDE RUSSIAN TITLES ===== */
    .series-grid .series-card .series-content {
        padding: 20px;
    }
    
    /* Hide foreign/Russian titles completely on mobile */
    body .series-grid .series-card .series-content .series-title .foreign,
    body .series-grid .series-card .series-content .series-title .russian,
    body .series-title .foreign,
    body .series-title .russian,
    body .series-foreign-title {
        display: none !important;
    }
    
    /* Make English titles more prominent on mobile */
    body .series-grid .series-card .series-content .series-title .english,
    body .series-title .english,
    body .series-english-title {
        font-size: 20px !important;
        color: #333 !important;
        font-weight: bold !important;
        display: block !important;
        margin-bottom: 0 !important;
    }

    .mini-episode-list {
        gap: 6px;
    }

    .mini-episode-item {
        padding: 6px;
    }

    .mini-episode-thumbnail {
        width: 35px;
        height: 35px;
    }

    .mini-episode-placeholder {
        font-size: 14px;
    }
}

/* ===== VERY SMALL SCREENS ===== */
@media (max-width: 480px) {
    .episode-image {
        height: 190px; /* Increased more for very small screens */
    }
    
    .episode-content {
        padding: 12px;
        min-height: 130px; /* Increased very small screen height */
    }
    
    .episode-title .foreign,
    .episode-title .russian {
        font-size: 15px;
    }
    
    .episode-title .english {
        font-size: 12px;
    }
    
    .episode-description {
        font-size: 11px;
        margin-bottom: 10px;
        padding-bottom: 35px; /* Space for difficulty badge on very small screens */
    }
    
    .episode-meta {
        bottom: 12px;
        left: 12px;
        right: 12px;
    }
    
    .tag {
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .difficulty {
        font-size: 9px;
        padding: 3px 6px;
    }

    .empty-state-help {
        padding: 10px;
        font-size: 11px;
    }

    /* Very small screens - adjust series titles further */
    .series-title .foreign,
    .series-foreign-title {
        font-size: 16px !important;
    }
    
    .series-title .english,
    .series-english-title {
        font-size: 13px !important;
    }
}