/* ============================================================
   SHVOYM BLR Badminton Tournament 2026
   Global Design System — Tokens, Resets, Typography, Utilities
   ============================================================ */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
    /* Color Palette */
    --bg-primary: #06080f;
    --bg-secondary: #0c1022;
    --bg-surface: #111633;
    --bg-surface-hover: #161d42;
    --bg-glass: rgba(17, 22, 51, 0.72);
    --bg-glass-hover: rgba(22, 29, 66, 0.85);

    --accent-blue: #4361ee;
    --accent-blue-hover: #5a7bff;
    --accent-blue-glow: rgba(67, 97, 238, 0.25);
    --accent-gold: #ffd60a;
    --accent-gold-glow: rgba(255, 214, 10, 0.2);
    --accent-coral: #ef476f;
    --accent-coral-glow: rgba(239, 71, 111, 0.2);
    --accent-green: #06d6a0;
    --accent-green-glow: rgba(6, 214, 160, 0.2);
    --accent-purple: #7b2ff7;
    --accent-orange: #fb8500;

    --text-primary: #f0f2ff;
    --text-secondary: #9ba4c4;
    --text-muted: #5c6490;
    --text-inverse: #06080f;

    --border-subtle: rgba(155, 164, 196, 0.1);
    --border-active: rgba(67, 97, 238, 0.4);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow-blue: 0 0 30px var(--accent-blue-glow);
    --shadow-glow-gold: 0 0 30px var(--accent-gold-glow);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-xs: 0.6875rem;   /* 11px */
    --font-sm: 0.8125rem;   /* 13px */
    --font-base: 0.9375rem; /* 15px */
    --font-md: 1.0625rem;   /* 17px */
    --font-lg: 1.25rem;     /* 20px */
    --font-xl: 1.625rem;    /* 26px */
    --font-2xl: 2.125rem;   /* 34px */
    --font-3xl: 2.75rem;    /* 44px */

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* Z-Index Scale */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal-backdrop: 300;
    --z-modal: 400;
    --z-toast: 500;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --max-content-width: 1400px;
}

/* --- CSS Reset --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-base);
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --- Background Gradient Mesh --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 60% 50% at 10% 20%, rgba(67, 97, 238, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 85% 70%, rgba(123, 47, 247, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse 40% 30% at 50% 90%, rgba(239, 71, 111, 0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-blue-hover);
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    border: none;
    outline: none;
    background: none;
}

button {
    cursor: pointer;
}

ul, ol {
    list-style: none;
}

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

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: var(--font-3xl); letter-spacing: -0.02em; }
h2 { font-size: var(--font-2xl); letter-spacing: -0.01em; }
h3 { font-size: var(--font-xl); }
h4 { font-size: var(--font-lg); }
h5 { font-size: var(--font-md); }
h6 { font-size: var(--font-base); font-weight: 600; }

/* --- Glass Card --- */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-weight: 600;
    font-size: var(--font-sm);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::after {
    opacity: 1;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-blue-glow);
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    box-shadow: 0 4px 20px var(--accent-blue-glow);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--accent-green);
    color: var(--text-inverse);
    box-shadow: 0 2px 12px var(--accent-green-glow);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-green-glow);
}

.btn-danger {
    background: var(--accent-coral);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-coral-glow);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-coral-glow);
}

.btn-gold {
    background: var(--accent-gold);
    color: var(--text-inverse);
    box-shadow: 0 2px 12px var(--accent-gold-glow);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-xs);
}

.btn-lg {
    padding: var(--space-5) var(--space-8);
    font-size: var(--font-md);
    border-radius: var(--radius-lg);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* --- Form Controls --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-label {
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input, .form-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-base);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus, .form-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ba4c4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* --- Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-live {
    background: rgba(239, 71, 111, 0.15);
    color: var(--accent-coral);
    animation: pulse-badge 2s ease-in-out infinite;
}

.badge-completed {
    background: rgba(6, 214, 160, 0.15);
    color: var(--accent-green);
}

.badge-pending {
    background: rgba(155, 164, 196, 0.15);
    color: var(--text-secondary);
}

.badge-upcoming {
    background: rgba(67, 97, 238, 0.15);
    color: var(--accent-blue);
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-sm);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    animation: toast-in 0.4s var(--transition-spring);
    max-width: 360px;
}

.toast-success { border-left: 3px solid var(--accent-green); }
.toast-error { border-left: 3px solid var(--accent-coral); }
.toast-info { border-left: 3px solid var(--accent-blue); }
.toast-warning { border-left: 3px solid var(--accent-orange); }

.toast-exit {
    animation: toast-out 0.3s var(--transition-base) forwards;
}

/* --- Modal --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 15, 0.8);
    backdrop-filter: blur(8px);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.2s ease;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modal-in 0.35s var(--transition-spring);
    z-index: var(--z-modal);
}

.modal-header {
    padding: var(--space-6) var(--space-6) var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 0 var(--space-6) var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* --- Loader --- */
.loader {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.loader-sm {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

/* --- Live Pulse Indicator --- */
.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-coral);
    position: relative;
}

.live-dot::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--accent-coral);
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* --- Animations --- */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* --- Skeleton Loader --- */
.skeleton {
    background: linear-gradient(90deg,
        var(--bg-surface) 25%,
        var(--bg-surface-hover) 50%,
        var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-gold { color: var(--accent-gold); }
.text-green { color: var(--accent-green); }
.text-coral { color: var(--accent-coral); }
.text-blue { color: var(--accent-blue); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --font-3xl: 2rem;
        --font-2xl: 1.625rem;
        --font-xl: 1.25rem;
    }

    .hide-mobile { display: none !important; }
}

@media (max-width: 480px) {
    :root {
        --font-3xl: 1.625rem;
        --font-2xl: 1.375rem;
    }
}
