/* 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 */
}

/* ===== 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;
    }
}

/* ===== 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;
    }
}