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

:root {
    --primary: #4f46e5;
    --primary-2: #7c3aed;
    --primary-glow: rgba(79, 70, 229, 0.14);
    --bg-main: #f6f8ff;
    --bg-card: rgba(255, 255, 255, 0.86);
    --bg-sidebar: rgba(255, 255, 255, 0.9);
    --border: rgba(148, 163, 184, 0.24);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --input-bg: #ffffff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --shadow: 0 24px 70px rgba(15, 23, 42, 0.10);
    --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] {
    --bg-main: #080b14;
    --bg-card: rgba(15, 23, 42, 0.84);
    --bg-sidebar: rgba(15, 23, 42, 0.92);
    --border: rgba(148, 163, 184, 0.16);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #818cf8;
    --primary-2: #a78bfa;
    --primary-glow: rgba(129, 140, 248, 0.16);
    --input-bg: rgba(15, 23, 42, 0.82);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }

body {
    font-family: 'Cairo', 'Inter', sans-serif;
    background:
        radial-gradient(circle at top right, rgba(79, 70, 229, 0.14), transparent 28rem),
        radial-gradient(circle at bottom left, rgba(6, 182, 212, 0.12), transparent 24rem),
        var(--bg-main);
    color: var(--text-main);
    margin: 0;
    direction: rtl;
    min-height: 100vh;
}

a { color: inherit; }

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: 270px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 26px 18px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.main-content {
    margin-right: 306px;
    padding: 38px 44px;
    flex: 1;
    width: calc(100% - 306px);
}

