@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Sophisticated Color Palette */
    --primary: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --primary-soft: rgba(99, 102, 241, 0.1);

    --secondary: #1e293b;
    --accent: #f43f5e;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --bg-main: #f8fafc;
    --sidebar-bg: #0f172a;
    --card-bg: #ffffff;
    --border: #e2e8f0;

    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-on-dark: #f1f5f9;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', 'Cairo', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
header {
    width: 280px;
    background: var(--sidebar-bg);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 0.5rem 2rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
}

.sidebar-brand i {
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

.main-menu {
    list-style: none;
    flex: 1;
}

.main-menu li {
    margin-bottom: 0.4rem;
}

.main-menu a {
    color: #94a3b8;
    text-decoration: none;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-menu a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(4px);
}

[dir="rtl"] .main-menu a:hover {
    transform: translateX(-4px);
}

.main-menu a.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}

.main-menu a i {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 1.5rem 0.5rem !important;
}

/* Main Content area */
main {
    flex: 1;
    padding: 2.5rem 3rem;
    max-width: 1400px;
}

/* Typography & Headers */
h2 {
    font-size: 1.875rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.5rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.925rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    background: white;
    color: var(--text-main);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-muted);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--primary-soft);
    color: var(--primary);
    transform: scale(1.05);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.stat-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: block;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

[dir="rtl"] th {
    text-align: right;
}

td {
    padding: 1.25rem 1.5rem;
    font-size: 0.925rem;
    border-bottom: 1px solid #f1f5f9;
}

tr:hover td {
    background-color: #f8fafc;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #334155;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

/* Badges */
.badge {
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Custom Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.checkbox-group input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* RTL Adjustments */
[dir="rtl"] .sidebar-brand i {
    order: 2;
}

[dir="rtl"] header {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

/* Responsive */
@media (max-width: 1024px) {
    header {
        width: 80px;
        padding: 2rem 0.75rem;
        text-align: center;
    }

    .sidebar-brand span,
    .main-menu span {
        display: none;
    }

    .main-menu a {
        justify-content: center;
        padding: 1rem;
    }

    main {
        padding: 2rem;
    }
}

@media (max-width: 640px) {
    .container {
        flex-direction: column;
    }

    header {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
    }

    .main-menu {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .main-menu li {
        margin: 0;
    }

    main {
        padding: 1.5rem;
    }
}