/* ==========================================================================
   1. CORE RESET & BASE
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    line-height: 1.6;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

header h1 {
    font-size: 1.6rem;
    color: #ff9800;
}

#homeButton {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

/* ==========================================================================
   2. FILTERS & CONTAINERS
   ========================================================================== */
.group-selector {
    background: #1e1e1e;
    padding: 20px;
    margin: 0 auto 25px;
    max-width: 1200px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

select {
    background: #252525;
    color: #fff;
    border: 1px solid #444;
    padding: 8px;
    border-radius: 6px;
}

/* ==========================================================================
   3. STICKY GRID LOGIC
   ========================================================================== */

.table-scroll-wrapper {
    width: 100%;
    max-height: 75vh; /* Enables vertical scroll */
    overflow: auto; 
    border-radius: 12px;
    background: #1e1e1e;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 1px solid #333;
}

.movie-watchers-table {
    width: 100%;
    border-collapse: separate; /* Required for sticky borders */
    border-spacing: 0;
    min-width: 800px;
}

/* Sticky Top Row (Users) */
.movie-watchers-table th {
    position: sticky;
    top: 0;
    background-color: #2196f3;
    color: white;
    font-weight: 600;
    padding: 15px;
    z-index: 10;
    border-bottom: 2px solid #1976d2;
}

/* Sticky First Column (Titles) */
.movie-title-cell {
    position: sticky;
    left: 0;
    background-color: #252525 !important;
    color: #fff;
    font-weight: 600;
    text-align: left !important;
    z-index: 5;
    border-right: 2px solid #444 !important;
    min-width: 220px;
}

/* Top-Left Corner Cell Fix */
.movie-watchers-table th:first-child {
    left: 0;
    z-index: 20;
    background-color: #1976d2;
}

/* Cell Borders */
.movie-watchers-table td {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #333;
    border-right: 1px solid #333;
}

/* ==========================================================================
   4. RATING CLASSES
   ========================================================================== */
.rating-dark-grey { background-color: #4a4a4a; color: white; }
.rating-dark-red { background-color: #8b0000; color: white; }
.rating-light-red { background-color: #d32f2f; color: white; }
.rating-yellow { background-color: #fbc02d; color: #000; }
.rating-light-green { background-color: #4caf50; color: white; }
.rating-dark-green { background-color: #1b5e20; color: white; }
.not-rated-cell { background-color: #1e1e1e; color: #444; }

/* ==========================================================================
   5. UTILS
   ========================================================================== */
.message, .error { text-align: center; padding: 40px; color: #888; font-style: italic; }

@media (max-width: 600px) {
    .group-selector { flex-direction: column; gap: 10px; }
}
