/* ===========================================================================
   Nova Platform — SuperAdmin theme. Mirrors the Nova CRM brand (vibrant
   orange #F97316 on slate) so staff who use both apps feel at home.
   Works for both RTL (Arabic, default) and LTR (English) via Bootstrap's
   logical properties — `start`/`end` instead of `left`/`right`.
   =========================================================================== */

:root {
    --brand-orange:     #F97316;
    --brand-orange-600: #EA580C;
    --brand-orange-50:  #FFF7ED;
    --brand-slate-900:  #0F172A;
    --brand-slate-800:  #1E293B;
    --brand-slate-700:  #334155;
    --brand-slate-200:  #E2E8F0;
    --brand-slate-100:  #F1F5F9;
    --brand-slate-50:   #F8FAFC;
    --brand-green:      #10B981;
    --brand-yellow:     #F59E0B;
    --brand-red:        #DC2626;
}

html, body {
    height: 100%;
    margin: 0;
    background: var(--brand-slate-50);
    color: var(--brand-slate-900);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Tajawal in both RTL and LTR — matches CRM convention so the SuperAdmin
   feels visually consistent with the rest of the Nova suite. */
body {
    font-family: 'Tajawal', 'Segoe UI', 'Cairo', Tahoma, Arial, sans-serif;
}

/* ─── App shell: rail + main column ─────────────────────────────────────── */

.np-shell {
    display: grid;
    grid-template-columns: 260px 1fr;     /* was 76px — matches CRM sidebar */
    min-height: 100vh;
}

.np-rail {
    background: var(--brand-slate-900);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
    border-inline-end: 1px solid var(--brand-slate-800);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.np-rail-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 1rem;
    text-decoration: none;
    color: white;
}

.np-rail-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.np-rail-brand-title {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -.5px;
    color: white;
}
.np-rail-brand-title span { color: var(--brand-orange); }

.np-rail-brand-subtitle {
    color: #94a3b8;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-top: .15rem;
}

.np-brand-mark {
    display: grid;
    place-items: center;
    width: 40px; height: 40px;
    border-radius: 11px;
    background: var(--brand-orange);
    color: white;
    font-weight: 800;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.np-rail-nav {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: 0;
}

.np-rail-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1.5rem;
    text-decoration: none;
    color: rgba(255,255,255,.7);
    font-size: .95rem;
    font-weight: 500;
    transition: background 120ms, color 120ms;
    position: relative;
}
.np-rail-link:hover {
    background: rgba(249, 115, 22, .08);
    color: white;
}
.np-rail-link.nav-active {
    background: linear-gradient(90deg, rgba(249,115,22,.15) 0%, transparent 100%);
    color: var(--brand-orange);
}
[dir="rtl"] .np-rail-link.nav-active {
    background: linear-gradient(270deg, rgba(249,115,22,.15) 0%, transparent 100%);
}
.np-rail-link.nav-active::before {
    content: "";
    position: absolute;
    inset-inline-end: 0;
    top: 0; bottom: 0;
    width: 3px;
    background: var(--brand-orange);
}

.np-icon {
    font-size: 1.15rem;
    line-height: 1;
    width: 22px;
    text-align: center;
}

/* ─── Top bar ───────────────────────────────────────────────────────────── */

.np-main {
    display: flex;
    flex-direction: column;
    min-width: 0;       /* allow children to shrink */
}

.np-topbar {
    height: 64px;
    background: white;
    border-bottom: 1px solid var(--brand-slate-200);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.np-topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand-slate-900);
    margin: 0;
}

.np-topbar-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.np-locale-toggle {
    border: 1px solid var(--brand-slate-200);
    background: white;
    color: var(--brand-slate-700);
    padding: .45rem .85rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: .05em;
}
.np-locale-toggle:hover { border-color: var(--brand-orange); color: var(--brand-orange); }

.np-profile {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .4rem .9rem;
    background: var(--brand-slate-50);
    border-radius: 999px;
}
.np-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-orange) 0%, var(--brand-orange-600) 100%);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .9rem;
}
.np-profile-text { line-height: 1.25; }
.np-profile-name {
    font-size: .92rem;
    font-weight: 600;
    color: var(--brand-slate-900);
}
.np-profile-sub {
    font-size: .72rem;
    color: var(--brand-slate-700);
}

.np-btn-secondary {
    border: 1px solid var(--brand-slate-200);
    background: white;
    color: var(--brand-slate-700);
    padding: .45rem .95rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
}
.np-btn-secondary:hover { background: var(--brand-slate-50); }

.np-content { padding: 1.75rem 2rem; flex: 1; }

/* ─── Page headers ──────────────────────────────────────────────────────── */

.np-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.np-page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--brand-slate-900);
    letter-spacing: -.02em;
}

.np-page-subtitle {
    color: var(--brand-slate-700);
    font-size: .95rem;
    margin-top: .35rem;
}

/* ─── Stat cards (matches CRM SuperAdmin look) ──────────────────────────── */

.np-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.np-stat-card {
    background: white;
    border: 1px solid var(--brand-slate-200);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    border-inline-end: 3px solid var(--brand-slate-200);
}
.np-stat-card.is-success { border-inline-end-color: var(--brand-green); }
.np-stat-card.is-warning { border-inline-end-color: var(--brand-yellow); }
.np-stat-card.is-danger  { border-inline-end-color: var(--brand-red); }
.np-stat-card.is-brand   { border-inline-end-color: var(--brand-orange); }

