/* ═══════════════════════════════════════════════════════════════
   THE CLUB ERP — Premium UI System
   Designed for Arabic RTL-first, built with CSS custom properties,
   animations, glassmorphism, and micro-interactions.
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
    /* Brand Colors */
    --brand-primary: #0D7377;
    --brand-primary-light: #14b8a6;
    --brand-primary-dark: #0a5c5f;
    --brand-primary-rgb: 13, 115, 119;
    --brand-accent: #6366f1;
    --brand-accent-rgb: 99, 102, 241;

    /* Sidebar */
    --sidebar-bg: #0f0f1a;
    --sidebar-width: 270px;
    --sidebar-item-hover: rgba(255, 255, 255, 0.06);
    --sidebar-item-active: rgba(13, 115, 119, 0.15);
    --sidebar-border: rgba(255, 255, 255, 0.06);

    /* Surfaces */
    --surface-bg: #f8fafc;
    --surface-card: #ffffff;
    --surface-raised: #ffffff;
    --surface-overlay: rgba(15, 15, 26, 0.6);

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #f8fafc;

    /* Borders */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-focus: var(--brand-primary);

    /* Status Colors */
    --success: #059669;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;
    --info: #0284c7;
    --info-bg: #eff6ff;
    --info-border: #bfdbfe;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(var(--brand-primary-rgb), 0.15);
    --shadow-card-hover: 0 20px 40px -12px rgba(0, 0, 0, 0.12);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Z-indexes */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 500;
    --z-modal: 600;
    --z-toast: 700;
    --z-sidebar: 800;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Cairo', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface-bg);
    direction: rtl;
    line-height: 1.7;
    overflow-x: hidden;
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color var(--duration-fast) ease;
}

a:hover {
    color: var(--brand-primary-dark);
}

code {
    background: var(--surface-bg);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    border: 1px solid var(--border-light);
}

::selection {
    background: rgba(var(--brand-primary-rgb), 0.15);
    color: var(--brand-primary-dark);
}

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

/* ══════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: #e2e8f0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: var(--z-sidebar);
    transition: width var(--duration-slow) var(--ease-out),
                transform var(--duration-slow) var(--ease-out);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
}

.sidebar.collapsed {
    width: 0;
    transform: translateX(var(--sidebar-width));
}

/* Sidebar Header */
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.sidebar-brand {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--brand-primary-light), #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-logo {
    max-height: 36px;
    max-width: 180px;
    object-fit: contain;
    transition: opacity var(--duration-normal) ease;
}

.sidebar-logo:hover {
    opacity: 0.85;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: color var(--duration-fast) ease;
}

.sidebar-toggle:hover {
    color: #fff;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0 60px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Sidebar Section Labels */
.sidebar-section-label {
    padding: 20px 20px 8px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(184, 197, 212, 0.7);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.sidebar-item {
    margin: 1px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #b8c5d4;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    transition: all var(--duration-normal) var(--ease-out);
    border-radius: var(--radius-md);
    position: relative;
}

.sidebar-link:hover {
    background: var(--sidebar-item-hover);
    color: #e2e8f0;
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--sidebar-item-active);
    color: var(--brand-primary-light);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--brand-primary-light);
    border-radius: var(--radius-full);
}

/* Sidebar Icon */
.sidebar-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity var(--duration-fast) ease;
}

.sidebar-link:hover .sidebar-icon,
.sidebar-link.active .sidebar-icon {
    opacity: 1;
}

.sidebar-icon svg,
.sidebar-icon i {
    width: 18px;
    height: 18px;
    stroke-width: 1.75;
}

.sidebar-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar Arrow */
.sidebar-arrow {
    display: flex;
    align-items: center;
    transition: transform var(--duration-normal) var(--ease-out);
    color: rgba(148, 163, 184, 0.4);
}

.sidebar-arrow svg {
    width: 16px;
    height: 16px;
}

.sidebar-item.open > .sidebar-link .sidebar-arrow {
    transform: rotate(-90deg);
}

