/* ═══════════════════════════════════════════════════════════
   Vex — Premium Dashboard Stylesheet
   RTL Arabic-first design with modern aesthetics
   ═══════════════════════════════════════════════════════════ */

:root {
    /* Color Palette */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-hover: #1a2745;
    --bg-input: #0e1628;
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b82;
    --accent-primary: #0ea5e9;
    --accent-secondary: #6366f1;
    --accent-gradient: linear-gradient(135deg, #0ea5e9, #6366f1);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border-color: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Tajawal', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: #38bdf8; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
    background: rgba(22, 33, 62, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo { font-size: 28px; }
.nav-title { font-size: 20px; font-weight: 700; }
.nav-badge {
    background: var(--accent-gradient);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

.nav-links { display: flex; gap: 4px; }
.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
}
.nav-link:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }
.nav-link.active {
    background: rgba(14, 165, 233, 0.12);
    color: var(--accent-primary);
}

/* ── Setup Wizard ─────────────────────────────────────── */
.setup-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at top, #1a1a3e 0%, var(--bg-primary) 70%);
    padding: 24px;
}

.setup-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px;
    max-width: 560px;
    width: 100%;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: fadeInUp 0.6s ease-out;
}

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

.setup-header {
    text-align: center;
    margin-bottom: 36px;
}

.logo {
    font-size: 64px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.success-logo { animation: none; }

.setup-header h1 {
    font-size: 28px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 15px;
}

/* ── Forms ────────────────────────────────────────────── */
.setup-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
}

input[type="text"], input[type="password"], textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}

input:focus, textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.input-ltr { direction: ltr; text-align: left; font-family: 'Roboto Mono', monospace; }

small { color: var(--text-muted); font-size: 12px; }
.hint { margin-top: -8px; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.btn-lg { padding: 14px 28px; font-size: 16px; margin-top: 12px; }

/* ── Alerts ───────────────────────────────────────────── */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-line;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* ── Success Steps ────────────────────────────────────── */
.success-steps {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: var(--radius-md);
    padding: 24px;
    margin: 24px 0;
}

.success-steps h3 { margin-bottom: 12px; color: var(--success); }
.success-steps ol { padding-right: 20px; }
.success-steps li { margin-bottom: 8px; color: var(--text-secondary); }

.restart-notice {
    text-align: center;
    padding: 20px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: var(--radius-md);
}

.code-block {
    display: block;
    background: var(--bg-input);
    padding: 12px;
    margin-top: 12px;
    border-radius: var(--radius-sm);
    font-family: 'Roboto Mono', monospace;
    direction: ltr;
    text-align: center;
    color: var(--accent-primary);
}

/* ── Dashboard ────────────────────────────────────────── */
.dashboard { padding: 32px 0 64px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 28px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.stat-users::before { background: var(--accent-primary); }
.stat-groups::before { background: var(--accent-secondary); }
.stat-blocked::before { background: var(--danger); }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon { font-size: 40px; }
.stat-value { font-size: 32px; font-weight: 800; }
.stat-label { font-size: 14px; color: var(--text-secondary); }

/* ── Quick Actions ────────────────────────────────────── */
.quick-actions h2 { font-size: 18px; margin-bottom: 16px; }

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-primary);
    transition: var(--transition);
}

.action-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(14, 165, 233, 0.3);
    transform: translateY(-2px);
}

.action-icon { font-size: 28px; }
.action-label { font-weight: 600; font-size: 15px; }

/* ── Tables ───────────────────────────────────────────── */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 14px 20px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.mono { font-family: 'Roboto Mono', monospace; direction: ltr; text-align: left; font-size: 13px; }

/* ── Badges ───────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* ── Empty State ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); font-size: 14px; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar { padding: 0 16px; flex-direction: column; height: auto; padding: 12px 16px; gap: 8px; }
    .nav-links { width: 100%; justify-content: center; }
    .form-row { grid-template-columns: 1fr; }
    .setup-card { padding: 28px; }
    .stats-grid { grid-template-columns: 1fr; }
    .data-table { font-size: 13px; }
    .data-table th, .data-table td { padding: 10px 12px; }
}
