/* ─── Admin Design System ─── */
:root {
    --brand: #0ea5e9;
    --brand-glow: rgba(14, 165, 233, 0.35);
    --accent: #8b5cf6;
    --surface: #0a0f1a;
    --panel: rgba(15, 23, 42, 0.65);
    --border: rgba(148, 163, 184, 0.08);
    --border-hover: rgba(14, 165, 233, 0.25);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --radius: 16px;
    --radius-sm: 12px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Animated background */
.admin-bg {
    background: var(--surface);
    position: relative;
    overflow-x: hidden;
}
.admin-bg::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 10% 0%, rgba(14, 165, 233, 0.12), transparent 50%),
        radial-gradient(ellipse 60% 50% at 90% 10%, rgba(139, 92, 246, 0.1), transparent 50%),
        radial-gradient(ellipse 50% 40% at 50% 100%, rgba(16, 185, 129, 0.06), transparent 50%);
    pointer-events: none;
    z-index: 0;
}
.admin-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
    animation: orb-float 20s ease-in-out infinite;
}
.admin-orb-1 { width: 400px; height: 400px; background: #0ea5e9; top: -100px; right: -100px; }
.admin-orb-2 { width: 300px; height: 300px; background: #8b5cf6; bottom: -50px; left: -50px; animation-delay: -7s; }
.admin-orb-3 { width: 200px; height: 200px; background: #10b981; top: 50%; left: 40%; animation-delay: -14s; opacity: 0.2; }

@keyframes orb-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* Glass panels */
.glass-panel {
    background: var(--panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.3s var(--spring);
}
.glass-panel:hover {
    border-color: var(--border-hover);
}
.glass-panel-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px -12px rgba(14, 165, 233, 0.15);
}

/* Sidebar */
.admin-sidebar {
    background: rgba(10, 15, 26, 0.92);
    backdrop-filter: blur(24px);
    border-left: 1px solid var(--border);
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
    border: 1px solid transparent;
    transition: all 0.25s var(--ease);
    position: relative;
    overflow: hidden;
}
.nav-link::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, var(--brand), var(--accent));
    border-radius: 4px;
    transition: transform 0.3s var(--spring);
}
.nav-link:hover {
    color: var(--text);
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(148, 163, 184, 0.06);
}
.nav-link.active {
    color: #38bdf8;
    background: rgba(14, 165, 233, 0.08);
    border-color: rgba(14, 165, 233, 0.15);
}
.nav-link.active::before {
    transform: translateY(-50%) scaleY(1);
}
.nav-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 41, 59, 0.6);
    transition: all 0.3s var(--ease);
    flex-shrink: 0;
}
.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    background: rgba(14, 165, 233, 0.15);
    box-shadow: 0 0 20px -5px var(--brand-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    white-space: nowrap;
}
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }
.btn-sm { padding: 6px 14px; font-size: 0.75rem; border-radius: 10px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: 14px; }
.btn-block { width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: white;
    box-shadow: 0 4px 20px -4px rgba(14, 165, 233, 0.5);
}
.btn-primary:hover {
    box-shadow: 0 8px 30px -4px rgba(14, 165, 233, 0.6);
    transform: translateY(-1px);
}
.btn-secondary {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(148, 163, 184, 0.15);
}
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
}
.btn-ghost:hover {
    background: rgba(30, 41, 59, 0.5);
    color: var(--text);
}
.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}
.btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 4px 20px -4px rgba(16, 185, 129, 0.4);
}
.btn-violet {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: white;
    box-shadow: 0 4px 20px -4px rgba(139, 92, 246, 0.4);
}

/* Form inputs */
.admin-input,
.admin-select,
.admin-textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    color: var(--text);
    font-size: 0.875rem;
    transition: all 0.25s var(--ease);
    outline: none;
}
.admin-input:focus,
.admin-select:focus,
.admin-textarea:focus {
    border-color: rgba(14, 165, 233, 0.5);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}
.admin-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
}

