/* ═══════════════════════════════════════════════════════════════
   MUDARIX — Design System v2
   Brand: Navy #1B3A5C / Orange #F5811F
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --primary:        #1B3A5C;
    --primary-hover:  #14304D;
    --primary-light:  #2C5A8C;
    --primary-50:     rgba(27, 58, 92, 0.06);
    --primary-100:    rgba(27, 58, 92, 0.12);
    --accent:         #F5811F;
    --accent-hover:   #E06F0D;
    --accent-light:   #FFAD5C;
    --success:        #10b981;
    --success-light:  #d1fae5;
    --warning:        #f59e0b;
    --warning-light:  #fef3c7;
    --danger:         #ef4444;
    --danger-hover:   #dc2626;
    --danger-light:   #fee2e2;
    --info:           #3b82f6;
    --info-light:     #dbeafe;

    --bg-body:        #f0f4f8;
    --bg-surface:     #ffffff;
    --bg-card:        #ffffff;
    --bg-input:       #ffffff;
    --bg-sidebar:     #ffffff;
    --bg-navbar:      #1B3A5C;

    --text-primary:   #1a2332;
    --text-secondary: #4a5568;
    --text-muted:     #8a9ab5;
    --text-on-primary:#ffffff;

    --border:         #e1e8ef;
    --border-light:   #f0f4f8;

    --shadow-sm:      0 1px 3px 0 rgba(27,58,92,0.06);
    --shadow-md:      0 4px 12px -2px rgba(27,58,92,0.08), 0 2px 4px -2px rgba(27,58,92,0.04);
    --shadow-lg:      0 10px 25px -5px rgba(27,58,92,0.1), 0 4px 8px -4px rgba(27,58,92,0.05);
    --shadow-xl:      0 20px 40px -8px rgba(27,58,92,0.12), 0 8px 16px -6px rgba(27,58,92,0.06);
    --shadow-glow:    0 0 24px rgba(245, 129, 31, 0.2);

    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      16px;
    --radius-xl:      24px;

    --sidebar-width:  260px;
    --sidebar-collapsed-width: 72px;
    --navbar-height:  64px;

    --font-family:    'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition:     all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Retail / Store Theme (Teal) ───────────────────────────── */