/* Sidebar Submenu */
.sidebar-submenu {
    list-style: none;
    padding: 2px 0 6px;
    margin: 0;
    overflow: hidden;
}

.sidebar-submenu li {
    margin: 0 4px;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px 7px 16px;
    margin-right: 28px;
    color: rgba(184, 197, 212, 0.8);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--duration-normal) var(--ease-out);
    border-radius: var(--radius-sm);
    border-right: 2px solid transparent;
}

.sidebar-sublink:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.03);
    text-decoration: none;
}

.sidebar-sublink.active {
    color: var(--brand-primary-light);
    border-right-color: var(--brand-primary-light);
    font-weight: 600;
}

.sidebar-sublink::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
    flex-shrink: 0;
}

.sidebar-sublink:hover::before,
.sidebar-sublink.active::before {
    opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   MAIN WRAPPER
   ══════════════════════════════════════════════════ */
.main-wrapper {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-right var(--duration-slow) var(--ease-out);
    background: var(--surface-bg);
}

.main-wrapper.sidebar-collapsed {
    margin-right: 0;
}

/* ══════════════════════════════════════════════════
   TOP HEADER
   ══════════════════════════════════════════════════ */
.top-header {
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--border-light);
    padding: 0 28px;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    transition: box-shadow var(--duration-normal) ease;
}

.top-header.scrolled {
    box-shadow: var(--shadow-md);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.header-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.header-user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.header-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: all var(--duration-fast) ease;
    text-decoration: none;
}

.header-logout:hover {
    background: var(--danger-bg);
    color: var(--danger);
    text-decoration: none;
}

.sidebar-toggle-btn {
    background: none;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--duration-fast) ease;
}

.sidebar-toggle-btn:hover {
    background: var(--surface-bg);
    border-color: var(--border-medium);
}

/* ══════════════════════════════════════════════════
   PAGE CONTENT
   ══════════════════════════════════════════════════ */
.page-content {
    flex: 1;
    padding: 28px;
}

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

/* ══════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════ */
.page-footer {
    padding: 16px 28px;
    background: var(--surface-card);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

/* ══════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════ */
.card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 0;
    overflow: visible;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(248, 250, 252, 0.5), transparent);
}

.card-header h2,
.card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background: rgba(248, 250, 252, 0.5);
}

/* Interactive Card */
.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    border-color: rgba(var(--brand-primary-rgb), 0.3);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

/* ══════════════════════════════════════════════════
   STATS CARDS
   ══════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stats-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 3px;
    border-radius: var(--radius-full);
    transition: height var(--duration-normal) var(--ease-out);
}

.stats-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stats-card:hover::before {
    height: 4px;
}

.stats-card-primary::before { background: linear-gradient(90deg, var(--brand-primary), var(--brand-primary-light)); }
.stats-card-success::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stats-card-danger::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.stats-card-warning::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }

.stats-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--duration-normal) var(--ease-spring);
}

.stats-card:hover .stats-card-icon {
    transform: scale(1.1);
}

.stats-card-primary .stats-card-icon { background: rgba(var(--brand-primary-rgb), 0.1); color: var(--brand-primary); }
.stats-card-success .stats-card-icon { background: rgba(5, 150, 105, 0.1); color: var(--success); }
.stats-card-danger .stats-card-icon { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.stats-card-warning .stats-card-icon { background: rgba(217, 119, 6, 0.1); color: var(--warning); }

.stats-card-icon svg {
    width: 24px;
    height: 24px;
}

.stats-card-content {
    flex: 1;
    min-width: 0;
}

.stats-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stats-card-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stats-card-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.stats-card-change.positive {
    color: var(--success);
    background: var(--success-bg);
}

.stats-card-change.negative {
    color: var(--danger);
    background: var(--danger-bg);
}

.stats-card-link {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 24px;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-primary);
    text-align: center;
    border-top: 1px solid var(--border-light);
    transition: all var(--duration-fast) ease;
    opacity: 0;
    transform: translateY(100%);
}

.stats-card:hover .stats-card-link {
    opacity: 1;
    transform: translateY(0);
    background: rgba(var(--brand-primary-rgb), 0.04);
}

/* ══════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════ */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table thead th {
    padding: 14px 18px;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--surface-bg);
    border-bottom: 2px solid var(--border-light);
}

