:root {
    --bg-color: #0b0f19;
    --glass-bg: rgba(20, 25, 40, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #10b981;
    --accent-hover: #059669;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Image */
.background-anim {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/static/bg.jpg?v=2');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    opacity: 0.8;
}

/* Optional subtle overlay to ensure text is readable */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, #0b0f19 100%);
    z-index: -1;
    pointer-events: none;
}

.hidden {
    display: none !important;
}

/* Navbar */
nav {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-logo {
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
}

nav h1 {
    font-weight: 800;
    font-size: 1.5rem;
    background: linear-gradient(to right, #fff, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

nav h1 span {
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.points-badge {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Auth Section */
#auth-section {
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem;
    animation: fadeIn 0.5s ease-out;
}

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

.auth-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: 600;
    transition: color 0.3s;
}

.tab-btn.active {
    color: var(--text-main);
    position: relative;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -17px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* Inputs */
.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group input {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s, background 0.3s;
}

.input-group input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

.input-group label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: 0.3s ease;
    pointer-events: none;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: -10px;
    left: 0.8rem;
    font-size: 0.8rem;
    background: var(--bg-color);
    padding: 0 0.4rem;
    color: var(--primary);
}

.error-msg {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-accent {
    background: var(--accent);
    color: white;
    width: auto;
    padding: 0.6rem 1.2rem;
}
.btn-accent:hover { background: var(--accent-hover); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: auto;
    padding: 0.5rem 1rem;
}
.btn-outline:hover { background: rgba(255,255,255,0.1); }

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    animation: fadeIn 0.5s ease-out;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.matches-container h2, .leaderboard-container h2 {
    font-weight: 600;
}

.leaderboard-container h2 {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.matches-list, .leaderboard-list {
    padding: 1rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* Match Card */
.match-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, background 0.3s;
}

.match-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.match-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.match-status {
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
}
.match-status.live { background: rgba(239, 68, 68, 0.2); color: var(--danger); font-weight: bold; }
.match-status.finished { background: rgba(16, 185, 129, 0.2); color: var(--accent); }

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

.team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 35%;
    text-align: center;
    font-weight: 600;
}

.team img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.score-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 800;
}

.score-input {
    width: 50px;
    height: 50px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    color: white;
    border-radius: 8px;
}
.score-input:focus { border-color: var(--primary); outline: none; }
.score-input:disabled { opacity: 0.7; cursor: not-allowed; background: rgba(0,0,0,0.5); }

/* Leaderboard Item */
.lb-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.lb-item:last-child { border-bottom: none; }

.lb-rank {
    font-weight: 800;
    color: var(--text-muted);
    width: 30px;
}

.lb-user {
    flex: 1;
    font-weight: 600;
}

.lb-points {
    font-weight: 800;
    color: var(--accent);
}

.loader {
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    max-width: 500px;
    width: 90%;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.rules-body p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.rule-card {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid var(--primary);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rule-card:nth-child(2) { border-left-color: var(--accent); }
.rule-card:nth-child(3) { border-left-color: var(--danger); }

.rule-score {
    font-size: 1.2rem;
    font-weight: 800;
    white-space: nowrap;
}

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

.rule-desc strong {
    color: var(--text-main);
    font-size: 1rem;
}

.rule-note {
    background: rgba(16, 185, 129, 0.1);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.3);
    margin-top: 1rem;
}