body.theme-retail {
    --primary:        #1B3A5C;
    --primary-hover:  #14304D;
    --primary-light:  #2C5A8C;
    --primary-50:     rgba(27, 58, 92, 0.06);
    --primary-100:    rgba(27, 58, 92, 0.12);
    --bg-navbar:      #115E59;
}
body.theme-retail .sidebar {
    background: linear-gradient(180deg, #0C3F3B 0%, #115E59 100%);
}
body.theme-retail .sidebar-link.active {
    background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06));
}
body.theme-retail .sidebar-link.active::before {
    background: #5EEAD4;
}
body.theme-retail .sidebar-link.active svg {
    color: #5EEAD4;
}
body.theme-retail .sidebar-group.open .sidebar-group-label svg {
    color: #5EEAD4;
}
body.theme-retail .sidebar-collapse-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}
body.theme-retail .sidebar-search-input:focus {
    border-color: #5EEAD4;
    box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.15);
}
body.theme-retail .navbar {
    background: #115E59;
}
body.theme-retail .navbar-avatar {
    background: linear-gradient(135deg, #1B3A5C, #2C5A8C);
}
body.theme-retail .btn-primary {
    background: linear-gradient(135deg, #1B3A5C, #2C5A8C);
}
body.theme-retail .btn-primary:hover {
    background: linear-gradient(135deg, #14304D, #1B3A5C);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    direction: rtl;
}

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

img { max-width: 100%; display: block; }

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.3; color: var(--text-primary); }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

/* ── Form Elements ─────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-family);
    transition: var(--transition);
    outline: none;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input.is-invalid { border-color: var(--danger); }
.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.35rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-family);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-on-primary);
    box-shadow: var(--shadow-md);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #f87171);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}
.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-hover), var(--danger));
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #34d399);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}
.btn-success:hover {
    background: linear-gradient(135deg, #059669, var(--success));
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #fbbf24);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}
.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, var(--warning));
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover {
    background: var(--primary-50);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-block { width: 100%; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(27, 58, 92, 0.15);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Glass Morphism ────────────────────────────────────────── */
.glass {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(226, 232, 240, 0.6);
}

/* ── Guest Layout ──────────────────────────────────────────── */
.guest-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}
.guest-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(99, 102, 241, 0.04) 0%, transparent 50%),
        var(--bg-body);
}
.guest-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
}
.guest-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.guest-logo h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}
.guest-logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* ── App Layout ────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}
.app-main {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding-top: var(--navbar-height);
    transition: margin 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Prevent layout flash when sidebar is collapsed */
html.sidebar-is-collapsed .app-main {
    margin-right: var(--sidebar-collapsed-width);
}
html.sidebar-is-collapsed .navbar {
    right: var(--sidebar-collapsed-width);
}
html.sidebar-is-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}
.app-content {
    padding: 1rem 1.25rem;
}

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: var(--sidebar-width);
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 40;
    background: var(--bg-navbar);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
}
.navbar-toggle:hover { color: #ffffff; }
.navbar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
}
.navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}
.navbar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: #fff;
    box-shadow: 0 2px 8px rgba(27, 58, 92, 0.2);
}
.navbar-user-info {
    display: flex;
    flex-direction: column;
}
.navbar-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
}
.navbar-user-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}
.navbar-dropdown {
    position: relative;
}
.navbar-dropdown-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
}
.navbar-dropdown-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
}
.navbar-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 180px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: 0.5rem;
    display: none;
    z-index: 100;
}
.navbar-dropdown-menu.show { display: block; }
.navbar-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    font-family: var(--font-family);
}
.navbar-dropdown-item:hover {
    background: var(--primary-50);
    color: var(--text-primary);
}
.navbar-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.35rem 0;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0F2440 0%, #1B3A5C 100%);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: var(--transition);
    overflow-y: auto;
    border-left: none;
}
.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sidebar-logo img {
    height: 32px;
    width: auto;
}
.sidebar-logo-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
}
.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.25rem;
}

/* ── Sidebar Search ─────────────────────────── */
.sidebar-search {
    padding: 0.25rem 0.75rem 1rem;
}
.sidebar-search-input {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 50px;
    background: rgba(255,255,255,0.08);
    font-size: 0.82rem;
    font-family: var(--font-family);
    color: #ffffff;
    outline: none;
    transition: var(--transition);
}
.sidebar-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 129, 31, 0.15);
    background: rgba(255,255,255,0.12);
}
.sidebar-search-input::placeholder {
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
}
.sidebar-search-wrap {
    position: relative;
}
.sidebar-search-icon {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: rgba(255,255,255,0.4);
    pointer-events: none;
}
html[dir="ltr"] .sidebar-search-icon {
    right: auto;
    left: 0.85rem;
}
html[dir="ltr"] .sidebar-search-input {
    padding: 0.6rem 1rem 0.6rem 2.5rem;
}

/* ── Sidebar Nav ─────────────────────────── */
.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0.75rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* ── Sidebar Link ─────────────────────────── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: rgba(255,255,255,0.65);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}
.sidebar-link.active {
    background: linear-gradient(135deg, rgba(245,129,31,0.15), rgba(245,129,31,0.06));
    color: #ffffff;
    font-weight: 600;
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 65%;
    border-radius: 3px;
    background: var(--accent);
}
html[dir="ltr"] .sidebar-link.active::before {
    right: auto;
    left: 0;
}
.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.5;
}
.sidebar-link:hover svg { opacity: 0.85; }
.sidebar-link.active svg { opacity: 1; color: var(--accent); }

/* ── Sub Links (inside groups) ─────────────────── */
.sidebar-link.sub {
    padding: 0.45rem 2.75rem 0.45rem 0.75rem;
    font-size: 0.82rem;
    gap: 0;
}
html[dir="ltr"] .sidebar-link.sub {
    padding: 0.45rem 0.75rem 0.45rem 2.75rem;
}
.sidebar-link.sub::after {
    content: '';
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transition: var(--transition);
}
html[dir="ltr"] .sidebar-link.sub::after {
    right: auto;
    left: 1.25rem;
}
.sidebar-link.sub:hover::after { background: rgba(255,255,255,0.5); }
.sidebar-link.sub.active::after { background: var(--accent); }
.sidebar-link.sub.active::before { display: none; }

