@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    --bg: #06060b;
    --s1: #0c0c16;
    --s2: #12121e;
    --s3: #1a1a2a;
    --border: #1e1e30;
    --border-l: #2a2a40;
    --accent: #6366f1;
    --accent-l: #818cf8;
    --accent-glow: rgba(99,102,241,.12);
    --green: #10b981;
    --green-glow: rgba(16,185,129,.12);
    --red: #ef4444;
    --orange: #f59e0b;
    --cyan: #06b6d4;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --dim: #64748b;
    --white: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100%;
}
body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
a { color: var(--accent-l); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-l); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* Animations */
@keyframes fadeUp { from { opacity:0; transform:translateY(18px); } to { opacity:1; transform:translateY(0); } }
@keyframes scaleIn { from { opacity:0; transform:scale(.95); } to { opacity:1; transform:scale(1); } }
@keyframes spin { to { transform:rotate(360deg); } }
@keyframes glow { 0%,100%{box-shadow:0 0 15px rgba(99,102,241,.12)} 50%{box-shadow:0 0 30px rgba(99,102,241,.25)} }

.fade-up { animation: fadeUp .5s ease-out forwards; }
.fade-up-1 { animation: fadeUp .5s ease-out .1s forwards; opacity: 0; }
.fade-up-2 { animation: fadeUp .5s ease-out .2s forwards; opacity: 0; }
.fade-up-3 { animation: fadeUp .5s ease-out .3s forwards; opacity: 0; }
.scale-in { animation: scaleIn .35s ease-out forwards; }

/* Layout — FIXED: no overflow:hidden on page-bg */
.page-bg {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--bg) 0%, #08081a 100%);
    position: relative;
    overflow-x: hidden;
    overflow-y: visible;
    padding-bottom: 100px;
}
.page-bg::before {
    content: '';
    position: fixed;
    top: -20%; right: -10%;
    width: 700px; height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
}
.page-bg::after {
    content: '';
    position: fixed;
    bottom: -15%; left: -8%;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6,182,212,.05) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

/* Glass header */
.glass-header {
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 20;
    background: rgba(12,12,22,.85);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}

/* Cards */
.card {
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    transition: all .25s;
}
.card:hover { border-color: var(--border-l); }
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.3); }

/* Buttons */
.btn {
    padding: 11px 22px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'DM Sans', sans-serif;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-l); text-decoration: none; }