.data-table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    text-align: right;
    color: var(--text-secondary);
    transition: background var(--duration-fast) ease;
}

.data-table tbody tr:hover {
    background: rgba(var(--brand-primary-rgb), 0.03);
}

.data-table tbody tr:hover td {
    color: var(--text-primary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.actions-col {
    width: 1%;
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ══════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--duration-normal) var(--ease-out);
    white-space: nowrap;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    line-height: 1.5;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--duration-fast) ease;
}

.btn:hover::after {
    opacity: 1;
}

.btn:active {
    transform: scale(0.97);
}

/* Button ripple effect */
.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Button Variants */
.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--brand-primary-rgb), 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(var(--brand-primary-rgb), 0.4);
    transform: translateY(-1px);
    text-decoration: none;
    color: #fff;
}

.btn-secondary {
    background: var(--surface-bg);
    color: var(--text-secondary);
    border-color: var(--border-light);
}

.btn-secondary:hover {
    background: var(--border-light);
    color: var(--text-primary);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--brand-primary);
    border-color: var(--border-light);
}

.btn-outline:hover {
    background: rgba(var(--brand-primary-rgb), 0.06);
    border-color: var(--brand-primary);
    text-decoration: none;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    color: #fff;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.4);
    transform: translateY(-1px);
    text-decoration: none;
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #047857);
    color: #fff;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.btn-success:hover {
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.4);
    transform: translateY(-1px);
    text-decoration: none;
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--surface-bg);
    color: var(--text-primary);
    text-decoration: none;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
    border-radius: var(--radius-md);
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

.btn-icon.btn-sm {
    width: 30px;
    height: 30px;
    padding: 6px;
}

/* Loading button */
.btn.loading {
    color: transparent;
    pointer-events: none;
    position: relative;
}

.btn.loading::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color var(--duration-fast) ease;
}

.form-group:focus-within .form-label {
    color: var(--brand-primary);
}

.required-mark {
    color: var(--danger);
    margin-right: 2px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface-card);
    color: var(--text-primary);
    transition: all var(--duration-normal) var(--ease-out);
    box-sizing: border-box;
    line-height: 1.5;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--border-medium);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.1),
                var(--shadow-sm);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}

.form-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: shakeX 0.4s ease;
}

@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.has-error .form-input,
.has-error .form-select,
.has-error .form-textarea {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Checkbox & Radio */
.checkbox-label,
.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 4px 0;
    transition: color var(--duration-fast) ease;
}

.checkbox-label:hover,
.radio-label:hover {
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

/* File input */
.form-input[type="file"] {
    padding: 8px;
    cursor: pointer;
}

.form-input[type="file"]::file-selector-button {
    padding: 6px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--surface-bg);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 10px;
    transition: all var(--duration-fast) ease;
}

.form-input[type="file"]::file-selector-button:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Form Section */
.form-section {
    margin-bottom: 32px;
}

.form-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ══════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════ */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin: 0 28px 16px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    animation: alertSlideIn var(--duration-slow) var(--ease-out);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-icon svg {
    width: 20px;
    height: 20px;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success-border);
}
.alert-success::before { background: var(--success); }

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger-border);
}
.alert-error::before { background: var(--danger); }

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: var(--warning-border);
}
.alert-warning::before { background: var(--warning); }

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: var(--info-border);
}
.alert-info::before { background: var(--info); }

.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: inherit;
    opacity: 0.5;
    transition: all var(--duration-fast) ease;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}

.alert-close svg {
    width: 16px;
    height: 16px;
}

/* Alert dismissing animation */
.alert.dismissing {
    animation: alertDismiss var(--duration-normal) var(--ease-out) forwards;
}

@keyframes alertDismiss {
    to {
        opacity: 0;
        transform: translateX(20px);
        height: 0;
        padding: 0;
        margin: 0;
        border: 0;
    }
}

