/* ===== CSS Variables ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --darker: #0f172a;
    --light: #f8fafc;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
    --main-font-size: 16px;
    --background: #f1f5f9;
}

/* Dark Mode Variables */
.dark-mode {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-light: #fdba74;
    --secondary: #94a3b8;
    --dark: #f8fafc;
    --darker: #ffffff;
    --light: #0f172a;
    --border: #334155;
    --background: #020617;
    --card-bg: #1e293b;
    --header-bg: #0f172a;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    font-size: var(--main-font-size);
    background: var(--background);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
    direction: rtl;
}

.hidden {
    display: none !important;
}

/* ===== Login Screen ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
    color: #fff;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.login-header p {
    color: rgba(255, 255, 255, 0.6);
}

/* ===== App Container ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.nav-menu {
    flex: 1;
    padding: 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 4px;
    transition: var(--transition);
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-right: 260px;
    padding: 0;
}

.top-header {
    background: #fff;
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 100;
}

.page {
    display: none;
    padding: 32px;
}

.page.active {
    display: block;
}

/* ===== Grid & Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}

.gradient-blue {
    border-top: 4px solid #3b82f6;
}

.gradient-green {
    border-top: 4px solid #22c55e;
}

.gradient-purple {
    border-top: 4px solid #8b5cf6;
}

.gradient-orange {
    border-top: 4px solid #f59e0b;
}

.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 24px;
}

/* ===== Tables ===== */
.overflow-x {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f8fafc;
    color: var(--secondary);
}

/* ===== Forms & UI Elements ===== */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-full {
    width: 100%;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #fff;
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius);
    padding: 24px;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius);
    color: #fff;
    z-index: 2000;
}