@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Tajawal:wght@400;500;600;700&display=swap');

:root {
    --radius-lg: 18px;
    --radius-xl: 26px;
    --shadow-strong: 0 26px 80px rgba(148, 91, 44, 0.35);
    --shadow-soft: 0 18px 52px rgba(234, 88, 12, 0.14);
    --transition-base: 0.2s ease;
    --font-ar: "Tajawal", "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-en: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    /* Sunrise luxe palette */
    --bg-main: #fff4eb;
    --bg-panel: #ffffff;
    --bg-overlay: radial-gradient(circle at 10% 14%, rgba(255, 205, 170, 0.32) 0, rgba(255, 240, 225, 0.82) 32%, rgba(245, 238, 255, 0.9) 70%);
    --bg-muted: rgba(255, 255, 255, 0.7);
    --color-primary: #f97316;
    --color-primary-strong: #ea580c;
    --border-color: rgba(248, 180, 120, 0.55);
    --text-main: #0f172a;
    --text-muted: #6b7280;
    --table-head: rgba(255, 255, 255, 0.92);
    --table-row: rgba(255, 241, 228, 0.8);
}

html[lang="ar"] { font-family: var(--font-ar); }
html[lang="en"] { font-family: var(--font-en); }

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-main);
    background-image: var(--bg-overlay);
    color: var(--text-main);
    position: relative;
    overflow-x: hidden;
}

.app-surface-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.app-surface-bg .orb {
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(95px);
    opacity: 0.5;
    background: radial-gradient(circle at 30% 30%, rgba(255, 193, 149, 0.55), rgba(249, 115, 22, 0.2));
}

.app-surface-bg .orb:nth-child(2) {
    width: 520px;
    height: 520px;
    right: -120px;
    top: 20%;
    background: radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.65), rgba(34, 211, 238, 0.28));
}

.app-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    gap: 18px;
    padding: 18px;
}

.sidebar {
    width: 270px;
    background: linear-gradient(190deg, rgba(255, 255, 255, 0.7), rgba(255, 247, 237, 0.92));
    backdrop-filter: blur(20px);
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    padding: 18px 16px;
    border: 1px solid rgba(248, 180, 120, 0.45);
    box-shadow: var(--shadow-strong);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 12px;
    height: calc(100vh - 36px);
}

[dir="rtl"] .sidebar { border-radius: var(--radius-xl) 0 0 var(--radius-xl); }

.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.sidebar-brand-logo { width: 42px; height: 42px; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 22px rgba(0,0,0,0.16); }
.sidebar-brand-title { font-weight: 700; font-size: 1rem; color: var(--text-main); }
.sidebar-brand-sub { color: var(--text-muted); font-size: 0.85rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    color: var(--text-main);
    text-decoration: none;
    border: 1px solid transparent;
    transition: var(--transition-base);
    background: transparent;
}
.sidebar-link span.icon { font-size: 1rem; }
.sidebar-link:hover { background: rgba(255,255,255,0.06); border-color: var(--border-color); transform: translateY(-1px); }
.sidebar-link.active { background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.6); color: #111827; }

.app-main {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.app-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 247, 237, 0.9));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 18px 60px rgba(234, 88, 12, 0.12);
    backdrop-filter: blur(14px);
}

.h-page-title { font-size: 1.45rem; font-weight: 700; margin: 0; }
.h-section-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.text-muted-soft { color: var(--text-muted); font-size: 0.9rem; }

