/* ===== CSS Variables ===== */
:root, [data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #a0aec0;
    --sidebar-active: #3b82f6;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 15px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --sidebar-bg: #0c1222;
    --sidebar-text: #94a3b8;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 15px rgba(0,0,0,0.3);
}

/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    transition: background 0.3s, color 0.3s;
}

a { text-decoration: none; color: inherit; }

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: white;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.theme-toggle {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.theme-toggle:hover { background: rgba(255,255,255,0.2); }

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section-title {
    display: block;
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.7rem 1.25rem;
    color: var(--sidebar-text);
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border-left-color: #3b82f6;
    font-weight: 600;
}

.nav-link i { width: 20px; text-align: center; font-size: 1rem; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
}

.user-details { display: flex; flex-direction: column; }
.user-name { color: #fff; font-weight: 600; font-size: 0.85rem; }
.user-role { font-size: 0.75rem; color: rgba(255,255,255,0.5); }

.logout-link { color: rgba(255,255,255,0.6) !important; }
.logout-link:hover { color: #ef4444 !important; }

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    transition: margin 0.3s;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

.topbar-right { font-size: 0.85rem; color: var(--text-secondary); }

.content-wrapper {
    padding: 1.5rem;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}

.stat-info h3 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.stat-icon.green { background: rgba(16,185,129,0.1); color: #10b981; }
.stat-icon.purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.stat-icon.yellow { background: rgba(245,158,11,0.1); color: #f59e0b; }

/* ===== Games Grid ===== */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem;
    transition: all 0.3s;
}

.game-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}

.game-league {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.league-name {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.game-time {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.game-status {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.game-status.live { background: rgba(16,185,129,0.15); color: #10b981; }
.game-status.waiting { background: rgba(245,158,11,0.15); color: #f59e0b; }
.game-status.ended { background: rgba(239,68,68,0.15); color: #ef4444; }

.game-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.game-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    text-align: center;
}

.team-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
}

.team-name {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.game-vs {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    background: var(--bg-primary);
    border-radius: 8px;
}

.game-channels {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.channel-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    background: rgba(59,130,246,0.1);
    color: var(--accent);
    border-radius: 6px;
    font-weight: 600;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.btn-primary:hover { background: linear-gradient(135deg, #2563eb, #1d4ed8); transform: translateY(-1px); }

.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.btn-success:hover { transform: translateY(-1px); }

.btn-warning { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.btn-warning:hover { transform: translateY(-1px); }

.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.btn-danger:hover { transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

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

.btn-lg { padding: 0.8rem 1.75rem; font-size: 0.95rem; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Forms ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.form-select {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.tab {
    flex: 1;
    padding: 0.7rem 1rem;
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: none;
    transition: all 0.2s;
}

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

/* ===== Preview Box ===== */
.preview-box {
    background: var(--bg-primary);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-box img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
}

/* ===== Activity List ===== */
.activity-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: 10px;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.activity-icon.login { background: rgba(59,130,246,0.1); color: #3b82f6; }
.activity-icon.update { background: rgba(16,185,129,0.1); color: #10b981; }
.activity-icon.banner { background: rgba(139,92,246,0.1); color: #8b5cf6; }

.activity-content h4 { font-size: 0.85rem; font-weight: 600; }
.activity-content p { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* ===== Grid Layouts ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-sidebar { display: grid; grid-template-columns: 1fr 350px; gap: 1.5rem; }

/* ===== Banner Models ===== */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.model-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s;
}

.model-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}

.model-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.model-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-preview {
    width: 100%;
    aspect-ratio: 9/16;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.model-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.model-footer { padding: 1rem; }

/* ===== Alerts ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: rgba(16,185,129,0.1); color: #10b981; border: 1px solid rgba(16,185,129,0.2); }
.alert-error { background: rgba(239,68,68,0.1); color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: rgba(245,158,11,0.1); color: #f59e0b; border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: rgba(59,130,246,0.1); color: #3b82f6; border: 1px solid rgba(59,130,246,0.2); }

/* ===== Subscription Card ===== */
.subscription-card {
    background: linear-gradient(135deg, rgba(16,185,129,0.05), rgba(16,185,129,0.02));
    border: 2px solid rgba(16,185,129,0.2);
    border-radius: 16px;
    padding: 1.5rem;
}

.subscription-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.active { background: rgba(16,185,129,0.15); color: #10b981; }
.status-badge.expired { background: rgba(239,68,68,0.15); color: #ef4444; }

.subscription-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.detail-item label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
}

.detail-item span {
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===== Benefits Grid ===== */
.benefits-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem;
}

.benefit-icon {
    color: var(--success);
    font-size: 1.1rem;
}

.benefit-text h4 { font-size: 0.85rem; font-weight: 600; }
.benefit-text p { font-size: 0.75rem; color: var(--text-secondary); }

/* ===== FAQ ===== */
.faq-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.faq-question {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--bg-primary);
}

.faq-answer {
    padding: 0 1rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: none;
}

.faq-item.open .faq-answer { display: block; }
.faq-item.open .faq-question i { transform: rotate(180deg); }

/* ===== Password Toggle ===== */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
}

/* ===== Info Cards ===== */
.info-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.info-card h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.info-card p, .info-card li {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Sidebar Overlay (Mobile) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .grid-sidebar { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay.open {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .model-grid {
        grid-template-columns: 1fr;
    }
    
    .benefits-grid {
        grid-template-columns: 1fr;
    }
    
    .subscription-details {
        grid-template-columns: 1fr;
    }
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #3b82f6, #60a5fa);
    padding: 1rem;
}

.login-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo .logo-icon {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    margin: 0 auto 0.75rem;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.login-welcome {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 12px;
}

.login-welcome h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.login-welcome p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form .form-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.login-form .input-wrapper {
    position: relative;
}

.login-form .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.login-form .form-control {
    padding-left: 2.5rem;
    background: rgba(59,130,246,0.05);
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--accent);
    font-weight: 600;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); }

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease; }

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s ease;
}

.toast-success { background: #10b981; color: white; }
.toast-error { background: #ef4444; color: white; }
