/* Global Theme & Reset */
:root {
    --primary: #10b981;
    /* Emerald Green */
    --secondary: #3b82f6;
    /* Blue */
    --accent: #f59e0b;
    /* Orange/Gold */
    --purple: #a855f7;
    --pink: #ec4899;
    --dark: #0f172a;
    /* Slate 900 */
    --darker: #020617;
    /* Slate 950 */
    --glass: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--dark);
    color: #fff;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--darker);
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.glass-nav {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
}

/* Animations using Tailwind-compatible classes */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-fade-up {
    animation: fadeUp 0.6s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

/* Staggered Animation Delays */
.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

/* Interactive Elements */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card-hover:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.1);
}

.card-hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.card-hover:hover::after {
    opacity: 1;
}

/* Admin Tables */
.admin-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(30, 41, 59, 0.3);
}

.admin-table th {
    background: rgba(15, 23, 42, 0.8);
    color: var(--primary);
    padding: 1rem;
    text-align: right;
    font-weight: 700;
}

.admin-table td {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
    transition: background 0.2s;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

/* Typography & Section Titles */
.section-title {
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.section-title:hover::after {
    width: 100%;
}

/* Leaderboard Specifics */
.gold-glow {
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
    border-color: rgba(251, 191, 36, 0.5);
}

.silver-glow {
    box-shadow: 0 0 15px rgba(148, 163, 184, 0.3);
    border-color: rgba(148, 163, 184, 0.5);
}

.bronze-glow {
    box-shadow: 0 0 15px rgba(180, 83, 9, 0.3);
    border-color: rgba(180, 83, 9, 0.5);
}

/* Pro Tables (from pro.html) */
.pro-table {
    width: 100%;
    text-align: right;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #334155;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 10px;
}

.pro-table th {
    background: #1e293b;
    padding: 10px;
    color: #fff;
    font-weight: bold;
    border-bottom: 1px solid #334155;
}

.pro-table td {
    padding: 10px;
    border-bottom: 1px solid #334155;
    color: #cbd5e1;
    font-size: 14px;
}

.pro-table tr:last-child td {
    border-bottom: none;
}

/* Dark Mode Variables (Default) */
:root {
    --bg-color: #0f172a;
    --text-color: #ffffff;
    --card-bg: #1e293b;
    --border-color: rgba(255, 255, 255, 0.1);
}

/* Light Mode Variables override */
html.theme-light :root {
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
}

/* Base Body Styles using Variables */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

/* Utility to force specific backgrounds using CSS vars if needed */
.bg-base {
    background-color: var(--bg-color);
}

.bg-card {
    background-color: var(--card-bg);
}

.border-base {
    border-color: var(--border-color);
}

/* Tailwind Light Mode Overrides (Legacy Support & Enforcement) */
/* When in Light Mode, force these styles on specific common dark classes if they aren't using dark: prefix yet */
html.theme-light .bg-gray-900,
html.theme-light .bg-gray-800,
html.theme-light .bg-darker {
    background-color: #ffffff !important;
    color: #1e293b !important;
    border-color: #e2e8f0 !important;
}

html.theme-light .text-white {
    color: #0f172a !important;
}

html.theme-light .text-gray-400 {
    color: #64748b !important;
}

html.theme-light .glass-nav {
    background: rgba(255, 255, 255, 0.9) !important;
    border-bottom: 1px solid #e2e8f0 !important;
}