:root {
    --primary-color: #01203f;
    --accent-color: #22cac3;
    --bg-main: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #f1f5f9;
    
    --sidebar-width: 260px;
    --header-height: 72px;
    
    --active-bg: #f1f5f9;
    --active-text: #01203f;
}

@font-face {
    font-family: 'DIN Next LT Arabic';
    src: local('DIN Next LT Arabic'), local('sans-serif');
}

body {
    background-color: var(--bg-main);
    color: var(--text-dark);
    font-family: 'DIN Next LT Arabic', sans-serif;
    margin: 0; padding: 0;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
    background-color: var(--bg-white);
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    border-inline-end: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-logo {
    padding: 25px 20px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo i { color: var(--accent-color); font-size: 24px; }

.sidebar-group-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 24px 24px 8px 24px;
}

.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 12px;
    margin: 2px 12px;
}
.nav-link-custom i {
    width: 20px;
    color: #94a3b8;
    font-size: 1.1rem;
    margin-inline-end: 12px;
    transition: color 0.2s;
}

.nav-link-custom:hover, .nav-link-custom.active {
    background-color: var(--active-bg);
    color: var(--active-text);
    font-weight: 700;
}
.nav-link-custom:hover i, .nav-link-custom.active i {
    color: var(--accent-color);
}

.nav-badge {
    margin-inline-start: auto;
    background-color: #f3f4f6;
    color: #4b5563;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* Sidebar Submenus */
.sidebar-submenu {
    list-style: none;
    padding: 0 0 10px 54px;
    display: none;
}
.nav-link-custom.active + .sidebar-submenu,
.nav-link-custom.open + .sidebar-submenu {
    display: block;
}
.submenu-link {
    display: block;
    padding: 6px 0;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.submenu-link:hover, .submenu-link.active {
    color: var(--accent-color);
    font-weight: 600;
}
body[dir="rtl"] .sidebar-submenu {
    padding: 0 54px 10px 0;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}
.logout-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex; align-items: center; gap: 10px;
}
.logout-link:hover { color: #dc2626; }

/* ---------------- Main Content & Header ---------------- */
.main-content {
    margin-inline-start: var(--sidebar-width);
    min-height: 100vh;
}

.top-header {
    background-color: var(--bg-white);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--border-color);
}

.header-company {
    display: flex;
    align-items: center;
    gap: 12px;
}
.company-icon {
    width: 32px; height: 32px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 6px;
    display: flex; justify-content: center; align-items: center;
    font-size: 14px;
}
.company-name { font-weight: 700; font-size: 1rem; }
.status-pill {
    background-color: #ecfdf5;
    color: #10b981;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    display: flex; align-items: center; gap: 4px;
}
.status-pill i { font-size: 0.4rem; }

.header-search {
    flex-grow: 1;
    max-width: 500px;
    margin: 0 40px;
    position: relative;
}
.header-search input {
    width: 100%;
    background-color: #f1f5f9;
    border: 1px solid transparent;
    padding: 10px 20px 10px 44px;
    padding-inline-start: 44px;
    padding-inline-end: 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}
.header-search input:focus {
    background-color: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(34, 202, 195, 0.1);
}
.header-search i {
    position: absolute;
    inset-inline-start: 16px; 
    top: 50%; transform: translateY(-50%);
    color: #94a3b8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}
.header-icon {
    color: #6b7280; font-size: 1.1rem; text-decoration: none; position: relative;
    display: flex; align-items: center; justify-content: center;
}
.header-icon:hover { color: var(--primary-color); }
.user-dropdown {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.user-avatar {
    width: 32px; height: 32px;
    background-color: #ede9fe; color: #7c3aed;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 0.8rem; font-weight: bold;
    flex-shrink: 0;
}

/* ---------------- Page Content ---------------- */
.page-container {
    padding: 40px;
}
.page-title {
    font-size: 1.7rem; font-weight: bold; margin-bottom: 5px; color: #111827;
}
.page-subtitle {
    font-size: 0.9rem; color: #6b7280; margin-bottom: 30px;
}

/* Dashboard Cards */
.modern-card {
    background-color: var(--bg-white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
}

/* ---------------- Mobile Responsiveness ---------------- */
@media (max-width: 991.98px) {
    :root {
        --sidebar-width: 0px; /* Hide by default on mobile */
    }

    .sidebar {
        inset-inline-start: -280px; /* Off-canvas */
        width: 280px;
        transition: transform 0.3s ease;
    }
    
    body.sidebar-open .sidebar {
        transform: translateX(280px);
    }
    body[dir="rtl"].sidebar-open .sidebar {
        transform: translateX(-280px);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-inline-start: 0;
    }

    .top-header {
        padding: 0 15px;
    }

    .header-search {
        display: none; /* Hide search on mobile header to save space */
    }

    .page-container {
        padding: 20px 15px;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .header-actions {
        gap: 12px;
    }

    .company-name {
        display: none; /* Hide company name on very small headers */
    }

    .nav-link-custom {
        padding: 14px 20px;
        font-size: 1rem;
    }
}

@media (max-width: 575.98px) {
    .header-actions .header-icon:not(.notification-btn) {
        display: none; /* Hide some icons on extra small */
    }
    
    .status-pill {
        display: none !important;
    }
}
