/* ═══════════════════════════════════════════════════════════
   MyAuth Platform - Premium Global Styles
   ═══════════════════════════════════════════════════════════ */

:root {
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-300: #a5b4fc;
    --brand-400: #818cf8;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-800: #3730a3;
    --brand-900: #312e81;
    --brand-primary: #6366f1;
    --brand-secondary: #8b5cf6;
    
    --surface-50: #f8fafc;
    --surface-100: #f1f5f9;
    --surface-200: #e2e8f0;
    --surface-300: #cbd5e1;
    --surface-400: #94a3b8;
    --surface-500: #64748b;
    --surface-600: #475569;
    --surface-700: #1e293b;
    --surface-800: #0f172a;
    --surface-900: #020617;
    
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 12px;
}

/* ─── Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { 
    margin: 0; 
    min-height: 100vh; 
    overflow-x: hidden; 
    background-color: var(--surface-900);
    color: var(--surface-100);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(99,102,241,0.3); color: #fff; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface-900); }
::-webkit-scrollbar-thumb { background: var(--surface-700); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-600); }

/* ─── Animations ────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInBottom { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

.animate-fade-in { animation: fadeIn 0.5s ease-out; }
.animate-fade-in-up { animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.animate-scale-in { animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.animate-float { animation: float 4s ease-in-out infinite; }

.stagger > * { animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }

/* ─── Glass & Surfaces ───────────────────────────────────── */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 24px -1px rgba(0, 0, 0, 0.2);
}

.glass-premium {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.8));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border-radius: 0.75rem !important;
    padding: 1.5rem !important;
}

.glass-hover { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.glass-hover:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(30, 41, 59, 0.8);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.3), 0 0 15px rgba(99, 102, 241, 0.1);
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.625rem 1.25rem; border-radius: 0.5rem; font-weight: 600;
    font-size: 0.875rem; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer; border: 1px solid transparent; outline: none;
    text-decoration: none; white-space: nowrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-primary:hover {
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
}

.btn-secondary {
    background: rgba(30, 41, 59, 0.5);
    color: var(--surface-200);
    border: 1px solid rgba(51, 65, 85, 0.5);
    backdrop-filter: blur(8px);
}
.btn-secondary:hover {
    background: rgba(51, 65, 85, 0.5);
    border-color: var(--brand-400);
    color: #fff;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.4); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; border-radius: 0.375rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.9375rem; border-radius: 0.5rem; }
.btn-icon { padding: 0.5rem; border-radius: 0.5rem; width: 36px; height: 36px; }

/* ─── Inputs ────────────────────────────────────────────── */
.input-group { margin-bottom: 1.25rem; }
.input-group label { display: block; margin-bottom: 0.5rem; font-size: 0.8125rem; font-weight: 600; color: var(--surface-400); }
.input-field {
    width: 100%; padding: 0.625rem 0.875rem; font-size: 0.875rem; color: #fff;
    background: rgba(15, 23, 42, 0.5); border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 0.5rem; outline: none; transition: all 0.2s ease;
    font-family: inherit;
}
.input-field:focus {
    border-color: var(--brand-500);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}
.input-field::placeholder { color: var(--surface-600); }

/* ─── Cards ─────────────────────────────────────────────── */
.stat-card {
    padding: 1.25rem; border-radius: 0.75rem;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.4));
    border: 1px solid rgba(51, 65, 85, 0.3);
    transition: all 0.3s ease;
}
.stat-card:hover {
    border-color: var(--brand-500);
    transform: translateY(-2px);
    background: rgba(30, 41, 59, 0.6);
}
.stat-card .stat-value {
    font-size: 2.25rem; font-weight: 800;
    background: linear-gradient(135deg, #fff, var(--brand-300));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.stat-card .stat-label {
    font-size: 0.75rem; color: var(--surface-400);
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}

/* ─── Tables ────────────────────────────────────────────── */
.data-table-container {
    overflow-x: auto; border-radius: 0.75rem; border: 1px solid rgba(51, 65, 85, 0.3);
    background: rgba(15, 23, 42, 0.2);
}
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table th {
    padding: 0.75rem 1rem; text-align: left; font-size: 0.6875rem;
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--surface-500); border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    background: rgba(15, 23, 42, 0.4);
}
.data-table td {
    padding: 0.875rem 1rem; font-size: 0.8125rem; color: var(--surface-200);
    border-bottom: 1px solid rgba(30, 41, 59, 0.4);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr { transition: background 0.2s; }
.data-table tbody tr:hover { background: rgba(99, 102, 241, 0.03); }

/* ─── Badges ────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; padding: 0.25rem 0.625rem;
    font-size: 0.75rem; font-weight: 700; border-radius: 0.5rem;
}
.badge-success { background: rgba(34, 197, 94, 0.1); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.2); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-warning { background: rgba(251, 191, 36, 0.1); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.2); }
.badge-purple { background: rgba(139, 92, 246, 0.1); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.2); }

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
    width: 280px; min-height: 100vh; background: var(--surface-900);
    border-right: 1px solid rgba(51, 65, 85, 0.3); padding: 2rem 0;
    position: fixed; left: 0; top: 0; z-index: 50;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.sidebar-link {
    display: flex; align-items: center; gap: 0.875rem;
    padding: 0.75rem 1.25rem; font-size: 0.875rem; font-weight: 500;
    color: var(--surface-400); text-decoration: none; transition: all 0.2s;
    margin: 0.25rem 0.75rem; border-radius: 0.5rem;
}
.sidebar-link:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.sidebar-link.active { 
    color: #fff; background: var(--brand-500); 
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ─── Main Content ──────────────────────────────────────── */
.main-content { margin-left: 280px; padding: 2.5rem; min-height: 100vh; transition: all 0.4s; }

/* ─── Mobile Bottom Nav ─────────────────────────────────── */
.bottom-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(20px);
    border-top: 1px solid rgba(51, 65, 85, 0.5);
    z-index: 100; padding: 0.5rem 1rem env(safe-area-inset-bottom);
    justify-content: space-around; align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}
