﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    direction: ltr;
    transition: all 0.3s ease;
}

/* الشريط العلوي */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: #1e3a5f;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

    .menu-toggle:hover {
        background-color: rgba(255, 255, 255, 0.1);
        transform: scale(1.1);
    }

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .logo img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
    }

.logo-text {
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.datetime {
    text-align: center;
    color: white;
}

.time {
    font-size: 16px;
    font-weight: bold;
}

.date {
    font-size: 12px;
    opacity: 0.8;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-details {
    text-align: left;
    color: white;
}

.user-name {
    display: block;
    font-weight: bold;
    font-size: 14px;
}

.user-role {
    display: block;
    font-size: 12px;
    opacity: 0.8;
}

.user-avatar img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

    .logout-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-2px);
    }

/* القائمة الجانبية */
.sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    width: 280px;
    height: calc(100vh - 70px);
    background: #1e3a5f;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(0);
    transition: transform 0.3s ease;
    z-index: 999;
    overflow-y: auto;
}

    .sidebar.closed {
        transform: translateX(-280px);
    }

.sidebar-content {
    padding: 20px 0;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: white !important;
    text-decoration: none !important;
    transition: all 0.3s ease;
    position: relative;
}

    .nav-link:hover {
        background-color: #f39c12 !important;
        transform: translateX(5px) !important;
    }

.nav-item.active .nav-link {
    background-color: #f39c12;
    border-right: 4px solid #e67e22;
}

.nav-link i {
    width: 20px;
    margin-right: 15px;
    font-size: 16px;
}

.nav-text {
    flex: 1;
}

.submenu-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.nav-item.active .submenu-arrow {
    transform: rotate(180deg);
}

.badge {
    background-color: #e74c3c;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* القوائم الفرعية - المستوى الأول */
.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: rgba(0, 0, 0, 0.1);
}

.nav-item.active .submenu {
    max-height: 500px;
}

.submenu-link {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none !important;
    padding: 12px 20px;
    transition: all 0.3s ease;
    font-size: 14px;
    position: relative;
}

    .submenu-link:hover {
        background-color: rgba(243, 156, 18, 0.3) !important;
        color: white !important;
        transform: translateX(3px) !important;
    }

    .submenu-link.active {
        background-color: rgba(243, 156, 18, 0.3) !important;
        color: white;
        font-weight: bold;
    }

    .submenu-link i {
        width: 20px;
        margin-right: 10px;
        font-size: 14px;
    }

/* القوائم الفرعية - المستوى الثاني */
.submenu .has-submenu {
    position: relative;
}

    .submenu .has-submenu > .submenu-link .submenu-arrow {
        margin-left: auto;
        transition: transform 0.3s ease;
    }

    .submenu .has-submenu.open > .submenu-link .submenu-arrow {
        transform: rotate(180deg);
    }

.submenu-level-2 {
    list-style: none;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    background-color: rgba(0, 0, 0, 0.15);
    padding: 0;
}

.has-submenu.open .submenu-level-2 {
    padding: 5px 0;
}

.submenu-level-2 .submenu-link {
    padding: 10px 20px 10px 50px;
    font-size: 13px;
}

    .submenu-level-2 .submenu-link:hover {
        background-color: rgba(243, 156, 18, 0.4) !important;
        padding-left: 55px;
    }

    .submenu-level-2 .submenu-link.active {
        background-color: rgba(243, 156, 18, 0.5) !important;
        border-left: 3px solid #f39c12;
    }

/* المحتوى الرئيسي */
.main-content {
    margin-top: 70px;
    margin-left: 280px;
    padding: 30px;
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - 70px);
}

    .main-content.expanded {
        margin-left: 0;
    }

.content-wrapper h1 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 28px;
}

.content-wrapper p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* شبكة البطاقات */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 20px;
}

    .card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }

.card-icon {
    width: 60px;
    height: 60px;
    background: #f39c12;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.card-content h3 {
    color: #2c3e50;
    font-size: 14px;
    margin-bottom: 8px;
}

.card-number {
    font-size: 24px;
    font-weight: bold;
    color: #f39c12;
    margin: 0;
}

/* الخلفية المظلمة */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
    pointer-events: none;
}

    .overlay.active {
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
    }


/* التصميم المتجاوب */
@media (max-width: 768px) {
    .header {
        padding: 0 15px;
    }

    .logo-text {
        display: none;
    }

    .user-details {
        display: none;
    }

    .datetime {
        display: none;
    }

    .logout-text {
        display: none;
    }

    .sidebar {
        width: 100%;
        /* المينيو تكون مقفولة من البداية في الموبايل */
        transform: translateX(-100%);
    }

        .sidebar.closed {
            transform: translateX(-100%);
        }

    .main-content {
        margin-left: 0;
        padding: 20px 15px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .card {
        padding: 20px;
    }

    .submenu-level-2 .submenu-link {
        padding: 10px 20px 10px 40px;
    }

        .submenu-level-2 .submenu-link:hover {
            padding-left: 45px;
        }
}

@media (max-width: 480px) {
    .header-right {
        gap: 10px;
    }

    .user-avatar img {
        width: 35px;
        height: 35px;
    }

    .logo img {
        width: 35px;
        height: 35px;
    }

    .content-wrapper h1 {
        font-size: 24px;
    }

    .card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .card-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }

    .main-content {
        margin-left: 250px;
    }

    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* تحسينات إضافية للأداء */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

    .sidebar::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }

/* تأثيرات التحميل */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease forwards;
}

    .card:nth-child(1) {
        animation-delay: 0.1s;
    }

    .card:nth-child(2) {
        animation-delay: 0.2s;
    }

    .card:nth-child(3) {
        animation-delay: 0.3s;
    }

    .card:nth-child(4) {
        animation-delay: 0.4s;
    }

.nav-item > .nav-link {
    display: block;
    width: 100%;
    height: 100%;
}



/* السهم في المستوى الثاني */
.submenu .has-submenu > .submenu-link .submenu-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    display: inline-block;
    transform: rotate(0deg);
}

/* لما المستوى الثالث مقفول - السهم يدور */
.submenu .has-submenu:not(.open) > .submenu-link .submenu-arrow {
    transform: rotate(-90deg);
}

/* لما المستوى الثالث مفتوح - السهم عادي */
.submenu .has-submenu.open > .submenu-link .submenu-arrow {
    transform: rotate(0deg);
}
