:root {
    /* Colors */
    --bg-dark: #0a0a12;
    --bg-panel: #151520;
    --bg-input: #1e1e2a;

    --primary: #c8aa6e;
    --primary-hover: #f0e6d2;

    --accent-blue: #00b4d8;
    --accent-red: #ff4d4d;
    --accent-green: #00e676;

    --text-main: #ffffff;
    --text-muted: #a0a0b0;

    /* Typography - Scaled for readability */
    --font-heading: 'Rajdhani', sans-serif;
    --font-body: 'Outfit', sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Borders */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;

    --border-color: #2a2a35;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    /* Remove tap highlight on mobile */
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0;
    background-color: var(--bg-dark);
    /* Use dark bg directly */
    min-height: 100vh;
}

/* --- Mobile First Layout (Default) --- */

/* Sidebar is hidden by default (slide-in menu) */
.desktop-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transform: translateX(-100%);
    /* Hidden off-screen */
    transition: transform 0.3s ease-in-out;
    display: flex;
    /* Always display flex inside to layout content */
    flex-direction: column;
    padding: var(--spacing-md);
}

.desktop-sidebar.active {
    transform: translateX(0);
    /* Slide in */
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
}

/* Overlay for mobile sidebar */
#mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 900;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#mobile-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.main-content {
    flex: 1;
    width: 100%;
    padding: var(--spacing-sm);
    /* Smaller padding on mobile */
    overflow-x: hidden;
}

/* Utility to hide elements on mobile if needed */
.desktop-only {
    display: none !important;
}

.mobile-only {
    display: block !important;
}

/* Mobile Header Bar */
.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 800;
}

/* --- Tablet / Desktop Breakpoint --- */
@media (min-width: 768px) {
    #app {
        flex-direction: row;
        /* Sidebar | Content */
    }

    .desktop-sidebar {
        position: sticky;
        /* Sticky sidebar */
        transform: none;
        /* Always visible */
        z-index: 1;
        /* Lower z-index than modals */
        box-shadow: none;
    }

    .main-content {
        padding: var(--spacing-lg);
        /* Larger padding */
    }

    .mobile-header {
        display: none;
        /* Hide top bar on desktop */
    }

    .desktop-only {
        display: block !important;
    }

    .mobile-only {
        display: none !important;
    }

    #mobile-sidebar-overlay {
        display: none !important;
        /* Never show overlay on desktop */
    }
}

/* Typography Scale */
h1 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

@media (min-width: 768px) {
    h1 {
        font-size: 2.25rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    h3 {
        font-size: 1.5rem;
    }
}

p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #a08040 100%);
    color: #000;
    box-shadow: 0 4px 15px rgba(200, 170, 110, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200, 170, 110, 0.5);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: rgba(200, 170, 110, 0.1);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-success {
    background: var(--accent-green);
    color: #000;
}

/* Forms */
.form-group {
    margin-bottom: var(--spacing-md);
}

label {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--text-muted);
    font-size: 0.9rem;
}

input,
select {
    width: 100%;
    padding: 1rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-container {
    animation: fadeIn 0.3s ease-out;
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

@media (min-width: 768px) {
    .view-container {
        flex-direction: row;
    }

    .view-container .desktop-main-content {
        flex: 1;
        max-width: calc(100% - 280px);
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--bg-panel);
    width: 90%;
    max-width: 400px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.95);
    animation: scaleIn 0.2s ease-out forwards;
}

@keyframes scaleIn {
    to {
        transform: scale(1);
    }
}

.modal-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.modal-header.error h3 {
    color: var(--accent-red);
}

.modal-header.success h3 {
    color: var(--accent-green);
}

.modal-header.warning h3 {
    color: var(--primary);
}

.modal-body {
    padding: var(--spacing-md);
    color: var(--text-muted);
}

.modal-footer {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

/* Dashboard specific styles moved from dashboard.js */
.profile-section {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.avatar-circle {
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: black;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    margin-right: 1rem;
}

.profile-info h3 {
    margin: 0;
    font-size: 1.2rem;
}

.region-badge {
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}

.section-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    margin-top: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.mode-cards {
    display: grid;
    gap: var(--spacing-md);
    /* Mobile: 1 column */
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .mode-cards {
        /* Desktop: 3 columns or auto-fit */
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .profile-section {
        /* Make profile section more prominent on desktop */
        padding: 1.5rem;
    }
}

.card {
    background: var(--bg-input);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.active-challenge-card {
    border: 1px solid var(--accent-green);
    background: linear-gradient(to right, rgba(0, 230, 118, 0.05), var(--bg-input));
}

.card.highlight-border {
    border: 1px solid var(--primary);
}

.card .price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: var(--spacing-sm) 0;
}

.card ul {
    list-style: none;
    padding: 0;
    margin-bottom: var(--spacing-md);
    flex-grow: 1;
    /* Ensure buttons align at bottom */
}

.card ul li {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.card ul li::before {
    content: "•";
    color: var(--primary);
    margin-right: 0.5rem;
}



/* --- New Dashboard Design 2.0 --- */

.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
}

.user-welcome {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.avatar-large {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), #8a7030);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(200, 170, 110, 0.3);
}

.welcome-text {
    font-size: 1.5rem;
    margin: 0;
    line-height: 1.2;
}

.highlight-text {
    color: var(--primary);
}

.region-tag {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

.stat-card {
    padding: var(--spacing-sm);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-heading);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.text-green {
    color: var(--accent-green);
}

.text-red {
    color: var(--accent-red);
}

.text-gold {
    color: var(--primary);
}

.active-challenge-section h3 {
    margin-bottom: var(--spacing-sm);
}

.challenge-card {
    padding: var(--spacing-md);
    position: relative;
    overflow: hidden;
}

.challenge-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--spacing-sm);
}

.challenge-progress-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-main);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent-green));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.modes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
}