/* ── Collapsible Groups ─────────────────────────── */
.sidebar-group {
    margin-bottom: 2px;
}
.sidebar-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.65);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
}
.sidebar-group-toggle:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}
.sidebar-group-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-group-label svg {
    width: 20px;
    height: 20px;
    opacity: 0.5;
    flex-shrink: 0;
}
.sidebar-group-toggle:hover .sidebar-group-label svg { opacity: 0.85; }
.sidebar-group-arrow {
    width: 16px;
    height: 16px;
    opacity: 0.4;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}
.sidebar-group.open .sidebar-group-arrow {
    transform: rotate(180deg);
    opacity: 0.7;
}
.sidebar-group.open .sidebar-group-toggle {
    color: #ffffff;
}
.sidebar-group.open .sidebar-group-label svg {
    opacity: 0.9;
    color: var(--accent);
}

/* Group items — hidden by default, shown when open */
.sidebar-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-group.open .sidebar-group-items {
    max-height: 600px;
}

/* ── Sidebar Footer ─────────────────────────── */
.sidebar-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
    text-align: center;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
}

/* ── Sidebar Collapse Toggle ───────────────────────────────── */
.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-collapse-btn:hover {
    background: rgba(245,129,31,0.15);
    color: var(--accent);
    transform: scale(1.1);
}
.sidebar-collapse-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

/* ── Collapsed Sidebar State ──────────────────────────────── */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}
.sidebar.collapsed ~ .app-main {
    margin-right: var(--sidebar-collapsed-width);
}
.sidebar.collapsed ~ .navbar,
.sidebar.collapsed + .sidebar-overlay + .app-layout .navbar {
    right: var(--sidebar-collapsed-width);
}
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .sidebar-group-items,
.sidebar.collapsed .sidebar-group-arrow {
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    max-height: 0;
}
.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1rem 0.5rem;
}
.sidebar.collapsed .sidebar-nav {
    padding: 0.75rem 0.5rem;
}
.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 0.75rem;
    gap: 0;
    position: relative;
}
.sidebar.collapsed .sidebar-link.sub {
    display: none;
}
.sidebar.collapsed .sidebar-group-toggle {
    justify-content: center;
    padding: 0.75rem;
}
.sidebar.collapsed .sidebar-group-label {
    gap: 0;
}
.sidebar.collapsed .sidebar-link svg,
.sidebar.collapsed .sidebar-group-label svg {
    width: 22px;
    height: 22px;
}
.sidebar-link-text {
    transition: opacity 0.2s ease, width 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar.collapsed .sidebar-link-text {
    opacity: 0;
    width: 0;
    display: none;
}
/* Rotate collapse arrow */
.sidebar.collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
}
/* Tooltip on hover when collapsed */
.sidebar.collapsed .sidebar-link:hover::after,
.sidebar.collapsed .sidebar-group-toggle:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-primary);
    color: var(--bg-surface);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}





/* ── Flash Alerts ──────────────────────────────────────────── */
.flash-container {
    position: fixed;
    top: calc(var(--navbar-height) + 1rem);
    left: 1.5rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 420px;
    width: 100%;
}
.flash-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    animation: flashIn 0.35s ease-out;
    border: 1px solid transparent;
    box-shadow: var(--shadow-lg);
}
.flash-alert-success {
    background: var(--success-light);
    color: #065f46;
    border-color: #a7f3d0;
}
.flash-alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border-color: #fca5a5;
}
.flash-alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border-color: #fde68a;
}
.flash-alert-info {
    background: var(--info-light);
    color: #1e40af;
    border-color: #93c5fd;
}
.flash-alert-close {
    margin-right: auto;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.6;
    transition: var(--transition);
}
.flash-alert-close:hover { opacity: 1; }