/* ══════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════ */
#toast-container {
    position: fixed;
    top: 80px;
    left: 28px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 400px;
}

.toast {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    box-shadow: var(--shadow-xl);
    animation: toastSlideIn var(--duration-slow) var(--ease-spring);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: toastProgress 5s linear forwards;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(-40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.toast.removing {
    animation: toastSlideOut var(--duration-normal) var(--ease-out) forwards;
}

@keyframes toastSlideOut {
    to {
        opacity: 0;
        transform: translateX(-40px) scale(0.95);
    }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    width: 20px;
    height: 20px;
}

.toast-info {
    background: rgba(2, 132, 199, 0.95);
    color: #fff;
    border-color: rgba(2, 132, 199, 0.3);
}

.toast-success {
    background: rgba(5, 150, 105, 0.95);
    color: #fff;
    border-color: rgba(5, 150, 105, 0.3);
}

.toast-error {
    background: rgba(220, 38, 38, 0.95);
    color: #fff;
    border-color: rgba(220, 38, 38, 0.3);
}

.toast-warning {
    background: rgba(217, 119, 6, 0.95);
    color: #fff;
    border-color: rgba(217, 119, 6, 0.3);
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 4px;
    margin-right: auto;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) ease;
}

.toast-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

/* ══════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 26, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: overlayFadeIn var(--duration-normal) ease;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--surface-card);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalScaleIn var(--duration-slow) var(--ease-spring);
}

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

.modal-small { max-width: 420px; }
.modal-medium { max-width: 600px; }
.modal-large { max-width: 900px; }
.modal-fullscreen { max-width: 95vw; max-height: 95vh; }

.modal-header {
    padding: 24px 28px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) ease;
}

.modal-close:hover {
    background: var(--surface-bg);
    color: var(--text-primary);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   BREADCRUMBS
   ══════════════════════════════════════════════════ */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 20px;
    font-size: 13px;
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color var(--duration-fast) ease;
}

.breadcrumb-item:hover {
    color: var(--brand-primary);
    text-decoration: none;
}

.breadcrumb-item.current {
    color: var(--text-primary);
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--text-muted);
    opacity: 0.4;
    font-size: 12px;
}

/* ══════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════ */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--duration-fast) ease;
    border: 1px solid transparent;
}

.page-link:hover {
    background: var(--surface-bg);
    border-color: var(--border-light);
    color: var(--text-primary);
    text-decoration: none;
}

.page-link.active {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(var(--brand-primary-rgb), 0.3);
}

.page-ellipsis {
    color: var(--text-muted);
    padding: 0 4px;
}

/* ══════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    animation: fadeInUp var(--duration-slow) var(--ease-out);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface-bg);
    border: 2px dashed var(--border-light);
    color: var(--text-muted);
    animation: emptyBounce 2s ease-in-out infinite;
}

.empty-state-icon svg {
    width: 32px;
    height: 32px;
}

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

.empty-state-message {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ══════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════ */
.tabs-container {
    margin-bottom: 24px;
}

.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-light);
    overflow-x: auto;
}

.tab-link {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--duration-normal) ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-link:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.tab-link.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
    font-weight: 600;
}

.tab-content {
    display: none;
    animation: fadeInUp var(--duration-normal) var(--ease-out);
}

.tab-content.active {
    display: block;
}

/* ══════════════════════════════════════════════════
   BADGES & TAGS
   ══════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.badge-primary { background: rgba(var(--brand-primary-rgb), 0.1); color: var(--brand-primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--surface-bg); color: var(--text-secondary); }

/* ══════════════════════════════════════════════════
   LOADING STATES
   ══════════════════════════════════════════════════ */

/* Page loading overlay */
.page-loading {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity var(--duration-normal) ease;
}

.page-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    display: flex;
    gap: 6px;
}

.loader-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--brand-primary);
    animation: loaderBounce 1.4s ease-in-out infinite both;
}

.loader-dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dot:nth-child(2) { animation-delay: -0.16s; }
.loader-dot:nth-child(3) { animation-delay: 0s; }