/* Question modal refinements */
.question-modal .modal-dialog { max-width: 1080px; }
.question-modal .modal-content {
    border-radius: var(--radius-xl);
    border: 1px solid rgba(249, 115, 22, 0.25);
    box-shadow: 0 24px 58px rgba(249, 115, 22, 0.18);
    background: radial-gradient(circle at 18% 10%, rgba(255, 209, 170, 0.38), rgba(255, 255, 255, 0.92)), var(--bg-panel);
}
.question-modal .modal-header,
.question-modal .modal-footer { background: linear-gradient(120deg, rgba(255, 255, 255, 0.92), rgba(255, 241, 228, 0.9)); }
.question-modal .modal-title { letter-spacing: -0.01em; }
.question-modal .modal-body { padding-bottom: 0; }
.question-modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding-bottom: 20px;
}
.question-modal .pr-card { background: rgba(255, 255, 255, 0.9); border-color: rgba(249, 115, 22, 0.2); box-shadow: 0 18px 44px rgba(15, 23, 42, 0.05); }
.question-modal .pr-field textarea { min-height: 110px; max-height: 180px; }
.question-modal .row.g-3 > [class*="col-"] { min-width: 320px; }

.app-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-muted);
    font-size: 0.85rem;
    color: var(--text-main);
}

.btn-pr {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-base);
}

.btn-pr-primary { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #111827; box-shadow: 0 12px 32px rgba(245, 158, 11, 0.35); }
.btn-pr-primary:hover { transform: translateY(-1px); box-shadow: 0 18px 40px rgba(245, 158, 11, 0.45); }
.btn-pr-outline { background: transparent; border-color: var(--border-color); color: var(--text-main); }
.btn-pr-soft { background: rgba(245, 158, 11, 0.12); color: var(--color-primary); border-color: rgba(245, 158, 11, 0.35); }
.btn-pr-icon { width: 40px; height: 40px; padding: 0; border-radius: 14px; font-size: 1rem; }
.btn-pr-sm { padding: 8px 12px; font-size: 0.85rem; }

.pr-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.pr-card::after {
    content: "";
    position: absolute;
    inset: -10% 60% auto auto;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.16), transparent 70%);
    opacity: 0.6;
}


.pr-stat-number { font-size: 1.9rem; font-weight: 700; }
.badge-pill { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.badge-success { background: rgba(74, 222, 128, 0.16); color: #16a34a; }
.badge-warning { background: rgba(251, 191, 36, 0.18); color: #b45309; }
.badge-danger { background: rgba(248, 113, 113, 0.18); color: #dc2626; }
.badge-muted { background: rgba(148, 163, 184, 0.2); color: var(--text-main); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.pr-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-panel);
    box-shadow: var(--shadow-soft);
}
.pr-table thead { background: var(--table-head); }
.pr-table th, .pr-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; }
.pr-table tbody tr { transition: var(--transition-base); }
.pr-table tbody tr:hover { background: var(--table-row); }
.pr-table .cell-truncate {
    display: inline-block;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}
.pr-table .cell-truncate.sm { max-width: 160px; }
.pr-table .cell-truncate.lg { max-width: 320px; }
.table-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.table-actions .btn-pr { padding: 7px 11px; font-size: 0.85rem; border-radius: 10px; }
.pr-table caption { caption-side: top; color: var(--text-muted); padding: 8px 4px; font-size: 0.9rem; }

.pr-empty { padding: 20px; border-radius: 14px; background: rgba(255,255,255,0.8); border: 1px dashed var(--border-color); text-align: center; color: var(--text-muted); }
.pr-empty strong { color: var(--text-main); }

.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-weight: 700; font-size: 0.82rem; }
.status-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.status-badge.success { background: rgba(34,197,94,0.14); color: #15803d; border: 1px solid rgba(34,197,94,0.3); }
.status-badge.warning { background: rgba(251,146,60,0.16); color: #c2410c; border: 1px solid rgba(251,146,60,0.35); }
.status-badge.info { background: rgba(14,165,233,0.12); color: #0ea5e9; border: 1px solid rgba(14,165,233,0.28); }

.pr-form-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: 16px; }
.pr-form-grid .pr-field { margin-bottom: 0; }
.pr-form-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.pr-field { margin-bottom: 14px; }
.pr-field label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.pr-field input, .pr-field select, .pr-field textarea, .form-control {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-panel);
    color: var(--text-main);
    padding: 12px 12px;
    font-size: 0.95rem;
}
.pr-field input:focus, .pr-field select:focus, .pr-field textarea:focus, .form-control:focus {
    outline: none;
    border-color: rgba(245, 158, 11, 0.55);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
}

.list-unstyled { padding: 0; margin: 0; list-style: none; }
.user-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--bg-muted); border: 1px solid var(--border-color); }
.user-pill-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--text-main); color: var(--bg-panel); display: grid; place-items: center; font-weight: 700; }