.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
    color: var(--surface-500); text-decoration: none; font-size: 0.625rem;
    font-weight: 600; padding: 0.5rem; border-radius: 0.75rem; transition: all 0.2s;
}
.bottom-nav-item.active { color: var(--brand-400); }
.bottom-nav-item svg { width: 20px; height: 20px; }

/* ─── Tab Nav ───────────────────────────────────────────── */
.tab-nav {
    display: flex;
    gap: 0.5rem;
    padding: 0.375rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: 1.25rem;
    width: fit-content;
    overflow-x: auto;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}
.tab-nav::-webkit-scrollbar { display: none; } /* Hide scrollbar for Chrome/Safari */

.tab-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--surface-400);
    border-radius: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.tab-btn.active {
    color: #fff;
    background: var(--brand-500);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1.5rem; padding-bottom: 5rem; }
    .bottom-nav { display: flex; }
}

@media (max-width: 640px) {
    .main-content { padding: 1rem; padding-bottom: 5rem; }
    .btn-lg { width: 100%; }
    .stat-card { padding: 1.25rem; }
}

/* ─── Decorative ────────────────────────────────────────── */
.glow-orb {
    position: absolute; border-radius: 50%; filter: blur(100px);
    z-index: 0; pointer-events: none; opacity: 0.4; mix-blend-mode: screen;
}

.hero-gradient {
    background: radial-gradient(circle at 50% -20%, rgba(99, 102, 241, 0.15), transparent 70%),
                radial-gradient(circle at 0% 100%, rgba(139, 92, 246, 0.1), transparent 50%),
                var(--surface-900);
}

.key-display {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    background: rgba(0, 0, 0, 0.3); padding: 0.25rem 0.5rem;
    border-radius: 0.375rem; border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--brand-300);
}

.empty-state {
    text-align: center; padding: 4rem 2rem;
    background: rgba(15, 23, 42, 0.2); border: 2px dashed rgba(51, 65, 85, 0.3);
    border-radius: 1.5rem;
}

/* ─── Toast Custom ──────────────────────────────────────── */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 10000; display: flex; flex-direction: column; gap: 0.75rem; }
.toast {
    padding: 1rem 1.25rem; border-radius: 1rem; font-size: 0.875rem; font-weight: 600;
    display: flex; align-items: center; gap: 0.75rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.1);
}
.toast-success { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.toast-error { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* ─── Modals ────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(8px); z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.modal-content {
    width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
    background: var(--surface-800); border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.modal-header {
    padding: 1.5rem 2rem; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.25rem; font-weight: 800; color: #fff; margin: 0; }
.modal-body { padding: 2rem; }

/* ─── Spinner ───────────────────────────────────────────── */
.spinner {
    width: 24px; height: 24px; border: 3px solid rgba(99, 102, 241, 0.1);
    border-top-color: var(--brand-500); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.spinner-lg { width: 48px; height: 48px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