.brand {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 34px;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand i {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 14px 30px var(--primary-glow);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 16px;
    margin-bottom: 7px;
    font-weight: 700;
    transition: 0.22s ease;
}

.nav-link i { width: 22px; text-align: center; }

.nav-link:hover,
.nav-link.active {
    background: linear-gradient(135deg, var(--primary-glow), rgba(6, 182, 212, 0.08));
    color: var(--primary);
}

.glass-card,
.stat-widget,
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.glass-card { padding: 26px; }

.stat-widget {
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.stat-widget::after {
    content: '';
    position: absolute;
    inset-inline-start: -32px;
    inset-block-start: -40px;
    width: 110px;
    height: 110px;
    border-radius: 999px;
    background: var(--primary-glow);
}

.stat-label {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
}

.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.premium-table th {
    padding: 12px 16px;
    text-align: right;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 800;
}

.premium-table td {
    padding: 16px;
    background: rgba(255,255,255,0.55);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    vertical-align: middle;
}

[data-theme="dark"] .premium-table td { background: rgba(15, 23, 42, 0.55); }
.premium-table tr td:first-child { border-radius: 0 18px 18px 0; border-right: 1px solid var(--border); }
.premium-table tr td:last-child { border-radius: 18px 0 0 18px; border-left: 1px solid var(--border); }

.member-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.form-label {
    color: var(--text-main);
    font-weight: 800;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    padding: 13px 15px;
    border-radius: 15px;
    color: var(--text-main);
    margin-bottom: 12px;
    outline: none;
    font-weight: 600;
    transition: 0.2s ease;
}

.form-input::placeholder { color: color-mix(in srgb, var(--text-muted) 70%, transparent); }
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 5px var(--primary-glow);
}

.btn-obsidian {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white !important;
    border: none;
    padding: 12px 22px;
    border-radius: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 14px 28px var(--primary-glow);
}

.btn-obsidian:hover {
    transform: translateY(-2px);
    filter: saturate(1.08);
}

.btn-obsidian:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-success { background: linear-gradient(135deg, #10b981, #059669) !important; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626) !important; }

.theme-toggle {
    margin-top: auto;
    background: var(--primary-glow);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 12px;
    border-radius: 16px;
    cursor: pointer;
    text-align: center;
    font-weight: 800;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(79, 70, 229, 0.20), transparent 30rem),
        var(--bg-main);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-soft {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    border: 1px solid transparent;
}
.badge-soft.purple { background: rgba(124, 58, 237, 0.10); color: #7c3aed; border-color: rgba(124, 58, 237, 0.16); }
.badge-soft.blue { background: rgba(79, 70, 229, 0.10); color: #4f46e5; border-color: rgba(79, 70, 229, 0.16); }
.badge-soft.green { background: rgba(16, 185, 129, 0.12); color: #059669; border-color: rgba(16, 185, 129, 0.18); }
.badge-soft.cyan { background: rgba(6, 182, 212, 0.12); color: #0891b2; border-color: rgba(6, 182, 212, 0.18); }

.action-group { display: flex; gap: 6px; }
.icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    background: var(--primary-glow);
    color: var(--primary);
    display: inline-grid;
    place-items: center;
    transition: 0.2s ease;
}
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn.info { color: #0891b2; background: rgba(6,182,212,.12); }
.icon-btn.danger { color: #dc2626; background: rgba(239,68,68,.12); }
.empty-state { text-align: center; color: var(--text-muted); padding: 34px !important; }

.group-card {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255,255,255,.5);
    color: var(--text-main);
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    text-align: right;
    font-weight: 800;
    transition: .2s ease;
}
[data-theme="dark"] .group-card { background: rgba(15, 23, 42, .5); }
.group-card small { color: var(--text-muted); font-weight: 700; }
.group-card:hover,
.group-card.active { border-color: var(--primary); box-shadow: 0 0 0 5px var(--primary-glow); }
.group-actions { display: flex; gap: 10px; color: var(--primary); }
.group-actions i { cursor: pointer; }

.field-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 800;
}
.field-pill button { border: 0; background: transparent; color: var(--danger); padding: 0; }

.details-list { display: grid; gap: 10px; }
.details-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255,255,255,.45);
}
[data-theme="dark"] .details-row { background: rgba(15,23,42,.45); }
.details-row span { color: var(--text-muted); font-weight: 700; }
.details-row b { overflow-wrap: anywhere; }

.system-toast {
    position: fixed;
    left: 24px;
    bottom: 24px;
    display: none;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 14px 16px;
    z-index: 10000;
    font-weight: 800;
}
.system-toast.show { display: flex; }
.system-toast.success i { color: var(--success); }
.system-toast.danger i { color: var(--danger); }

/* Public registration page */
.public-page {
    overflow-x: hidden;
    background: linear-gradient(135deg, #111827, #312e81 52%, #0891b2);
}
.public-wrap { position: relative; z-index: 2; }
.public-bg-shape {
    position: fixed;
    border-radius: 999px;
    filter: blur(10px);
    opacity: .35;
    z-index: 1;
}
.shape-one { width: 320px; height: 320px; background: #818cf8; top: 8%; right: 7%; }
.shape-two { width: 260px; height: 260px; background: #22d3ee; bottom: 10%; left: 8%; }
.public-hero { padding: 16px; }
.public-hero h1 { font-size: clamp(2rem, 4vw, 3.6rem); font-weight: 900; line-height: 1.22; margin: 18px 0; }
.public-hero p { color: rgba(255,255,255,.78); font-size: 1.05rem; line-height: 1.9; }
.hero-icon,
.public-card-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: 1.5rem;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
}
.eyebrow { display: inline-flex; font-size: .82rem; font-weight: 900; letter-spacing: .03em; text-transform: uppercase; opacity: .88; }
.public-chip {
    display: inline-flex;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.18);
    font-weight: 900;
}
.public-card {
    background: rgba(255,255,255,.94);
    color: #0f172a;
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 34px;
    padding: 30px;
    box-shadow: 0 30px 90px rgba(0,0,0,.22);
    backdrop-filter: blur(22px);
}
.public-card .form-input { background: #fff; color: #0f172a; }
.public-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}
.public-card-icon { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.success-panel { text-align: center; padding: 42px 10px; }
.success-icon {
    width: 82px;
    height: 82px;
    display: grid;
    place-items: center;
    border-radius: 28px;
    color: #fff;
    background: linear-gradient(135deg, #10b981, #059669);
    font-size: 2.2rem;
    margin: 0 auto 18px;
    box-shadow: 0 18px 42px rgba(16,185,129,.26);
}
.was-validated .form-input:invalid { border-color: var(--danger); box-shadow: 0 0 0 5px rgba(239,68,68,.12); }

@media (max-width: 992px) {
    .sidebar {
        top: 12px;
        right: 12px;
        bottom: 12px;
        width: 86px;
        padding: 18px 10px;
    }
    .nav-text,
    .brand-text,
    .sidebar .nav-link span:not(.nav-text) { display: none; }
    .main-content { margin-right: 110px; width: calc(100% - 110px); padding: 24px 18px; }
    .public-hero { text-align: center; }
    .hero-icon { margin: auto; }
}

@media (max-width: 768px) {
    .app-container { display: block !important; }
    .sidebar {
        position: sticky;
        top: 0;
        right: 0;
        width: 100%;
        height: auto;
        border-radius: 0 0 24px 24px;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        overflow-x: auto;
    }
    .sidebar nav { display: flex; gap: 6px; }
    .brand { margin-bottom: 0; }
    .theme-toggle { margin-top: 0; white-space: nowrap; }
    .main-content { margin-right: 0; width: 100%; padding: 22px 14px; }
    .nav-text,
    .brand-text,
    .sidebar .nav-link span:not(.nav-text) { display: inline; }
    header.d-flex { flex-direction: column; align-items: stretch !important; gap: 14px; }
    #filterGeneral { width: 100% !important; }
    .glass-card { padding: 18px; border-radius: 20px; }
    .public-card { padding: 22px; border-radius: 26px; }
}