.np-stat-label {
    color: var(--brand-slate-700);
    font-size: .9rem;
    font-weight: 500;
}
.np-stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    margin-top: .35rem;
    color: var(--brand-slate-900);
    line-height: 1;
}
.np-stat-value.is-success { color: var(--brand-green); }
.np-stat-value.is-warning { color: #92400E; }
.np-stat-value.is-danger  { color: var(--brand-red); }
.np-stat-value.is-brand   { color: var(--brand-orange-600); }

.np-stat-foot {
    color: var(--brand-slate-700);
    font-size: .82rem;
    margin-top: .4rem;
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */

.np-card {
    background: white;
    border: 1px solid var(--brand-slate-200);
    border-radius: 12px;
    overflow: hidden;
}

.np-card-header {
    padding: .9rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--brand-slate-200);
    font-weight: 600;
    font-size: 1rem;
}

.np-card-body { padding: 1.5rem; }

/* ─── Tables ────────────────────────────────────────────────────────────── */

.np-table {
    width: 100%;
    border-collapse: collapse;
}
.np-table thead {
    background: var(--brand-slate-50);
}
.np-table th {
    text-align: start;
    padding: .85rem 1.25rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--brand-slate-700);
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid var(--brand-slate-200);
    white-space: nowrap;
}
.np-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--brand-slate-100);
    font-size: .95rem;
}
.np-table tbody tr:hover { background: var(--brand-slate-50); }
.np-table tbody tr:last-child td { border-bottom: 0; }

.np-table code {
    background: var(--brand-slate-100);
    padding: .2rem .5rem;
    border-radius: 4px;
    color: var(--brand-slate-900);
    font-size: .88em;
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */

.np-btn-primary {
    background: var(--brand-orange);
    color: white;
    border: none;
    padding: .6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    font-size: .95rem;
}
.np-btn-primary:hover { background: var(--brand-orange-600); color: white; }

.np-btn-ghost {
    background: transparent;
    color: var(--brand-slate-700);
    border: 1px solid var(--brand-slate-200);
    padding: .5rem 1rem;
    border-radius: 8px;
    font-size: .9rem;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
}
.np-btn-ghost:hover {
    background: var(--brand-slate-50);
    color: var(--brand-slate-900);
}

.np-btn-danger {
    color: var(--brand-red);
    border: 1px solid var(--brand-red);
    background: white;
    padding: .5rem 1rem;
    border-radius: 8px;
    font-size: .9rem;
    cursor: pointer;
}
.np-btn-danger:hover { background: var(--brand-red); color: white; }

/* ─── Badges ────────────────────────────────────────────────────────────── */

.np-badge {
    display: inline-block;
    padding: .2rem .7rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .02em;
}
.np-badge.is-success  { background: #D1FAE5; color: #065F46; }
.np-badge.is-warning  { background: #FEF3C7; color: #92400E; }
.np-badge.is-danger   { background: #FEE2E2; color: #991B1B; }
.np-badge.is-secondary{ background: #E5E7EB; color: #374151; }
.np-badge.is-info     { background: #DBEAFE; color: #1E40AF; }

/* ─── Forms ─────────────────────────────────────────────────────────────── */

.np-form .form-control,
.np-form .form-select {
    border: 1px solid var(--brand-slate-200);
    border-radius: 8px;
    padding: .6rem .85rem;
    font-size: .95rem;
    font-family: inherit;
}
.np-form .form-control:focus,
.np-form .form-select:focus {
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 .2rem rgba(249, 115, 22, .15);
}
.np-form label.form-label {
    font-size: .88rem;
    font-weight: 600;
    color: var(--brand-slate-700);
    margin-bottom: .4rem;
}
.np-form .form-text {
    color: var(--brand-slate-700);
    font-size: .82rem;
    margin-top: .35rem;
}
.np-form .input-group-text {
    background: var(--brand-slate-100);
    border: 1px solid var(--brand-slate-200);
    color: var(--brand-slate-700);
    font-size: .9rem;
}

/* ─── Alerts ────────────────────────────────────────────────────────────── */

.np-alert {
    border-radius: 10px;
    padding: .75rem 1rem;
    font-size: .9rem;
    margin-bottom: 1rem;
}
.np-alert.is-success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.np-alert.is-danger  { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.np-alert.is-info    { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }
.np-alert.is-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }

/* ─── Login (separate layout, no rail) ──────────────────────────────────── */

.np-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand-slate-900) 0%, var(--brand-slate-800) 100%);
}
.np-login-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.np-login-brand {
    display: flex; align-items: center; gap: .75rem;
    margin-bottom: .25rem;
}
.np-login-brand .np-brand-mark { width: 36px; height: 36px; font-size: 1.05rem; border-radius: 10px; }
.np-login-brand-text {
    font-size: 1.1rem; font-weight: 700;
}
.np-login-subtitle {
    color: var(--brand-slate-700);
    font-size: .85rem;
    margin-bottom: 1.5rem;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 992px) {
    .np-shell { grid-template-columns: 72px 1fr; }
    .np-rail-brand-text,
    .np-rail-link span:not(.np-icon) { display: none; }
    .np-rail-brand { justify-content: center; padding: 0 0 1rem; }
    .np-rail-link { justify-content: center; padding: .8rem 0; }
    .np-rail-link.nav-active::before { display: none; }
}

@media (max-width: 768px) {
    .np-topbar { padding: 0 1rem; height: 56px; }
    .np-topbar-title { font-size: 1rem; }
    .np-content { padding: 1rem; }
    .np-profile-text { display: none; }
    .np-profile { padding: .35rem .55rem; }
}