@keyframes loaderBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--border-light);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, #e8ecf1 37%, var(--border-light) 63%);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); }

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ══════════════════════════════════════════════════
   TOPBAR (header.php component)
   ══════════════════════════════════════════════════ */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) ease;
    position: relative;
}

.topbar-btn:hover {
    background: var(--surface-bg);
    color: var(--text-primary);
}

.topbar-search-input {
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    font-size: 13px;
    font-family: inherit;
    width: 260px;
    background: var(--surface-bg);
    color: var(--text-primary);
    transition: all var(--duration-normal) var(--ease-out);
}

.topbar-search-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.1);
    width: 320px;
    background: var(--surface-card);
}

.topbar-date {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.topbar-branch {
    font-size: 12px;
    color: var(--brand-primary);
    font-weight: 600;
    padding: 4px 10px;
    background: rgba(var(--brand-primary-rgb), 0.08);
    border-radius: var(--radius-full);
}

.topbar-notifications {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-logout {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) ease;
    text-decoration: none;
}

.topbar-logout:hover {
    background: var(--danger-bg);
    color: var(--danger);
    text-decoration: none;
}

/* ══════════════════════════════════════════════════
   UTILITY CLASSES
   ══════════════════════════════════════════════════ */

/* Spacing */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; } .mt-6 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; } .mb-6 { margin-bottom: 32px; }
.p-0 { padding: 0; } .p-3 { padding: 12px; } .p-4 { padding: 16px; } .p-5 { padding: 24px; }

/* Flex */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; }

/* Text */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--brand-primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.text-sm { font-size: 12px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; }

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Width */
.w-full { width: 100%; }

/* Truncate */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════════════ */
@media print {
    .sidebar, .top-header, .page-footer, .btn, .sidebar-toggle-btn,
    #toast-container, .no-print {
        display: none !important;
    }
    .main-wrapper {
        margin-right: 0 !important;
    }
    .page-content {
        padding: 0 !important;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    body {
        background: #fff !important;
    }
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(var(--sidebar-width));
        width: var(--sidebar-width);
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
    }
    .main-wrapper {
        margin-right: 0;
    }
    .sidebar-toggle-btn {
        display: flex;
    }
    .page-content {
        padding: 20px;
    }
    .form-grid-2,
    .form-grid-3,
    .form-grid-4 {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    .topbar-search-input {
        width: 180px;
    }
    .topbar-search-input:focus {
        width: 220px;
    }
}

