:root {
    --green: #0b4f3a;
    --green-2: #0f6b4f;
    --gold: #c8a34a;
    --bg: #f4f7f5;
    --card: #fff;
    --text: #1f2b24;
    --muted: #6b776f;
    --border: #dbe3dd;
    --danger: #a53333;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Tajawal', 'Tahoma', 'Arial', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    direction: rtl;
}

a { text-decoration: none; color: inherit; }

input, select, textarea, option {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    font-family: 'Tajawal', sans-serif !important;
    font-size: 14px;
    transition: .2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(11, 79, 58, 0.08);
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--green);
    font-weight: 700;
}

/* Layout Structure */
.page-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 285px;
    background: linear-gradient(180deg, var(--green), #083729);
    color: #fff;
    padding: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: 0.3s ease;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, .18);
    margin-bottom: 10px;
}

.brand img {
    width: 54px;
    height: 54px;
    object-fit: contain;
    background: #fff;
    border-radius: 14px;
    padding: 4px;
}

.brand h1 { font-size: 18px; margin: 0; font-weight: 800; }
.brand span { font-size: 12px; color: #dfe9e4; display: block; }

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
    flex: 1;
}

.side-nav a {
    padding: 12px 14px;
    border-radius: 14px;
    color: #fff;
    background: rgba(255, 255, 255, .06);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: .2s ease;
    font-weight: 600;
    position: relative;
}

.side-nav a:hover, .side-nav a.active {
    background: rgba(200, 163, 74, .25);
    color: #fff;
}

.side-nav a.active::after {
    content: '';
    position: absolute;
    right: -22px;
    top: 10px;
    bottom: 10px;
    width: 4px;
    background: var(--gold);
    border-radius: 4px 0 0 4px;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    flex-shrink: 0;
}

.nav-icon svg { width: 22px; height: 22px; stroke-width: 2; }

.nav-badge {
    margin-right: auto;
    background: var(--gold);
    color: #082f24;
    font-size: 11px;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, .1);
}

.logout-btn {
    width: 100%;
    background: rgba(255, 50, 50, .08);
    border: 1px solid rgba(255, 255, 255, .05);
    color: #ffbaba;
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    transition: .2s;
}

