:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --accent-color: #ffd700; /* Cinematic Gold */
    --border-color: #333;
    --white: #fff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
}

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

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--white);
}

header p {
    color: var(--text-muted);
}
header p a {
    color: var(--accent-color);
    text-decoration: none;
}

header p a:hover {
    text-decoration: underline;
}


.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--accent-color);
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom: 3px solid var(--accent-color);
}

.tab-content {
    display: none;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    table-layout: fixed; /* Fixed layout to stabilize columns */
}

th, td {
    text-align: left;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top; /* Ensure content stays at top */
}

th {
    background-color: #252525;
    color: var(--accent-color);
    font-weight: 600;
    position: sticky;
    top: 0;
}

tr:hover {
    background-color: #2a2a2a;
}

.loading {
    text-align: center;
    padding: 40px;
    font-style: italic;
    color: var(--text-muted);
}

/* Pickers Toggle Styles */
.picker-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.picker-toggle {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 5px;
}

.picker-toggle:hover {
    text-decoration: underline;
}

.pickers-list {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
    transition: max-height 0.3s ease-out;
}

.pickers-list.hidden {
    display: none;
}

footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
}

footer a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* Desktop Column Widths */
@media (min-width: 769px) {
    /* Movies Table (5 cols) */
    #movies-table th:nth-child(1) { width: 50px; }  /* Rank */
    #movies-table th:nth-child(2) { width: 30%; }   /* Title */
    #movies-table th:nth-child(3) { width: 25%; }   /* Director */
    #movies-table th:nth-child(4) { width: 80px; }  /* Count */

    /* Directors Table (4 cols) */
    #directors-table th:nth-child(1) { width: 50px; }  /* Rank */
    #directors-table th:nth-child(2) { width: 25%; }   /* Name */
    #directors-table th:nth-child(3) { width: 100px; } /* Total Picks */

    /* Pickers Table (4 cols) */
    #pickers-table th:nth-child(1) { width: 50px; }   /* Rank */
    #pickers-table th:nth-child(2) { width: 25%; }    /* Name */
    #pickers-table th:nth-child(3) { width: 100px; }  /* Score */
}

/* Responsive Mobile Card View */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    thead {
        display: none;
    }

    table, tbody, tr, td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    tr {
        margin-bottom: 15px;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 15px;
        box-shadow: var(--shadow);
        position: relative;
        padding-top: 45px; /* Space for Rank/Count badges */
    }

    td {
        padding: 5px 0;
        border: none;
        text-align: left;
    }

    /* === Movies Table Mobile Styles === */

    /* Rank */
    #movies-table td:nth-child(1) {
        position: absolute;
        top: 15px;
        left: 15px;
        font-weight: bold;
        color: var(--bg-color); /* Dark text on gold badge */
        background: var(--accent-color);
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.8rem;
    }

    /* Title */
    #movies-table td:nth-child(2) {
        font-size: 1.3rem;
        font-weight: 700;
        color: var(--white);
        line-height: 1.2;
        margin-bottom: 5px;
    }

    /* Director */
    #movies-table td:nth-child(3) {
        font-size: 1rem;
        color: var(--text-muted);
        margin-bottom: 10px;
    }

    /* Count */
    #movies-table td:nth-child(4) {
        position: absolute;
        top: 15px;
        right: 15px;
        background: #333;
        color: var(--white);
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.8rem;
        font-weight: bold;
    }
    #movies-table td:nth-child(4)::after {
        content: " Picks";
        font-weight: normal;
        font-size: 0.9em;
        opacity: 0.8;
    }

    /* Picked By */
    #movies-table td:nth-child(5) {
        border-top: 1px solid var(--border-color);
        margin-top: 10px;
        padding-top: 10px;
    }

    /* === Directors Table Mobile Styles === */

    /* Rank */
    #directors-table td:nth-child(1) {
        position: absolute;
        top: 15px;
        left: 15px;
        font-weight: bold;
        color: var(--bg-color);
        background: var(--accent-color);
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.8rem;
    }

    /* Director Name */
    #directors-table td:nth-child(2) {
        font-size: 1.3rem;
        font-weight: 700;
        color: var(--white);
        line-height: 1.2;
        margin-bottom: 10px;
    }

    /* Total Picks */
    #directors-table td:nth-child(3) {
        position: absolute;
        top: 15px;
        right: 15px;
        background: #333;
        color: var(--white);
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.8rem;
        font-weight: bold;
    }
    #directors-table td:nth-child(3)::after {
        content: " Picks";
        font-weight: normal;
        font-size: 0.9em;
        opacity: 0.8;
    }

    /* Top Movies */
    #directors-table td:nth-child(4) {
        border-top: 1px solid var(--border-color);
        margin-top: 10px;
        padding-top: 10px;
        color: var(--text-muted);
        font-size: 0.9rem;
    }
    #directors-table td:nth-child(4)::before {
        content: "Top Movies: ";
        font-weight: bold;
        color: var(--text-color);
    }
}

/* Picker Tab Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    padding: 10px;
    background: #252525;
    border-radius: 8px;
}

.controls label {
    font-weight: bold;
    color: var(--text-muted);
}

.toggle-group {
    display: flex;
    background: #1e1e1e;
    border-radius: 20px;
    padding: 2px;
    border: 1px solid var(--border-color);
}

.toggle-group input[type="radio"] {
    display: none;
}

.toggle-group label {
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 18px;
    transition: all 0.2s ease;
    color: var(--text-muted);
    font-weight: 500;
}

.toggle-group input[type="radio"]:checked + label {
    background: var(--accent-color);
    color: var(--bg-color);
    font-weight: bold;
}

/* === Pickers Table Mobile Styles === */
@media (max-width: 768px) {
    /* Rank */
    #pickers-table td:nth-child(1) {
        position: absolute;
        top: 15px;
        left: 15px;
        font-weight: bold;
        color: var(--bg-color);
        background: var(--accent-color);
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.8rem;
    }

    /* Picker Name */
    #pickers-table td:nth-child(2) {
        font-size: 1.3rem;
        font-weight: 700;
        color: var(--white);
        line-height: 1.2;
        margin-bottom: 5px;
        padding-top: 10px; /* Space from top */
        padding-right: 90px; /* Prevent overlap with score badge */
    }

    /* Score (Badge top-right) */
    #pickers-table td:nth-child(3) {
        position: absolute;
        top: 15px;
        right: 15px;
        background: #333;
        color: var(--white);
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.8rem;
        font-weight: bold;
    }
    #pickers-table td:nth-child(3)::before {
        content: "Score: ";
        font-weight: normal;
        opacity: 0.8;
    }

    /* Picks Count (Toggle Button) */
    #pickers-table td:nth-child(4) {
        /* Standard flow */
        margin-top: 5px;
        padding-top: 5px;
    }
    /* Removed ::after content to avoid "Picks Picks" */
}