@media (max-width: 640px) {
    .page-content {
        padding: 16px;
    }
    .top-header {
        padding: 0 16px;
    }
    .alert {
        margin: 0 16px 12px;
    }
    .pagination-wrapper {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .pagination {
        justify-content: center;
    }
    .modal {
        margin: 12px;
        max-height: calc(100vh - 24px);
    }
    .topbar-search-input {
        display: none;
    }
}

/* ══════════════════════════════════════════════════
   SIDEBAR MOBILE OVERLAY
   ══════════════════════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: calc(var(--z-sidebar) - 1);
    opacity: 0;
    transition: opacity var(--duration-normal) ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ══════════════════════════════════════════════════
   UTILITY CLASSES
   ══════════════════════════════════════════════════ */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-xs { gap: 5px; }
.gap-sm { gap: 10px; }
.gap-md { gap: 15px; }
.gap-lg { gap: 20px; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 13px; }
.text-lg { font-size: 16px; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.ltr { direction: ltr; text-align: right; }
.min-w-120 { min-width: 120px; }
.min-w-250 { min-width: 250px; }
.mb-xs { margin-bottom: 5px; }
.mb-sm { margin-bottom: 10px; }
.mb-md { margin-bottom: 20px; }
.mb-lg { margin-bottom: 30px; }
.mt-sm { margin-top: 10px; }
.mt-md { margin-top: 20px; }
.p-sm { padding: 10px; }
.p-md { padding: 15px; }
.p-lg { padding: 20px; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ══════════════════════════════════════════════════
   PREMIUM ANIMATIONS & MICRO-INTERACTIONS
   ══════════════════════════════════════════════════ */

/* Page content entrance */
.page-content {
    animation: pageEnter var(--duration-slow) var(--ease-out) both;
}
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* Card hover lift — only for interactive/grid cards */
.stats-card,
.card-interactive,
.appear-card {
    transition: transform var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out),
                border-color var(--duration-fast) ease;
}

/* Staggered card entrance */
.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 50ms; }
.card:nth-child(3) { animation-delay: 100ms; }
.card:nth-child(4) { animation-delay: 150ms; }
.card:nth-child(5) { animation-delay: 200ms; }
.card:nth-child(6) { animation-delay: 250ms; }

/* Table row entrance */
.data-table tbody tr {
    animation: rowSlideIn var(--duration-normal) var(--ease-out) both;
}
.data-table tbody tr:nth-child(1) { animation-delay: 0ms; }
.data-table tbody tr:nth-child(2) { animation-delay: 30ms; }
.data-table tbody tr:nth-child(3) { animation-delay: 60ms; }
.data-table tbody tr:nth-child(4) { animation-delay: 90ms; }
.data-table tbody tr:nth-child(5) { animation-delay: 120ms; }
.data-table tbody tr:nth-child(6) { animation-delay: 150ms; }
.data-table tbody tr:nth-child(7) { animation-delay: 180ms; }
.data-table tbody tr:nth-child(8) { animation-delay: 210ms; }
.data-table tbody tr:nth-child(9) { animation-delay: 240ms; }
.data-table tbody tr:nth-child(10) { animation-delay: 270ms; }
@keyframes rowSlideIn {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: none; }
}

/* Table row hover enhancement */
.data-table tbody tr {
    transition: background var(--duration-fast) ease;
}

/* Button ghost/secondary hover lift */
.btn-secondary:hover,
.btn-ghost:hover {
    transform: translateY(-1px);
}

/* Form group label transition on focus */
.form-group:focus-within .form-label {
    transform: translateX(-2px);
}

/* Badge pulse for warning status indicators */
.badge-warning {
    animation: badgePulse 2s ease-in-out infinite;
}

/* Modal backdrop enhancement */
.modal-overlay {
    animation: overlayFadeIn var(--duration-normal) ease both;
}

/* Sidebar item hover slide (RTL: shift content slightly left) */
.sidebar-item {
    transition: background var(--duration-fast) ease,
                padding-left var(--duration-fast) var(--ease-out);
}
.sidebar-item:hover {
    padding-left: 4px;
}

/* Stat card counter animation */
.stat-value {
    transition: color var(--duration-normal) ease;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Focus ring for accessibility */
:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Enhanced card header with subtle gradient */
.card-header {
    position: relative;
}
.card-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--border-light), rgba(var(--brand-primary-rgb), 0.2), var(--border-light));
}

/* Badge border enhancement */
.badge-primary { border: 1px solid rgba(var(--brand-primary-rgb), 0.15); }
.badge-success { border: 1px solid var(--success-border); }
.badge-danger { border: 1px solid var(--danger-border); }
.badge-warning { border: 1px solid var(--warning-border); }
.badge-info { border: 1px solid var(--info-border); }

/* Form section title accent */
.form-section-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--brand-primary);
    border-radius: 2px;
    flex-shrink: 0;
}

/* Pagination active glow */
.page-link.active {
    box-shadow: 0 2px 8px rgba(var(--brand-primary-rgb), 0.35);
}

/* Stats card number font feature */
.stats-card-value {
    font-feature-settings: 'tnum';
}

/* Tabs active indicator glow */
.tab-link.active {
    text-shadow: 0 0 8px rgba(var(--brand-primary-rgb), 0.15);
}

/* Tooltip hover */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    right: 50%;
    transform: translateX(50%) translateY(4px);
    background: #1A1A2E;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-fast) ease, transform var(--duration-fast) ease;
    z-index: var(--z-toast);
}
[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(50%) translateY(0);
}