@keyframes flashIn {
    from { transform: translateX(-100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ── Dashboard Stats ───────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.stat-card {
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card:nth-child(1)::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}
.stat-icon-primary { background: var(--primary-50); color: var(--primary); }
.stat-icon-accent  { background: rgba(6, 182, 212, 0.08); color: var(--accent); }
.stat-icon-success { background: rgba(16, 185, 129, 0.08); color: var(--success); }
.stat-icon-warning { background: rgba(245, 158, 11, 0.08); color: var(--warning); }
.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}
.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Welcome Banner ────────────────────────────────────────── */
.welcome-banner {
    border-radius: var(--radius-lg);
    padding: 2rem 2.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, rgba(27,58,92,0.06), rgba(245,129,31,0.04));
    border: 1px solid rgba(27,58,92,0.1);
    position: relative;
    overflow: hidden;
}
.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(245,129,31,0.05) 0%, transparent 70%);
    border-radius: 50%;
}
.welcome-banner h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}
.welcome-banner p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
}

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

/* ── Sidebar Overlay (mobile) ──────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 45;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-overlay.show { display: block; }
    .navbar-toggle { display: block; }

    .app-main { margin-right: 0; }
    .navbar { right: 0; }
    .app-content { padding: 1rem; }

    .navbar-user-info { display: none; }
    .stats-grid { grid-template-columns: 1fr; }
    .guest-card { padding: 1.5rem; }

    .flash-container {
        left: 0.75rem;
        right: 0.75rem;
        max-width: none;
    }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Utility ───────────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-left    { text-align: left; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Password Toggle ───────────────────────────────────────── */
.input-group {
    position: relative;
}
.input-group .form-input { padding-left: 3rem; }
.input-toggle {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
}
.input-toggle:hover { color: var(--text-primary); }

/* ── Divider ───────────────────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}
.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin: 0 auto 1rem;
    opacity: 0.4;
}
.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE — Premium Deep Navy
   ═══════════════════════════════════════════════════════════════ */
.dark {
    --primary:        #6b9fd4;
    --primary-hover:  #5a8ec3;
    --primary-light:  #8bb8e0;
    --primary-50:     rgba(107,159,212,0.08);
    --primary-100:    rgba(107,159,212,0.15);
    --accent:         #FFAD5C;
    --accent-hover:   #F5811F;
    --accent-light:   #FFD4A0;

    --bg-body:        #0c1222;
    --bg-surface:     #131c31;
    --bg-card:        #162036;
    --bg-input:       #1b2844;
    --bg-sidebar:     #0f1829;
    --bg-navbar:      rgba(15, 24, 41, 0.92);

    --text-primary:   #e8ecf4;
    --text-secondary: #a0aec0;
    --text-muted:     #5a6b85;
    --text-on-primary:#ffffff;

    --border:         #1e3050;
    --border-light:   #162036;

    --shadow-sm:      0 1px 3px 0 rgba(0,0,0,0.4);
    --shadow-md:      0 4px 12px -2px rgba(0,0,0,0.5);
    --shadow-lg:      0 10px 25px -5px rgba(0,0,0,0.5);
    --shadow-xl:      0 20px 40px -8px rgba(0,0,0,0.6);
    --shadow-glow:    0 0 25px rgba(245, 129, 31, 0.3);

    --success:        #34d399;
    --success-light:  rgba(52, 211, 153, 0.12);
    --warning:        #fbbf24;
    --warning-light:  rgba(251, 191, 36, 0.12);
    --danger:         #f87171;
    --danger-hover:   #ef4444;
    --danger-light:   rgba(248, 113, 113, 0.12);
    --info:           #60a5fa;
    --info-light:     rgba(96, 165, 250, 0.12);
}

/* ── Dark Glass ──────────────────────────── */
.dark .glass {
    background: rgba(19, 28, 49, 0.9);
    border-color: rgba(30, 48, 80, 0.6);
    backdrop-filter: blur(24px);
}

/* ── Dark Guest Page ─────────────────────── */
.dark .guest-bg {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(27,58,92,0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(245,129,31,0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(107,159,212,0.06) 0%, transparent 50%),
        var(--bg-body);
}
.dark .guest-card {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.6);
}