.btn-green { background: var(--green); color: var(--white); }
.btn-red { background: var(--red); color: var(--white); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-l); color: var(--text); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon {
    width: 36px; height: 36px; border-radius: 8px;
    border: 1px solid var(--border); background: transparent;
    color: var(--muted); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.btn-icon:hover { border-color: var(--border-l); color: var(--text); }

/* Inputs */
.form-group { margin-bottom: 14px; }
.form-label {
    font-size: 11px; font-weight: 700; color: var(--dim);
    margin-bottom: 6px; display: block;
    letter-spacing: .04em; text-transform: uppercase;
}
.form-input {
    width: 100%; padding: 11px 14px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text);
    font-size: 14px; outline: none;
    transition: border-color .2s;
    font-family: 'DM Sans', sans-serif;
}
.form-input:focus { border-color: var(--accent); }
.form-input-mono { font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.form-input-green { color: var(--green); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Badges */
.badge {
    font-size: 11px; font-weight: 700;
    padding: 4px 10px; border-radius: 20px;
    display: inline-flex; align-items: center; gap: 5px;
}
.badge-active { background: var(--green-glow); color: var(--green); }
.badge-inactive { background: rgba(245,158,11,.12); color: var(--orange); }
.badge-admin { background: var(--accent-glow); color: var(--accent-l); }
.badge-dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: currentColor; display: inline-block;
}

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card { padding: 16px; }
.stat-card .stat-label {
    font-size: 11px; color: var(--dim);
    text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px;
}
.stat-card .stat-value {
    font-size: 28px; font-weight: 800;
    font-family: 'IBM Plex Mono', monospace;
}
.stat-icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th {
    text-align: left; padding: 10px 14px;
    font-size: 11px; font-weight: 700; color: var(--dim);
    text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
tr:hover td { background: var(--s1); }
.code-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600; letter-spacing: .04em;
}

/* Tabs */
.tabs {
    display: flex; gap: 3px; padding: 3px;
    background: var(--s1); border-radius: 10px;
    margin-bottom: 18px;
}
.tab-btn {
    flex: 1; padding: 9px; border-radius: 8px;
    border: none; cursor: pointer;
    font-size: 13px; font-weight: 700;
    transition: all .2s;
    font-family: 'DM Sans', sans-serif;
}
.tab-btn.active { background: var(--accent); color: var(--white); }
.tab-btn:not(.active) { background: transparent; color: var(--dim); }

/* Divider */
.divider {
    text-align: center; font-size: 12px; color: var(--dim);
    margin: 16px 0; position: relative;
}
.divider span {
    background: var(--s2); padding: 0 14px;
    position: relative; z-index: 1;
}
.divider::after {
    content: ''; position: absolute;
    top: 50%; left: 0; right: 0;
    height: 1px; background: var(--border);
}

/* Social buttons */
.social-btns { display: flex; gap: 10px; margin-bottom: 18px; }
.social-btn {
    flex: 1; display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 11px; border-radius: 10px;
    border: 1px solid var(--border); background: transparent;
    color: var(--text); cursor: pointer; font-weight: 600;
    font-size: 14px; font-family: 'DM Sans', sans-serif;
    transition: all .2s;
}
.social-btn:hover { border-color: var(--border-l); background: var(--s1); }
.social-btn img { width: 20px; height: 20px; }

/* Alerts */
.alert {
    padding: 12px 16px; border-radius: 10px;
    font-size: 13px; display: flex; align-items: center; gap: 8px;
    margin-bottom: 16px;
}
.alert-success { background: var(--green-glow); color: var(--green); border: 1px solid rgba(16,185,129,.2); }
.alert-error { background: rgba(239,68,68,.1); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.alert-info { background: rgba(6,182,212,.1); color: var(--cyan); border: 1px solid rgba(6,182,212,.2); }

/* Progress steps */
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.step-num {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800;
    border: 2px solid var(--border);
    background: var(--bg); color: var(--dim);
    transition: all .3s;
}
.step-num.active { background: var(--accent); color: var(--white); border-color: var(--accent); }
.step-label { font-size: 12px; }
.step-line { flex: 1; height: 2px; background: var(--border); transition: all .3s; }
.step-line.active { background: var(--accent); }

/* Auth container */
.auth-container {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.auth-card { max-width: 420px; width: 100%; }
.auth-icon {
    width: 60px; height: 60px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
}

/* Color swatches */
.color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.color-swatch {
    width: 28px; height: 28px; border-radius: 6px;
    cursor: pointer; border: 2px solid transparent;
    transition: all .15s;
}
.color-swatch.active { border-color: var(--white); }

/* RTL support */
[dir="rtl"] { text-align: right; }
[dir="rtl"] th { text-align: right; }
[dir="rtl"] .form-label { text-align: right; }

/* Responsive */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .glass-header { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
    .social-btns { flex-direction: column; }
    .container { padding: 0 14px; }
    .card { padding: 16px; }
    .page-bg { padding-bottom: 120px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .card { padding: 14px; }
    table { min-width: 500px; font-size: 12px; }
    th, td { padding: 8px 10px; }
}

/* Utility */
.text-center { text-align: center; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--muted); }
.text-dim { color: var(--dim); }
.text-accent { color: var(--accent-l); }
.text-mono { font-family: 'IBM Plex Mono', monospace; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-gap { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.w-full { width: 100%; }
.inline-flex { display: inline-flex; align-items: center; gap: 6px; }