.app-content { flex: 1; }
footer { padding: 10px 0 6px; color: var(--text-muted); text-align: center; font-size: 0.9rem; }

.sidebar-backdrop { display: none; }
.sidebar-backdrop.show { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 1040; display: block; }

@media (max-width: 1199.98px) { .sidebar { width: 240px; } }

@media (max-width: 991.98px) {
    .app-shell { flex-direction: column; }
    .sidebar { position: fixed; inset: 0 auto 0 0; height: 100vh; width: 280px; max-width: 92%; transform: translateX(-110%); transition: transform 0.25s ease, opacity 0.2s ease; opacity: 0; pointer-events: none; z-index: 1050; border-radius: 0 var(--radius-xl) var(--radius-xl) 0; overflow-y: auto; }
    [dir="rtl"] .sidebar { inset: 0 0 0 auto; transform: translateX(110%); }
    .sidebar.is-open { transform: translateX(0); opacity: 1; pointer-events: auto; }
}

@media (max-width: 767.98px) {
    .app-shell { padding: 12px; }
    .app-header { flex-direction: column; align-items: flex-start; }
    .app-meta { width: 100%; }
}

/* Auth experience */
.auth-body {
    min-height: 100vh;
    background: radial-gradient(circle at 20% 15%, rgba(255, 213, 185, 0.55), transparent 30%),
        radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.7), transparent 35%),
        linear-gradient(155deg, #fff4eb 0%, #ffe8d7 45%, #ffe6f1 100%);
    display: grid;
    place-items: center;
    padding: 28px;
    position: relative;
    overflow: hidden;
}

.auth-aura,
.auth-rings {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.auth-aura::before,
.auth-aura::after {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
}

.auth-aura::before { background: #fdba74; top: -8%; left: -12%; }
.auth-aura::after { background: #f9a8d4; bottom: -16%; right: -10%; }

.auth-rings::before,
.auth-rings::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    border: 1px solid rgba(253, 186, 116, 0.45);
    width: 62%;
    height: 72%;
    inset: 12% auto auto 22%;
    transform: rotate(-6deg);
    box-shadow: 0 0 90px rgba(249, 115, 22, 0.08);
}

.auth-rings::after {
    inset: auto 18% 8% auto;
    transform: rotate(9deg);
    border-color: rgba(244, 114, 182, 0.35);
}

.auth-shell { width: min(1200px, 100%); position: relative; z-index: 1; }
.auth-backdrop {
    position: absolute;
    inset: 0;
    border-radius: 38px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.65), rgba(255, 247, 237, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 28px 120px rgba(249, 115, 22, 0.08), 0 14px 50px rgba(15, 23, 42, 0.08);
    filter: blur(6px);
}

.auth-card {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 247, 237, 0.98));
    border-radius: 34px;
    overflow: hidden;
    border: 1px solid rgba(253, 186, 116, 0.55);
    box-shadow: 0 30px 90px rgba(249, 115, 22, 0.15), 0 14px 40px rgba(15, 23, 42, 0.12);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
}

.auth-media { position: relative; min-height: 100%; background: radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.24), transparent 60%); }
.auth-media img { width: 100%; height: 100%; object-fit: cover; }
.auth-media-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(210deg, rgba(15, 23, 42, 0.55) 0%, rgba(15, 23, 42, 0.15) 55%, rgba(255, 247, 237, 0.1) 100%);
    padding: 32px;
    color: #fefcfb;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    backdrop-filter: blur(2px);
}

.auth-media-heading { display: flex; flex-direction: column; gap: 8px; }

.auth-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06));
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #f8fafc;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