/* Stat cards */
.stat-card {
    padding: 20px;
    border-radius: var(--radius);
    background: var(--panel);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: all 0.35s var(--spring);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.15;
    transition: opacity 0.3s;
}
.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: 0 16px 48px -16px rgba(0, 0, 0, 0.4);
}
.stat-card:hover::before { opacity: 0.3; }
.stat-card.emerald::before { background: #10b981; }
.stat-card.sky::before { background: #0ea5e9; }
.stat-card.amber::before { background: #f59e0b; }
.stat-card.orange::before { background: #f97316; }
.stat-card.red::before { background: #ef4444; }
.stat-card.violet::before { background: #8b5cf6; }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    transition: transform 0.3s var(--spring);
}
.stat-card:hover .stat-icon { transform: scale(1.1) rotate(-3deg); }

/* Tables */
.admin-table {
    width: 100%;
    font-size: 0.875rem;
}
.admin-table thead tr {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: rgba(30, 41, 59, 0.3);
}
.admin-table th { padding: 14px 16px; text-align: right; }
.admin-table td { padding: 14px 16px; }
.admin-table tbody tr {
    border-bottom: 1px solid rgba(148, 163, 184, 0.05);
    transition: background 0.2s;
}
.admin-table tbody tr:hover {
    background: rgba(14, 165, 233, 0.03);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
}
.badge-emerald { background: rgba(16, 185, 129, 0.12); color: #34d399; border-color: rgba(16, 185, 129, 0.2); }
.badge-red { background: rgba(239, 68, 68, 0.12); color: #f87171; border-color: rgba(239, 68, 68, 0.2); }
.badge-amber { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border-color: rgba(245, 158, 11, 0.2); }
.badge-sky { background: rgba(14, 165, 233, 0.12); color: #38bdf8; border-color: rgba(14, 165, 233, 0.2); }
.badge-slate { background: rgba(51, 65, 85, 0.5); color: #cbd5e1; }

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slide-down 0.4s var(--spring);
}
.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.25); color: #34d399; }
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.25); color: #f87171; }

/* Page animations */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slide-down {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes bar-grow {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px -5px var(--brand-glow); }
    50% { box-shadow: 0 0 30px -2px var(--brand-glow); }
}

.animate-in { animation: fade-up 0.5s var(--ease) both; }
.animate-in-1 { animation-delay: 0.05s; }
.animate-in-2 { animation-delay: 0.1s; }
.animate-in-3 { animation-delay: 0.15s; }
.animate-in-4 { animation-delay: 0.2s; }
.animate-in-5 { animation-delay: 0.25s; }
.animate-in-6 { animation-delay: 0.3s; }
.animate-in-7 { animation-delay: 0.35s; }
.animate-in-8 { animation-delay: 0.4s; }

.page-content > * { animation: fade-up 0.45s var(--ease) both; }
.page-content > *:nth-child(1) { animation-delay: 0.05s; }
.page-content > *:nth-child(2) { animation-delay: 0.1s; }
.page-content > *:nth-child(3) { animation-delay: 0.15s; }
.page-content > *:nth-child(4) { animation-delay: 0.2s; }
.page-content > *:nth-child(5) { animation-delay: 0.25s; }
.page-content > *:nth-child(6) { animation-delay: 0.3s; }

/* Chart bars */
.chart-bar {
    transform-origin: bottom;
    animation: bar-grow 0.8s var(--spring) both;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, #38bdf8, #0ea5e9);
    position: relative;
    overflow: hidden;
}
.chart-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    background-size: 200% 100%;
    animation: shimmer 3s infinite;
}

/* Section title */
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
}
.section-title-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(14, 165, 233, 0.12);
    color: #38bdf8;
}

/* Header */
.admin-header {
    background: rgba(10, 15, 26, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.brand-logo {
    animation: pulse-glow 3s ease-in-out infinite;
}

/* Modal */
.modal-backdrop {
    animation: fade-up 0.2s var(--ease) both;
}
.modal-panel {
    animation: scale-in 0.3s var(--spring) both;
}

/* Quick links */
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: var(--radius);
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s var(--spring);
}
.quick-action:hover {
    color: var(--text);
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px -8px rgba(14, 165, 233, 0.2);
}
.quick-action-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s var(--spring);
}
.quick-action:hover .quick-action-icon { transform: scale(1.15); }

/* Scrollbar */
.admin-sidebar nav::-webkit-scrollbar { width: 4px; }
.admin-sidebar nav::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.2); border-radius: 4px; }

/* Login page */
.login-bg {
    background: #050a14;
    position: relative;
    overflow: hidden;
}
.login-card {
    animation: scale-in 0.6s var(--spring) both;
}

[x-cloak] { display: none !important; }

/* Legacy form auto-upgrade inside admin pages */
.page-content input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not(.admin-input),
.page-content select:not(.admin-select),
.page-content textarea:not(.admin-textarea) {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    color: var(--text);
    font-size: 0.875rem;
    transition: all 0.25s var(--ease);
    outline: none;
}
.page-content input:focus,
.page-content select:focus,
.page-content textarea:focus {
    border-color: rgba(14, 165, 233, 0.5);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}