.logout-btn:hover { background: #a53333; color: #fff; }

/* Main Area */
.main { flex: 1; padding: 24px; min-width: 0; }

/* Topbar Styling */
.topbar {
    height: 72px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(11, 79, 58, .06);
}

.topbar-right, .topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-greeting { color: var(--muted); font-size: 12px; display: block; }

.topbar-bell {
    position: relative;
    color: var(--muted);
    padding: 10px;
    border-radius: 12px;
    background: #f8faf9;
    border: 1px solid var(--border);
    transition: .2s;
    display: flex;
}

.topbar-bell:hover { color: var(--green); background: #eef7f1; }
.topbar-bell.has-notif svg { color: var(--gold); }

.bell-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    border: 2px solid #fff;
}

.role-pill { padding: 6px 14px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.role-admin { background: #eef4ff; color: #295fb8; }
.role-hall { background: #fff8ea; color: #a06a00; }
.role-dept { background: #eef7f1; color: #0b4f3a; }

/* Dashboard Components */
.hero-card, .card, .stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(11, 79, 58, .06);
    position: relative;
    overflow: hidden;
}

.stat::after, .hero-card::after {
    content: "";
    position: absolute;
    left: -35px;
    bottom: -35px;
    width: 95px;
    height: 95px;
    border-radius: 50%;
    background: rgba(11, 79, 58, .06);
    pointer-events: none;
    z-index: 0;
}

.hero-card::after {
    background: rgba(255, 255, 255, 0.12);
    width: 150px;
    height: 150px;
    left: -50px;
    bottom: -50px;
}

.stat-total { border-top: 4px solid var(--green); }
.stat-open { border-top: 4px solid #a06a00; }
.stat-pending { border-top: 4px solid #6d3dc6; }
.stat-done { border-top: 4px solid #0d7a41; }
.stat-users { border-top: 4px solid var(--gold); }

.hero-card {
    background: linear-gradient(135deg, var(--green), var(--green-2));
    color: #fff;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.stats-grid-four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }

.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat strong { display: block; color: var(--green); font-size: 30px; margin-top: 6px; font-weight: 900; }

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f3f1;
    padding-bottom: 15px;
}

.card-title { font-weight: 900; color: var(--green); font-size: 20px; }
.page-subtitle { color: var(--muted); margin-top: 6px; font-size: 14px; }

/* UI Elements */
.btn {
    border: 0;
    border-radius: 12px;
    padding: 11px 20px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: .2s;
    font-family: inherit;
}

.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: #083729; }
.btn-outline { background: #fff; color: var(--green); border: 1px solid var(--border); }
.btn-outline:hover { background: #f8faf9; border-color: var(--green); }
.btn-danger { background: var(--danger); color: #fff; }

.badge {
    background: #eef7f1;
    color: var(--green);
    border: 1px solid #cfe4d7;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    text-align: center;
}

/* Tables Styling */
.table-responsive { overflow-x: auto; border-radius: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 18px; border-bottom: 1px solid var(--border); }
th { color: var(--green); background: #f7faf8; font-size: 14px; font-weight: 800; }
tr:hover td { background: #f8faf9; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

/* Status Colors */
.status-new { background: #eef7f1; color: #0f6b4f; }
.status-directed { background: #eef4ff; color: #295fb8; }
.status-in_progress { background: #fff8ea; color: #a06a00; }
.status-redirected { background: #f6efff; color: #6d3dc6; }
.status-completed { background: #edf8f1; color: #0d7a41; font-weight: 800; }
.status-closed { background: #fff0f0; color: #a53333; font-weight: 800; }

/* Filters & Forms */
.filters { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.wide { grid-column: 1/-1; }

/* Timeline */
.timeline { display: grid; gap: 15px; }
.timeline-item {
    border-right: 4px solid var(--gold);
    background: #fbfcfb;
    border-radius: 14px;
    padding: 16px;
    transition: .2s;
}
.timeline-item:hover { border-right-width: 8px; transform: translateX(-4px); }

/* Alerts */
.alert { border-radius: 14px; padding: 14px 18px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.alert-success { background: #edf8f1; color: #0b6734; border: 1px solid #c9ead5; }
.alert-error { background: #fff0f0; color: #9c2525; border: 1px solid #f1c9c9; }

/* Mobile Menu Button */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: #f8faf9;
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
}

.hamburger span { display: block; width: 22px; height: 2.5px; background: var(--green); border-radius: 2px; }

/* Responsive Media Queries */
@media (max-width: 900px) {
    .page-shell { display: block; }
    .hamburger { display: flex; }
    
    .sidebar {
        position: fixed;
        right: -285px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        box-shadow: -10px 0 30px rgba(0,0,0,0.15);
    }
    
    .sidebar.open { right: 0; }
    
    .mob-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
        backdrop-filter: blur(3px);
    }
    
    .mob-overlay.show { display: block; }
    
    .main { padding: 16px; }
    
    .stats-grid, .stats-grid-four, .details-grid, .two-columns, .filters, .form-grid {
        grid-template-columns: 1fr;
    }
    
    .topbar { height: auto; padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
    .topbar-right, .topbar-left { width: 100%; justify-content: space-between; }

    /* Navigation Refinement for Mobile */
    .nav-icon { width: 20px; height: 20px; min-width: 20px; }
    .nav-icon svg { width: 18px; height: 18px; }
    .side-nav a { font-size: 14px; padding: 10px 12px; gap: 10px; }
    .brand img { width: 44px; height: 44px; }
    .brand h1 { font-size: 16px; }
}

/* Animations */
.content-area { animation: fadeIn 0.4s ease; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar Customization */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c7d4cc; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #aab8af; }