/* ── Dark Flash Alerts ───────────────────── */
.dark .flash-alert-success { background: rgba(52,211,153,0.12); color: #6ee7b7; border-color: rgba(52,211,153,0.25); }
.dark .flash-alert-error   { background: rgba(248,113,113,0.12); color: #fca5a5; border-color: rgba(248,113,113,0.25); }
.dark .flash-alert-warning { background: rgba(251,191,36,0.12); color: #fde68a; border-color: rgba(251,191,36,0.25); }
.dark .flash-alert-info    { background: rgba(96,165,250,0.12); color: #93c5fd; border-color: rgba(96,165,250,0.25); }

/* ── Dark Sidebar Enhancement ────────────── */
.dark .sidebar {
    border-left-color: var(--border);
    background: linear-gradient(180deg, #0f1829 0%, #0c1222 100%);
}
.dark .sidebar-link:hover {
    background: rgba(107, 159, 212, 0.1);
}
.dark .sidebar-link.active {
    background: linear-gradient(135deg, rgba(107,159,212,0.12), rgba(245,129,31,0.08));
    color: #8bb8e0;
}
.dark .sidebar-link.active::before {
    background: var(--accent);
}
.dark .sidebar-link.active svg { color: var(--accent); }
.dark .sidebar-search-input {
    background: #131c31;
    border-color: #1e3050;
}
.dark .sidebar-search-input:focus {
    border-color: var(--accent);
}

/* ── Dark Navbar Enhancement ─────────────── */
.dark .navbar {
    background: var(--bg-navbar);
    backdrop-filter: blur(12px);
    border-bottom-color: var(--border);
}

/* ── Dark Welcome Banner ─────────────────── */
.dark .welcome-banner {
    background: linear-gradient(135deg, rgba(107,159,212,0.1), rgba(245,129,31,0.06));
    border-color: rgba(107,159,212,0.15);
}

/* ── Dark Stat Cards ─────────────────────── */
.dark .stat-icon-primary { background: rgba(107,159,212,0.12); color: #8bb8e0; }
.dark .stat-icon-accent  { background: rgba(245,129,31,0.12);  color: #FFAD5C; }
.dark .stat-icon-success { background: rgba(52,211,153,0.12);  color: #6ee7b7; }
.dark .stat-icon-warning { background: rgba(251,191,36,0.12);  color: #fde68a; }

/* ── Dark Scrollbar ──────────────────────── */
.dark ::-webkit-scrollbar-track { background: var(--bg-body); }
.dark ::-webkit-scrollbar-thumb { background: #1e3050; }
.dark ::-webkit-scrollbar-thumb:hover { background: #2a4060; }

/* ── Dark Cards Subtle Glow ──────────────── */
.dark .card:hover {
    box-shadow: 0 4px 20px -4px rgba(245, 129, 31, 0.1);
    border-color: rgba(107, 159, 212, 0.2);
}

/* ── Dark Mode: Comprehensive Form & Card Overrides ─── */

/* All white backgrounds → navy card surface */
.dark .bg-white { background-color: #162036 !important; }
.dark .bg-gray-50,
.dark .bg-slate-50 { background-color: #131c31 !important; }

/* Border colors */
.dark .border-slate-200,
.dark .border-slate-100,
.dark .border-gray-200,
.dark .border-gray-300 { border-color: #1e3050 !important; }

/* Text colors for dark mode */
.dark .text-slate-800,
.dark .text-gray-800,
.dark .text-gray-900,
.dark .text-slate-700 { color: #e8ecf4 !important; }
.dark .text-slate-600,
.dark .text-gray-600,
.dark .text-slate-500,
.dark .text-gray-500 { color: #a0aec0 !important; }
.dark .text-slate-400,
.dark .text-gray-400 { color: #6b7fa0 !important; }

/* Dark form inputs, selects, textareas */
.dark input[type="text"],
.dark input[type="number"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="search"],
.dark input[type="tel"],
.dark input[type="url"],
.dark input[type="date"],
.dark select,
.dark textarea {
    background-color: #1b2844 !important;
    border-color: #1e3050 !important;
    color: #e8ecf4 !important;
}
.dark input::placeholder,
.dark textarea::placeholder {
    color: #5a6b85 !important;
}
.dark input:focus,
.dark select:focus,
.dark textarea:focus {
    border-color: #F5811F !important;
    box-shadow: 0 0 0 3px rgba(245, 129, 31, 0.15) !important;
}

/* Dark tables */
.dark table thead tr { border-color: #1e3050 !important; }
.dark table thead th { color: #a0aec0 !important; }
.dark table tbody tr { border-color: #162036 !important; }
.dark table tbody tr:hover { background-color: rgba(129, 140, 248, 0.06) !important; }
.dark table tbody td { color: #c8d2e0 !important; }

/* Stat card values in dark mode */
.dark .stat-value { color: #e8ecf4 !important; }
.dark .stat-label { color: #a0aec0 !important; }

/* Dark hover backgrounds */
.dark .hover\:bg-gray-100:hover,
.dark .hover\:bg-slate-100:hover,
.dark .hover\:bg-gray-50:hover { background-color: rgba(129, 140, 248, 0.08) !important; }

/* Select option styling */
.dark select option {
    background-color: #1b2844;
    color: #e8ecf4;
}

/* Badge overrides in dark mode */
.dark .bg-green-100 { background-color: rgba(52, 211, 153, 0.15) !important; }
.dark .text-green-800 { color: #6ee7b7 !important; }
.dark .bg-red-100 { background-color: rgba(248, 113, 113, 0.15) !important; }
.dark .text-red-800 { color: #fca5a5 !important; }
.dark .bg-yellow-100 { background-color: rgba(251, 191, 36, 0.15) !important; }
.dark .text-yellow-800 { color: #fde68a !important; }
.dark .bg-blue-100 { background-color: rgba(96, 165, 250, 0.15) !important; }
.dark .text-blue-800 { color: #93c5fd !important; }
.dark .bg-indigo-100,
.dark .bg-brand-100 { background-color: rgba(27, 58, 92, 0.15) !important; }
.dark .text-indigo-800,
.dark .text-brand-800 { color: #b0cce0 !important; }

/* Dark dashboard comparison table */
.dark .bg-slate-100,
.dark .bg-gray-100 { background-color: #131c31 !important; }
.dark .bg-indigo-50,
.dark .bg-brand-50 { background-color: rgba(27, 58, 92, 0.08) !important; }

/* ═══════════════════════════════════════════════════════════════
   LTR SUPPORT (English)
   ═══════════════════════════════════════════════════════════════ */
html[dir="ltr"] body { direction: ltr; }
html[dir="ltr"] .sidebar {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid var(--border);
}
html[dir="ltr"] .app-main {
    margin-right: 0;
    margin-left: var(--sidebar-width);
}
html[dir="ltr"] .navbar {
    right: 0;
    left: var(--sidebar-width);
}
html[dir="ltr"] .flash-container {
    left: auto;
    right: 1.5rem;
}
html[dir="ltr"] .input-group .form-input { padding-left: auto; padding-right: 3rem; }
html[dir="ltr"] .input-toggle { left: auto; right: 0.75rem; }

@media (max-width: 768px) {
    html[dir="ltr"] .sidebar { transform: translateX(-100%); }
    html[dir="ltr"] .sidebar.open { transform: translateX(0); }
    html[dir="ltr"] .app-main { margin-left: 0; }
    html[dir="ltr"] .navbar { left: 0; }
}

/* ── Flash Alerts ──────────────────────────────────────────── */
.flash-container {
    position: fixed;
    top: calc(var(--navbar-height) + 12px);
    left: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 420px;
}
.flash-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-family);
    box-shadow: var(--shadow-lg);
    animation: flashSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.flash-alert-success {
    background: var(--success-light);
    color: #065f46;
    border: 1.5px solid var(--success);
}
.flash-alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border: 1.5px solid var(--danger);
}
.flash-alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1.5px solid var(--warning);
}
.flash-alert-info {
    background: var(--info-light);
    color: #1e40af;
    border: 1.5px solid var(--info);
}
.flash-alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0 0.25rem;
    margin-right: auto;
    transition: var(--transition);
}
html[dir="ltr"] .flash-alert-close {
    margin-right: 0;
    margin-left: auto;
}
.flash-alert-close:hover { opacity: 1; }

@keyframes flashSlideIn {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}