.auth-pill.subtle { background: rgba(249, 115, 22, 0.12); border-color: rgba(249, 115, 22, 0.6); color: var(--text-main); box-shadow: none; }
.auth-media-title { font-size: 2.35rem; font-weight: 900; text-shadow: 0 16px 34px rgba(0, 0, 0, 0.45); line-height: 1.1; }
.auth-media-text { font-size: 1.08rem; opacity: 0.96; max-width: 82%; }
.auth-highlight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.auth-highlight { background: linear-gradient(140deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.12)); border: 1px solid rgba(255, 255, 255, 0.38); padding: 13px 16px; border-radius: 18px; font-size: 0.98rem; backdrop-filter: blur(8px); font-weight: 800; color: #fff7ed; text-shadow: 0 6px 18px rgba(0,0,0,0.24); }
.auth-stats { display: flex; align-items: center; gap: 12px; margin-top: auto; }
.auth-stat { background: rgba(255, 255, 255, 0.16); padding: 13px 15px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.3); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18); }
.auth-stat .label { font-size: 0.82rem; opacity: 0.8; letter-spacing: 0.01em; }
.auth-stat .value { font-size: 1.2rem; font-weight: 900; }

.auth-form { padding: 40px; display: flex; flex-direction: column; gap: 18px; background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 245, 236, 0.95)); }
.auth-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand-icon { width: 56px; height: 56px; border-radius: 18px; overflow: hidden; background: radial-gradient(circle at 30% 30%, rgba(249, 115, 22, 0.2), rgba(244, 114, 182, 0.2)); display: grid; place-items: center; border: 1px solid rgba(253, 186, 116, 0.7); box-shadow: 0 12px 32px rgba(249, 115, 22, 0.2); }
.auth-brand-icon img { width: 100%; height: 100%; object-fit: cover; }
.auth-brand-title { font-weight: 900; font-size: 1.2rem; letter-spacing: 0.01em; }
.auth-brand-sub { color: var(--text-muted); font-size: 0.95rem; }
.auth-title-block h1 { margin: 8px 0 6px; font-weight: 900; letter-spacing: -0.01em; }
.auth-title-block p { margin: 0; font-size: 1rem; color: #7c2d12; }
.auth-alert { border-radius: 14px; }
.auth-fields .pr-field input { background: rgba(255, 255, 255, 0.8); border-color: rgba(253, 186, 116, 0.75); box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 16px 40px rgba(249, 115, 22, 0.08); }
.auth-fields .pr-field input:focus { box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25), 0 10px 28px rgba(249, 115, 22, 0.12); border-color: rgba(234, 88, 12, 0.6); }
.auth-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.auth-chip { background: linear-gradient(120deg, rgba(249, 115, 22, 0.16), rgba(244, 114, 182, 0.12)); padding: 10px 14px; border-radius: 999px; font-weight: 800; letter-spacing: 0.02em; color: #9a3412; border: 1px solid rgba(249, 115, 22, 0.25); box-shadow: 0 10px 24px rgba(249, 115, 22, 0.12); }
.auth-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 10px; }
.auth-quick { display: flex; flex-direction: column; gap: 2px; }
.auth-divider { width: 100%; height: 1px; background: linear-gradient(90deg, rgba(249, 115, 22, 0.2), rgba(0,0,0,0.06), rgba(56, 189, 248, 0.2)); opacity: 0.9; margin: 2px 0 10px; }
.auth-meta-badges { display: flex; gap: 10px; flex-wrap: wrap; }
.auth-meta-badge { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 16px; background: rgba(255, 255, 255, 0.82); border: 1px solid rgba(253, 186, 116, 0.4); font-weight: 800; color: #9a3412; box-shadow: 0 10px 24px rgba(249, 115, 22, 0.12); }
.auth-meta-badge .dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(120deg, #f97316, #38bdf8); box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.16); }

@media (max-width: 991.98px) {
    .auth-card { grid-template-columns: 1fr; }
    .auth-media { height: 320px; }
}