@media (min-width: 768px) {
    .modes-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.mode-card {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.mode-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.mode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.mode-header h4 {
    margin: 0;
}

.mode-features {
    list-style: none;
    padding: 0;
    margin-bottom: var(--spacing-md);
    flex-grow: 1;
}

.mode-features li {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    padding-left: 1.2rem;
    position: relative;
}

.mode-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary);
}

.special-offer {
    border: 1px solid var(--primary);
    background: linear-gradient(135deg, rgba(200, 170, 110, 0.1), transparent);
    position: relative;
}

.badge-offer {
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--primary);
    color: black;
    font-weight: bold;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-icon {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-muted);
    padding: 0;
}

.full-width {
    width: 100%;
}

/* Report Payment Card Design */
.report-payment-section {
    margin-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    padding-top: var(--spacing-md);
}

.report-payment-card {
    background: linear-gradient(135deg, rgba(200, 170, 110, 0.1), rgba(0, 0, 0, 0.4));
    border: 1px dashed var(--primary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.report-payment-card:hover {
    background: linear-gradient(135deg, rgba(200, 170, 110, 0.2), rgba(0, 0, 0, 0.5));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(200, 170, 110, 0.15);
    border-style: solid;
}

.report-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.report-icon {
    width: 45px;
    height: 45px;
    background: rgba(200, 170, 110, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.5rem;
}

.report-text h4 {
    color: var(--primary);
    margin: 0;
    font-size: 1.1rem;
}

.report-text p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.report-arrow {
    color: var(--primary);
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.report-payment-card:hover .report-arrow {
    transform: translateX(5px);
}

/* Mobile Admin Tables */
@media (max-width: 768px) {
    .card {
        padding: 1rem !important;
    }

    /* Force tables to scroll */
    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
        /* Force width to trigger scroll if needed */
    }

    /* Better touch targets */
    .btn,
    .btn-icon {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Chat Input Styles - Support Page */
.chat-message-input,
#message-input {
    padding: 16px 20px !important;
    font-size: 16px !important;
    height: 56px !important;
    background-color: #0d0d14 !important;
    color: #ffffff !important;
    border: 2px solid #c8aa6e !important;
    border-radius: 12px !important;
    font-family: var(--font-body) !important;
    outline: none !important;
}

.chat-message-input::placeholder,
#message-input::placeholder {
    color: #888 !important;
    opacity: 1 !important;
}

.chat-message-input:focus,
#message-input:focus {
    border-color: #f0e6d2 !important;
    box-shadow: 0 0 10px rgba(200, 170, 110, 0.3) !important;
}

.chat-input-wrapper {
    padding: 1.5rem !important;
    background: #1a1a25 !important;
    border-top: 2px solid #c8aa6e !important;
}

/* Tournament Bracket */
.bracket-container {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0;
}
.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 220px;
}
.bracket-match {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}
.bracket-match:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}
.bracket-match .team {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
}
.bracket-match .team.winner {
    background: rgba(0, 184, 148, 0.15);
    color: var(--accent-green);
    font-weight: bold;
}
.bracket-match .team.loser {
    opacity: 0.5;
}
.bracket-match .vs {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.25rem;
}

/* Timers */
.countdown-timer {
    font-family: monospace;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6b35;
}
.countdown-expired {
    color: #ff4757;
}

/* Prize Progress Bar */
.prize-card {
    background: linear-gradient(135deg, rgba(253, 203, 110, 0.1), transparent);
    border: 1px solid rgba(253, 203, 110, 0.3);
    border-radius: 16px;
    padding: 1.5rem;
}
.prize-card .progress-container {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    position: relative;
    margin: 1rem 0;
}
.prize-card .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #fdcb6e, #e17055);
    border-radius: 10px;
    transition: width 0.5s ease;
}
.prize-card .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Admin Notifications Badge */
.admin-notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-red);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

/* Form Styles */
.form-control {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: border-color 0.3s;
}
.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(200, 170, 110, 0.2);
}
select.form-control {
    appearance: auto;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #555;
    transition: 0.3s;
    border-radius: 28px;
}
.toggle-slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-green);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Match Card */
.match-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s;
}
.match-card:hover {
    border-color: var(--primary);
}
.match-card .match-code {
    font-family: monospace;
    font-size: 1.3rem;
    color: var(--primary);
    background: rgba(200, 170, 110, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-block;
    letter-spacing: 2px;
}
.match-card .opponent-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
}

/* Snackbar / Toast */
.snackbar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-panel);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}
.empty-state h3 {
    color: white;
    margin-bottom: 0.5rem;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}