/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-glass: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --text-primary: #f0f0f5;
    --text-secondary: #9999aa;
    --text-muted: #666677;
    --accent: #d4a843;
    --accent-hover: #e6be5a;
    --accent-glow: rgba(212, 168, 67, 0.3);
    --accent-subtle: rgba(212, 168, 67, 0.1);
    --danger: #e74c3c;
    --success: #2ecc71;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo h1 {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 4px;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.tab.active {
    color: var(--accent);
    background: var(--accent-subtle);
}

.tab-icon {
    font-size: 16px;
}

/* ===== MAIN ===== */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

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

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 72px;
    margin-bottom: 16px;
    filter: grayscale(0.3);
}

.empty-state h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #c49a35);
    color: #0a0a0f;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-danger {
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.btn-danger:hover {
    background: rgba(231, 76, 60, 0.25);
}

/* ===== MOVIE CARD ===== */
.movie-card {
    display: flex;
    gap: 32px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.movie-poster-wrap {
    position: relative;
    flex-shrink: 0;
}

.movie-poster {
    width: 240px;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: var(--transition);
}

.movie-poster:hover {
    transform: scale(1.02);
}

.movie-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, var(--accent), #c49a35);
    color: #0a0a0f;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.movie-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.movie-title {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

.movie-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.movie-genres {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.genre-tag {
    background: var(--accent-subtle);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.movie-overview {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
    max-height: 120px;
    overflow-y: auto;
}

/* ===== STREAMING PROVIDERS ===== */
.movie-providers {
    margin-top: 4px;
}

.providers-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.providers-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.provider-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.provider-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 72px;
}

.provider-logos {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.provider-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.provider-logo:hover {
    transform: scale(1.15);
    border-color: var(--accent);
}

.provider-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.provider-link:hover {
    text-decoration: underline;
}

/* ===== RATING SECTION ===== */
.rating-section,
.results-section {
    margin-top: 32px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.member-select-wrap {
    margin-bottom: 20px;
}

.member-select-wrap label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.select,
.input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    width: 100%;
    max-width: 320px;
    transition: var(--transition);
    outline: none;
}

.select:focus,
.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.rating-card {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.rating-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Score Picker */
.score-picker {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.score-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

.score-btn.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: #0a0a0f;
    box-shadow: 0 2px 12px var(--accent-glow);
}

/* Prediction Row */
.prediction-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.prediction-name {
    font-weight: 600;
    min-width: 100px;
    font-size: 14px;
}

.prediction-score-picker {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.prediction-score-btn {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.prediction-score-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.prediction-score-btn.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: #0a0a0f;
}

/* ===== RESULTS ===== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.result-card {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: var(--transition);
}

.result-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.result-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.result-score {
    font-size: 32px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.result-predictions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.result-prediction-item {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.result-prediction-item span {
    color: var(--text-secondary);
    font-weight: 600;
}

.result-no-rating {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
}

/* Predictions Toggle in Overview */
.btn-predictions-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-predictions-toggle:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.btn-predictions-toggle.active {
    background: var(--accent);
    border-color: var(--accent);
}

.predictions-expand-row td {
    padding: 0 !important;
    background: var(--bg-secondary) !important;
}

.predictions-expand-content {
    padding: 16px 24px;
    animation: fadeIn 0.2s ease;
}

/* Predictions Table */
.predictions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.predictions-table th,
.predictions-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.predictions-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.predictions-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.diff-badge {
    font-weight: 600;
    font-size: 13px;
}

.diff-badge.exact {
    color: var(--success);
}

.diff-badge.close {
    color: #7bed9f;
}

.diff-badge.ok {
    color: var(--accent);
}

.diff-badge.far {
    color: var(--danger);
}

/* ===== OVERVIEW TABLE ===== */
.page-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
}

.overview-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-glass);
}

.overview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.overview-table th,
.overview-table td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.overview-table th {
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.overview-table td:first-child,
.overview-table th:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

.overview-table tbody tr {
    transition: var(--transition);
}

.overview-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.overview-table .avg-cell {
    color: var(--accent);
    font-weight: 700;
}

.overview-table .movie-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}

.overview-table .movie-cell img {
    width: 36px;
    height: 54px;
    object-fit: cover;
    border-radius: 4px;
}

.overview-table .movie-cell .movie-cell-title {
    font-weight: 600;
    color: var(--text-primary);
}

.overview-table .movie-cell .movie-cell-date {
    font-size: 12px;
    color: var(--text-muted);
}

.score-cell {
    font-weight: 600;
}

.score-cell.high {
    color: var(--success);
}

.score-cell.mid {
    color: var(--accent);
}

.score-cell.low {
    color: var(--danger);
}

/* ===== SELECTED-BY SECTION (Modal) ===== */
.selected-by-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.selected-by-section label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.selected-by-section .select {
    max-width: 100%;
    margin-bottom: 16px;
}

.selected-preview-item {
    cursor: default;
    margin-bottom: 16px;
}

.selected-preview-item:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.meta-tag-accent {
    background: var(--accent-subtle);
    border-color: rgba(212, 168, 67, 0.25);
    color: var(--accent);
    font-weight: 600;
}

.movie-cell-selected-by {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.search-input-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.search-input-wrap .input {
    max-width: none;
    flex: 1;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-result-item {
    display: flex;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.search-result-item img {
    width: 60px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
}

.search-result-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.search-result-info .search-year {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.search-result-info p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow);
    z-index: 300;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-color: var(--success);
    color: var(--success);
}

.toast.error {
    border-color: var(--danger);
    color: var(--danger);
}

/* ===== HELPERS ===== */
.text-muted {
    color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 8px;
    }

    .tabs {
        width: 100%;
        overflow-x: auto;
    }

    .tab {
        font-size: 13px;
        padding: 6px 12px;
        white-space: nowrap;
    }

    .main {
        padding: 20px 16px;
    }

    .movie-card {
        flex-direction: column;
        padding: 16px;
    }

    .movie-poster {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .movie-title {
        font-size: 22px;
    }

    .score-picker {
        gap: 4px;
    }

    .score-btn {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .prediction-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .overview-table th,
    .overview-table td {
        padding: 8px 10px;
    }
}