:root {
    --primary: #4361ee;
    --primary-light: #4895ef;
    --bg: #f8f9fa;
    --surface: #ffffff;
    --text: #2b2d42;
    --text-light: #8d99ae;
    --danger: #e63946;
    --success: #2ec4b6;
    --sidebar-width: 260px;
    --header-height: 70px;
}
[data-theme="dark"] {
    --bg: #0f111a;
    --surface: #161925;
    --text: #f8f9fa;
    --text-light: #6c7a89;
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; font-family: 'Cairo', sans-serif; }
body { background-color: var(--bg); color: var(--text); transition: 0.3s; min-height: 100vh; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }

/* --- Sidebar --- */
.sidebar {
    position: fixed; top: 0; bottom: 0; right: 0; width: var(--sidebar-width);
    background: var(--surface); z-index: 1000; display: flex; flex-direction: column;
    border-left: 1px solid rgba(0,0,0,0.05); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.02);
}
html[dir="ltr"] .sidebar { right: auto; left: 0; border-left: none; border-right: 1px solid rgba(0,0,0,0.05); }

.sidebar-header { padding: 1.5rem; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.sidebar-header i { font-size: 1.5rem; color: var(--primary); }
.sidebar-header span { font-weight: 700; font-size: 1.2rem; letter-spacing: -0.5px; }

.menu { padding: 1rem; display: flex; flex-direction: column; gap: 5px; overflow-y: auto; flex: 1; }
.menu-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    color: var(--text-light); border-radius: 8px; cursor: pointer;
    transition: 0.2s; font-weight: 500; position: relative; z-index: 2;
}
.menu-item:hover, .menu-item.active { background: rgba(67, 97, 238, 0.1); color: var(--primary); }
.menu-item.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3); }

/* --- Main Content --- */
.main-content {
    margin-right: var(--sidebar-width); padding: 2rem; min-height: 100vh; transition: 0.3s;
}
html[dir="ltr"] .main-content { margin-right: 0; margin-left: var(--sidebar-width); }

/* --- Navbar --- */
.navbar {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--surface); padding: 1rem 1.5rem; border-radius: 12px;
    margin-bottom: 2rem; box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.nav-actions { display: flex; gap: 1rem; align-items: center; }
.btn-icon {
    width: 40px; height: 40px; border-radius: 50%; background: var(--bg);
    border: 1px solid rgba(0,0,0,0.05); color: var(--text);
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s;
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.lang-btn { width: auto; padding: 0 15px; border-radius: 20px; font-weight: 600; font-family: 'Poppins'; font-size: 0.85rem; }

/* --- Form Controls & Buttons --- */
.form-control, .btn {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    transition: 0.3s;
}
.form-control {
    background: var(--bg);
    color: var(--text);
    width: 100%;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}
.btn {
    cursor: pointer;
    font-weight: 600;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}
.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid rgba(0, 0, 0, 0.1);
}
.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--text-light);
}

/* --- Components (Cards, Grid, Table) --- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.card {
    background: var(--surface); padding: 1.5rem; border-radius: 12px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02); border: 1px solid rgba(0,0,0,0.02);
    transition: 0.3s; position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
.card h3 { font-size: 1.8rem; margin: 5px 0; color: var(--text); }
.card span { font-size: 0.85rem; color: var(--text-light); font-weight: 600; text-transform: uppercase; }
.card-icon {
    width: 50px; height: 50px; border-radius: 12px; background: rgba(67, 97, 238, 0.1);
    color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}

.table-container { background: var(--surface); border-radius: 12px; padding: 1.5rem; box-shadow: 0 4px 6px rgba(0,0,0,0.02); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 12px 15px; text-align: start; border-bottom: 1px solid rgba(0,0,0,0.05); }
th { color: var(--text-light); font-size: 0.85rem; text-transform: uppercase; }

/* --- Bottom Nav --- */
.bottom-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; height: 65px;
    background: var(--surface); border-top: 1px solid rgba(0,0,0,0.05);
    justify-content: space-around; align-items: center; z-index: 999;
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; font-size: 0.7rem; color: var(--text-light); gap: 4px; padding: 8px 0; }
.bottom-nav a.active { color: var(--primary); }

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); }
    html[dir="ltr"] .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin: 0 !important; padding: 1rem; padding-bottom: 80px; }
    .bottom-nav { display: flex; }
    .toggle-btn { display: block; }
}
@media (min-width: 769px) { .toggle-btn { display: none; } .bottom-nav { display: none !important; } }