/* World Cup 2026 Predictions - Styles */

/* Auth Gate */
.auth-gate-box {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-gate-box h2 { margin: 0 0 0.5rem; color: #1a5f7a; }
.auth-gate-box p { color: #555; margin-bottom: 1.25rem; }
.auth-gate-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
    text-align: center;
    letter-spacing: 0.1em;
}
.auth-gate-box input:focus { outline: none; border-color: #1a5f7a; }
.auth-gate-box button {
    width: 100%;
    padding: 0.75rem;
    background: #1a5f7a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

/* Expandable prediction detail rows */
.leaderboard-row:hover { background: #f0f7fa; }
.expand-btn {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.2rem 0.6rem;
    background: #1a5f7a;
    color: white;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
}
.leaderboard-hint {
    font-size: 0.9rem;
    color: #666;
    margin: 0.25rem 0 1rem;
    padding: 0.6rem 1rem;
    background: #eef6fa;
    border-left: 3px solid #1a5f7a;
    border-radius: 4px;
}
.detail-row td.detail-cell { padding: 0; background: #f8fafc; border-top: none; }
.detail-inner { width: 100%; border-collapse: collapse; font-size: 0.85rem; table-layout: fixed; }
.detail-inner th { background: #1a5f7a; color: white; padding: 0.4rem 0.75rem; text-align: left; }
.detail-groups th:nth-child(1) { width: 22%; }
.detail-groups th:nth-child(2) { width: 39%; }
.detail-groups th:nth-child(3) { width: 39%; }
.detail-groups td:not(:first-child) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-summary th:nth-child(1) { width: 45%; }
.detail-summary th:nth-child(2) { width: 55%; }
.detail-groups { margin-top: 0; border-top: 2px solid #1a5f7a; }
.detail-inner td { padding: 0.35rem 0.75rem; border-bottom: 1px solid #e8edf2; color: #444; text-align: left; vertical-align: middle; }
.detail-inner td:first-child { font-weight: 600; color: #1a5f7a; }
.detail-inner tr:last-child td { border-bottom: none; }
.pick-label {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    vertical-align: middle;
    margin-right: 2px;
}
.win-label { background: #1a5f7a; color: white; }
.ru-label { background: #718096; color: white; }

:root {
    --primary-color: #1a5f7a;
    --secondary-color: #159895;
    --accent-color: #57c5b6;
    --gold: #ffd700;
    --silver: #c0c0c0;
    --bronze: #cd7f32;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #b8dba0;
    position: relative;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.5;
    background-image:
        url('img-pitch.svg'),
        url('img-goal.svg'),
        url('img-ball.svg'),
        url('img-trophy.svg'),
        url('img-boot.svg'),
        url('img-medal.svg'),
        url('img-flag.svg'),
        url('img-ball.svg'),
        url('img-trophy.svg'),
        url('img-goal.svg'),
        url('img-ball.svg'),
        url('img-boot.svg'),
        url('img-pitch.svg'),
        url('img-medal.svg'),
        url('img-ball.svg'),
        url('img-trophy.svg'),
        url('img-goal.svg'),
        url('img-flag.svg'),
        url('img-ball.svg'),
        url('img-boot.svg'),
        url('img-pitch.svg'),
        url('img-medal.svg');
    background-size:
        220px 143px,
        160px 110px,
        90px 90px,
        85px 85px,
        90px 90px,
        80px 80px,
        72px 72px,
        78px 78px,
        82px 82px,
        150px 103px,
        84px 84px,
        86px 86px,
        200px 130px,
        76px 76px,
        80px 80px,
        88px 88px,
        155px 106px,
        70px 70px,
        75px 75px,
        82px 82px,
        190px 124px,
        74px 74px;
    background-repeat: no-repeat;
    background-position:
        -10px 1%,
        72% 0%,
        90% 12%,
        0% 10%,
        88% 22%,
        44% 7%,
        2% 32%,
        91% 35%,
        46% 26%,
        -8px 52%,
        88% 50%,
        2% 62%,
        68% 44%,
        48% 58%,
        91% 65%,
        3% 76%,
        58% 70%,
        87% 80%,
        18% 88%,
        44% 85%,
        -8px 90%,
        73% 93%;
    z-index: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 16px;
    color: white;
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

/* Navigation */
nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

nav a {
    padding: 10px 20px;
    color: white;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
}

nav a:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

nav a.active {
    background: white;
    color: var(--primary-color);
}

/* Form Sections */
.form-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.form-section h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--accent-color);
}

.form-section h3 {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
    margin-top: 20px;
}

/* Form Layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.form-row.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(21, 152, 149, 0.1);
}

.form-group small {
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Points Info */
.points-info {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.points-tag {
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Group Sections */
.group-section {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
}

.group-section h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-weight: 700;
}

/* Submit Section */
.submit-section {
    text-align: center;
    padding: 20px;
}

.submit-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 16px 50px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.admin-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.max-points {
    margin-top: 15px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.warning-text {
    color: #e74c3c;
    font-weight: 600;
    margin-top: 10px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    margin: -20px -20px 0 0;
}

.close:hover {
    color: var(--text-primary);
}

.btn {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.btn:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

/* Leaderboard Styles */
.results-section {
    margin-bottom: 30px;
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.results-section h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.result-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.result-card.winner {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
}

.result-card.runner-up {
    background: linear-gradient(135deg, #c0c0c0, #e0e0e0);
    color: #333;
}

.result-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.result-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.group-results {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.group-results h4 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.group-result {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 10px;
}

.group-result strong {
    display: block;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.group-result span {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Leaderboard Table */
.leaderboard-section {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.leaderboard-section h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.leaderboard-controls {
    margin-bottom: 20px;
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table th {
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.leaderboard-table td.rank {
    font-weight: 700;
    font-size: 1.1rem;
}

.leaderboard-table td.score {
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.leaderboard-table tr.top-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), transparent);
}

.leaderboard-table tr.top-2 {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.1), transparent);
}

.leaderboard-table tr.top-3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.1), transparent);
}

.leaderboard-table tr:hover {
    background-color: var(--bg-color);
}

/* Scoring Info */
.scoring-info {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.scoring-info h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.scoring-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.score-item {
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    padding: 15px;
    border-radius: 10px;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.score-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.max-total {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Admin Notice */
.admin-notice {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px solid #ffc107;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: center;
}

/* No Results */
.no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-style: italic;
}

.loading,
.empty,
.error {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

.error {
    color: #e74c3c;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-row.three-col {
        grid-template-columns: 1fr;
    }
    
    .form-section {
        padding: 20px;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 6px;
        font-size: 0.85rem;
    }
    /* Hide less important columns on tablet */
    .leaderboard-table th:nth-child(5),
    .leaderboard-table td:nth-child(5) {
        display: none;
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .groups-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 5px;
        font-size: 0.8rem;
    }
    /* Also hide Max Possible on small phones */
    .leaderboard-table th:nth-child(4),
    .leaderboard-table td:nth-child(4) {
        display: none;
    }
    .expand-btn {
        display: block;
        margin: 4px 0 0 0;
        font-size: 0.68rem;
    }
    .leaderboard-table td.name {
        max-width: 130px;
        word-break: break-word;
    }

    header h1 {
        font-size: 1.5rem;
    }
    
    nav a {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .groups-grid {
        grid-template-columns: 1fr;
    }
}
