/* Global Styles */
:root {
    --bg-color: #0d1117;
    --row-bg: #161b22;
    --row-hover: #1c2128;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --accent-color: #58a6ff;
    --border-color: #30363d;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

header {
    background: rgba(13, 17, 23, 0.9);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(90deg, #58a6ff, #a371f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.last-updated {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

main {
    padding: 2rem 0 4rem;
}

section {
    margin-bottom: 2rem;
    /* Reduced for tighter dashboard feel */
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: start;
        gap: 2rem;
    }

    /* Order overrides for desktop to achieve:
       Left Col: Pop Stream (1), New TV (3)
       Right Col: Pop TV (2), Box Office (4)
       
       We can use grid-column-start/end or order property if we treat columns as 1 and 2.
       Actually, since we just have 4 sequential items now:
       1. Pop Stream -> Row 1 Col 1
       2. Pop TV -> Row 1 Col 2
       3. New TV -> Row 2 Col 1
       4. Box Office -> Row 2 Col 2
       
       The default grid auto flow (row) does exactly this:
       Item 1 (Cell 1,1), Item 2 (Cell 1,2), Item 3 (Cell 2,1), Item 4 (Cell 2,2).
       
       Wait, user said:
       Desktop: "Popular Streaming Movies" (Left), "Popular TV" (Right), "New TV this week" (Left), "Top 10 Box office" (Right).
       My current HTML order is:
       1. Pop Streaming
       2. Pop TV
       3. New TV
       4. Box Office
       
       So the default grid behavior (filling rows first) will produce:
       Row 1: 1, 2
       Row 2: 3, 4
       
       This MATCHES the desktop requirement perfectly.
       
       Mobile: Stacks 1, 2, 3, 4 vertically.
       This MATCHES the mobile requirement perfectly (Pop Stream -> Pop TV -> New TV -> Top 10).
       
       So I just need to remove the .column class and ensure dashboard-layout is a simple grid.
    */
}

/* Removed .column class as it's no longer used */

/* ... existing styles ... */

.col-info {
    flex-grow: 1;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    /* Important for text truncation in flex child */
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 90;
    background-color: var(--bg-color);
    /* Ensure text scrolls behind */
    padding-top: 10px;
    /* Add some breathing room when sticky */
}

/* List Layout */
.movie-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}



.movie-row {
    display: flex;
    background-color: var(--row-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, background-color 0.2s ease;
    text-decoration: none;
    /* Reset anchor style */
    color: inherit;
    /* Reset anchor color */
}

.movie-row:hover {
    transform: translateY(-2px);
    background-color: var(--row-hover);
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Columns */
.col-poster {
    width: 140px;
    /* Slightly wider for the badges */
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
}

.poster-wrapper {
    width: 100%;
    aspect-ratio: 2/3;
    background: #000;
    position: relative;
    /* Context for overlay */
}

.poster-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.score-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    /* Fixes width overflow due to padding */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 100%);
    padding: 0.5rem;
    display: flex;
    justify-content: center;
    /* Center the single RT badge */
    align-items: center;
    backdrop-filter: blur(2px);
}

.col-info {
    flex-grow: 1;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    /* Fixes text truncation stretching parent */
}

/* Content Styles */
.row-title {
    font-size: 1.25rem;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta-row {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.release-date {
    font-weight: 600;
    color: var(--accent-color);
    margin-right: 0.5rem;
}

.plot {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #c9d1d9;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hover Expansions */
.movie-row:hover .row-title {
    white-space: normal;
    overflow: visible;
}

.movie-row:hover .meta-row,
.movie-row:hover .plot {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    display: block;
}

/* Scores */
.score-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    /* Extra bold */
    font-size: 1.5rem;
    /* Larger text */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.score-badge.rt {
    color: #fa320a;
}

.score-badge.rt.fresh {
    color: #46d369;
    /* Bright green */
}

.score-label {
    display: none;
    /* Hide label in overlay, just show number */
}

.score-val {
    font-size: 0.9rem;
    font-weight: 700;
}

/* Rank Badge */
/* Rank Badge */
.rank-badge {
    position: absolute;
    top: 0;
    left: 4px;
    background: transparent;
    border: none;
    color: transparent;
    -webkit-text-stroke: 2px #ffffff;
    font-weight: 900;
    font-size: 2.5rem;
    /* Reduced to ~40px */
    font-family: 'Inter', sans-serif;
    line-height: 1;
    z-index: 20;
    text-shadow: none;
    pointer-events: none;
    width: auto;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-secondary);
}

/* Responsive */
/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 0;
        /* Edge to edge for feed items */
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0 1.5rem;
        /* Restore padding for header */
    }

    h1 {
        font-size: 1.5rem;
    }

    /* Category Titles */
    section h2 {
        font-size: 1.25rem;
        padding: 0 1.5rem;
        /* Restore padding for section titles */
    }

    .movie-row {
        flex-direction: column;
        border-radius: 0;
        /* Flatten corners */
        border: none;
        border-bottom: 1px solid var(--border-color);
        /* Separator only */
        margin-bottom: 2rem;
    }

    .col-poster {
        width: 100%;
        height: auto;
        border: none;
        padding: 0;
        background: transparent;
        display: block;
    }

    .poster-wrapper {
        width: 100%;
        max-width: none;
        /* Full width */
        aspect-ratio: 2/3;
        height: auto;
        box-shadow: none;
    }

    .poster-wrapper img {
        object-position: center;
    }

    .col-info {
        padding: 1rem 1.5rem;
        /* Standard mobile padding for text */
    }

    /* Undo truncation on mobile to avoid overflow and show full content */
    .row-title {
        white-space: normal;
        overflow: visible;
    }

    .meta-row,
    .plot {
        white-space: normal;
        -webkit-line-clamp: unset;
        line-clamp: unset;
        display: block;
    }

    /* Adjust rank badge for mobile (full width poster) */
    .rank-badge {
        font-size: 30vw;
        /* ~1/3 of viewport width */
        top: 0;
        left: 1vw;
    }

    /* Disable hover effects on mobile */
    .movie-row:hover {
        transform: none;
        background-color: var(--row-bg);
        border-color: var(--border-color);
        box-shadow: none;
    }
}