﻿/* --- 1. المتغيرات والأساسيات --- */
:root {
    /* اللون الأخضر السعودي الرسمي */
    --accent: #006837;
    --accent-light: rgba(0, 108, 53, 0.1);
    --bg-app: #f8faf9;
    --bg-side: #ffffff;
    --bg-top: #ffffff;
    --text-main: #1a2b23;
    --text-muted: #8fa398;
    --border-color: rgba(0, 108, 53, 0.08);
    --transition: all 0.25s ease;
    /* متغير أبعاد السايدبار المفعل والمطوي */
    --sidebar-width: 230px;
    --sidebar-collapsed: 70px;
}

.dark-mode {
    --bg-app: #0b1410;
    --bg-side: #121f19;
    --bg-top: #121f19;
    --text-main: #e6f0eb;
    --text-muted: #7a8c83;
    --accent: #00a150;
    --border-color: rgba(255, 255, 255, 0.05);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.business-logo {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 8px;
}
html, body {
    height: 100vh;
    margin: 0;
    direction: rtl;
    font-family: 'Cairo', sans-serif !important;
    font-size: 13.5px; /* تصغير الخط العام للحصول على رؤية ممتازة بدلاً من الـ Zoom */
    overflow: hidden;
    background-color: var(--bg-app);
    color: var(--text-main);
    transition: background-color var(--transition);
}

#blazor-error-ui {
    display: none !important;
}

.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* --- 2. السايد بار (Sidebar) --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-side) !important;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    padding: 12px 10px;
    z-index: 2000;
    flex-shrink: 0;
    border-left: 1px solid var(--border-color);
    height: 100vh;
    overflow-y: auto; /* إضافة سكرول مستقل للسايد بار لإظهار جميع التابات */
    box-sizing: border-box;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    min-height: 40px;
}

.logo-text {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    white-space: nowrap;
}

/* --- 3. الأزرار (Buttons) --- */
.toggle-btn {
    background: var(--bg-app);
    border: none;
    color: var(--text-main);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

    .toggle-btn:hover {
        background: var(--accent);
        color: white !important;
    }

.close-mobile-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

.mobile-toggle-btn {
    display: none;
    background: var(--bg-side);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    backdrop-filter: blur(2px);
}

/* --- 4. القائمة (Menu) --- */
.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 8px 12px; /* تقليل الحشوات لتصغير العناصر */
    color: var(--text-muted);
    text-decoration: none !important;
    border-radius: 10px;
    margin-bottom: 4px;
    font-size: 13px;
    transition: var(--transition);
}

    .menu-item i {
        font-family: 'Material Icons Round';
        font-size: 20px; /* تصغير حجم الأيقونات */
        margin-left: 10px;
    }

    .menu-item:hover, .menu-item.active {
        background: var(--accent) !important;
        color: white !important;
    }

/* --- 5. ريسبونسيف الموبايل (Mobile) --- */
@media (max-width: 768px) {
    .mobile-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .desktop-only {
        display: none !important;
    }

    .close-mobile-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        position: fixed;
        right: -270px;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 2001;
        width: 250px !important;
    }

    .sidebar-open .sidebar {
        right: 0 !important;
        box-shadow: -10px 0 30px rgba(0,0,0,0.2);
    }

    .sidebar-collapsed .sidebar {
        right: -270px !important;
    }

    .sidebar-open .mobile-overlay {
        display: block;
    }

    .search-wrapper {
        width: 130px;
    }
}

/* --- 6. ريسبونسيف اللابتوب (Desktop) --- */
@media (min-width: 769px) {
    .sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed) !important;
    }

    .sidebar-collapsed .logo-text,
    .sidebar-collapsed .menu-item span,
    .sidebar-collapsed .arrow-icon {
        display: none !important;
    }

    .sidebar-collapsed .menu-item i {
        margin-left: 0;
    }

    .sidebar-collapsed .menu-item {
        justify-content: center;
        padding: 10px 0;
    }
}

/* --- 7. المحتوى العام --- */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: 55px; /* تقليل ارتفاع الشريط العلوي */
    background: var(--bg-top);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid var(--border-color);
}

.search-input {
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    padding: 6px 35px 6px 12px;
    border-radius: 8px;
    color: var(--text-main);
    font-family: 'Cairo';
    font-size: 12.5px;
    width: 100%;
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px !important;
}

/* --- تعديل البودي العام (محتوى الصفحات) --- */
.page-body {
    flex-grow: 1;
    padding: 15px; /* تقليل حشوة الصفحة الداخلية */
    overflow-y: auto;
    background-color: var(--bg-app);
    color: var(--text-main);
    transition: var(--transition);
}

/* --- تعديل الفوتر (Footer) --- */
.main-footer {
    height: 35px; /* تقليل ارتفاع الفوتر */
    background-color: var(--bg-top);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    transition: var(--transition);
}

    .main-footer span, .main-footer div {
        color: var(--text-main);
    }

/*.page-body h1, .page-body h2, .page-body h3, .page-body p, .page-body span {
    color: var(--text-main);
}*/

.divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

:fullscreen .app-container {
    background-color: var(--bg-app);
}

:-webkit-full-screen .app-container {
    background-color: var(--bg-app);
}

.validation-message {
    color: #ff3b30;
    font-size: 12px;
    margin-top: 3px;
}

.stat-card-account {
    border-right: 4px solid #7c3aed !important;
}

.text-account {
    color: #7c3aed !important;
}

.icon-account {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
}

.tag-primary {
    background: #eff6ff;
    color: #1d4ed8;
}

/* تنسيقات القائمة المنسدلة */
.dropdown-wrapper {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
}

.menu-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-wrapper .arrow-icon {
    transition: transform 0.3s ease;
    font-size: 18px !important;
}

.dropdown-wrapper.is-open .arrow-icon {
    transform: rotate(180deg);
}

.submenu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    padding-right: 12px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
    background-color: var(--accent-light);
    border-radius: 6px;
}

.dropdown-wrapper.is-open .submenu-list {
    max-height: 500px;
    transition: max-height 0.3s ease-in-out;
    padding-top: 4px;
    padding-bottom: 4px;
}

.submenu-item {
    font-size: 0.85rem !important;
    padding: 6px 10px !important;
    opacity: 0.85;
}

    .submenu-item:hover {
        opacity: 1;
        background-color: rgba(0, 0, 0, 0.05);
    }

/* تخصيص السكرول بار ليصبح أنيقاً ونحيفاً */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

    ::-webkit-scrollbar-thumb:hover {
        opacity: .8;
    }

/* المودال والنافذة المنبثقة */
.ofooqx-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    backdrop-filter: blur(8px);
}

.modern-modal {
    background: white;
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 680px;
    overflow: hidden;
    margin: 15px;
}

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-wrapper {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
}

.modal-body {
    padding: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.full-width {
    grid-column: span 2;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 12.5px;
    color: #374151;
}

.form-control {
    border-radius: 6px;
    border: 1.5px solid #d1d5db;
    padding: 7px 10px;
    font-size: 13px;
    transition: all 0.2s;
}

    .form-control:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
        outline: none;
    }

.input-with-suffix {
    position: relative;
}

    .input-with-suffix .form-control {
        padding-right: 60px;
    }

.suffix {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: #6b7280;
    font-weight: 600;
    font-size: 12px;
    pointer-events: none;
}

.modal-actions {
    padding: 15px 22px;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.premium-btn {
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-cancel {
    background: #e5e7eb;
    color: #374151;
}

.btn-success {
    background: #10b981;
    color: white;
}

    .btn-success:hover {
        background: #006837;
        transform: translateY(-1px);
    }

