/* ==========================================================================
   CSS Variables & Theme
   ========================================================================== */
   :root {
    /* Premium Color Palette */
    --primary: #4F46E5;       /* Indigo */
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    
    --secondary: #10B981;     /* Emerald Green */
    --accent: #F59E0B;        /* Amber */
    --danger: #EF4444;        /* Red */
    
    /* Surface & Background Colors */
    --bg-body: #F3F4F6;
    --bg-surface: #FFFFFF;
    --bg-glass: rgba(255, 255, 255, 0.85);
    
    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-muted: #9CA3AF;
    
    /* Borders & Shadows */
    --border-light: rgba(229, 231, 235, 0.5);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-glass: 0 10px 30px -10px rgba(0,0,0,0.05);
    
    /* Metrics */
    --sidebar-width: 280px;
    --header-height: 70px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
ul { list-style: none; }
button { 
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    border: none;
    background: none;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 100;
    box-shadow: -2px 0 10px rgba(0,0,0,0.02);
    transition: transform var(--transition-normal);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background-color: rgba(79, 70, 229, 0.05);
    color: var(--primary);
    transform: translateX(-4px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(79,70,229,0.1) 0%, rgba(79,70,229,0) 100%);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    font-weight: 700;
    font-size: 14px;
}

.user-info .role {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-logout {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.btn-logout:hover {
    color: var(--danger);
}

/* ==========================================================================
   Main Content
   ========================================================================== */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-search {
    display: flex;
    align-items: center;
    background-color: var(--bg-body);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    width: 350px;
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}

.header-search:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.header-search span {
    color: var(--text-muted);
}

.header-search input {
    border: none;
    background: transparent;
    outline: none;
    padding: 0 12px;
    width: 100%;
    font-family: 'Cairo', sans-serif;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.btn-icon {
    position: relative;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background var(--transition-fast);
}

.btn-icon:hover {
    background-color: rgba(0,0,0,0.05);
}

.notification-btn::after {
    content: attr(data-count);
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-surface);
}

.date-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.03);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
}

.page-content {
    padding: 32px;
    flex: 1;
}

/* ==========================================================================
   Dashboard Components
   ========================================================================== */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-md);
    padding: 32px 40px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 50%;
    height: 200%;
    background: linear-gradient(to right, rgba(255,255,255,0.1), transparent);
    transform: rotate(30deg);
}

.banner-text h2 {
    font-size: 28px;
    margin-bottom: 8px;
}

.banner-text p {
    color: rgba(255,255,255,0.8);
    font-size: 16px;
}

.banner-img {
    height: 120px;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.2));
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.glass-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-glass);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon span {
    font-size: 30px;
}

.box-purple { background: rgba(79, 70, 229, 0.1); color: var(--primary); }
.box-blue { background: rgba(59, 130, 246, 0.1); color: #3B82F6; }
.box-green { background: rgba(16, 185, 129, 0.1); color: var(--secondary); }
.box-red { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.stat-details h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-details .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.btn-text {
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state span {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.chart-placeholder {
    height: 300px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ==========================================================================
   Tables & Data
   ========================================================================== */
.table-container {
    overflow-x: auto;
    margin-top: 24px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.data-table th, .data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    font-weight: 700;
    color: var(--text-secondary);
    background-color: rgba(0,0,0,0.02);
    font-size: 14px;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.02);
}

/* ==========================================================================
   Modals & Forms
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.modal-content {
    width: 100%;
    max-width: 500px;
    background: var(--bg-surface);
    padding: 32px;
    border-radius: var(--radius-md);
    transform: translateY(0);
    transition: transform var(--transition-normal);
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-overlay.hidden .modal-content {
    transform: translateY(20px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    transition: border-color var(--transition-fast);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: rgba(0,0,0,0.05);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.btn-danger:hover {
    background-color: var(--danger);
    color: white;
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.hidden {
    display: none !important;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 800;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%); /* Arabic RTL */
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .header-search {
        display: none;
    }
    
    .welcome-banner {
        flex-direction: column;
        text-align: center;
    }
    
    .banner-img {
        display: none;
    }
}
@media print { .sidebar, .topbar, .btn-primary, .btn-secondary, .btn-danger, .form-group, .card-header button, .card-header select, .nav-item, #reconFilter, #reconSummary { display: none !important; } body { background: white !important; padding: 0 !important; } .main-content { margin: 0 !important; padding: 0 !important; width: 100% !important; } .glass-card { border: none !important; box-shadow: none !important; background: white !important; padding: 0 !important; } .page-section { display: block !important; } .page-section.hidden { display: none !important; } .data-table { width: 100% !important; border-collapse: collapse !important; } .data-table th, .data-table td { border: 1px solid #ddd !important; padding: 8px !important; color: black !important; font-size: 10pt !important; } .data-table th { background-color: #f2f2f2 !important; } .print-header { display: flex !important; justify-content: space-between; align-items: center; border-bottom: 2px solid #673ab7; margin-bottom: 20px; padding-bottom: 10px; } } .print-header { display: none; }
.app-container.auth-hidden { display: none !important; } .login-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, var(--primary-color), #2c3e50); display: flex; align-items: center; justify-content: center; z-index: 10000; transition: opacity 0.5s ease; } .login-card { width: 400px; padding: 2.5rem; text-align: center; } .login-header h1 { margin: 1rem 0 0.5rem 0; font-size: 1.8rem; } .login-header p { color: var(--text-muted); margin-bottom: 2rem; } .login-overlay.hidden { opacity: 0; pointer-events: none; }
