/* al_hakeem/assets/css/Style.css - الإصدار المحسن */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

:root {
    /* نظام الألوان المتكامل */
    --primary-50: #f0fdfa;
    --primary-100: #ccfbf1;
    --primary-200: #99f6e4;
    --primary-300: #5eead4;
    --primary-400: #2dd4bf;
    --primary-500: #14b8a6;
    --primary-600: #0d9488;
    --primary-700: #0f766e;
    --primary-800: #115e59;
    --primary-900: #134e4a;
    
    --secondary-50: #f8fafc;
    --secondary-100: #f1f5f9;
    --secondary-200: #e2e8f0;
    --secondary-300: #cbd5e1;
    --secondary-400: #94a3b8;
    --secondary-500: #64748b;
    --secondary-600: #475569;
    --secondary-700: #334155;
    --secondary-800: #1e293b;
    --secondary-900: #0f172a;
    
    /* ألوان الحالة */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* الظلال */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* الأبعاد */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* المسافات */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* التحولات */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ RESET & BASE ============ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--secondary-700);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* تحسين التحديد */
::selection {
    background-color: var(--primary-200);
    color: var(--primary-900);
}

/* ============ LAYOUT ============ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    width: 100%;
}

/* ============ SIDEBAR ============ */
.app-sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--secondary-900) 0%, var(--secondary-800) 100%);
    color: white;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition-base);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-600) transparent;
}

.app-sidebar::-webkit-scrollbar {
    width: 6px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--primary-600);
    border-radius: 3px;
}

/* رأس السايدبار */
.sidebar-header {
    padding: var(--space-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.clinic-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    box-shadow: var(--shadow-lg);
}

.clinic-logo i {
    font-size: 28px;
    color: white;
}

.clinic-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: var(--space-xs);
}

.clinic-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

/* قائمة السايدبار */
.sidebar-nav {
    flex: 1;
    padding: var(--space-lg) 0;
}

.nav-section {
    padding: 0 var(--space-lg);
    margin-bottom: var(--space-xl);
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: var(--space-md);
    padding-right: var(--space-sm);
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: var(--space-xs);
}

.nav-link {
    display: flex;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
    position: relative;
    gap: var(--space-md);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(-4px);
}

.nav-link.active {
    background: linear-gradient(90deg, var(--primary-700), var(--primary-600));
    color: white;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--primary-400);
    border-radius: var(--radius-sm);
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1.125rem;
}

.nav-text {
    flex: 1;
    font-weight: 500;
}

.nav-badge {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
}

/* قائمة منسدلة */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-right: auto;
    transition: var(--transition-fast);
}

.nav-dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    background: rgba(30, 41, 59, 0.95);
    /* تترك هذي كما هي للمنسدلة */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    margin-top: var(--space-xs);
    padding: var(--space-sm) 0;
    animation: dropdownSlide 0.2s ease-out;
    /* إزالة الخاصية التالية لأنها مضرة للنوافذ الرئيسية */
    /* backdrop-filter: blur(10px); */
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    color: rgba(255, 255, 255, 0.8);
    padding: var(--space-sm) var(--space-lg);
    transition: var(--transition-fast);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    padding-right: calc(var(--space-lg) + 8px);
}

/* تذييل السايدبار */
.sidebar-footer {
    padding: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.5);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    color: white;
    font-size: 0.9375rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ============ MAIN CONTENT ============ */
.app-main {
    flex: 1;
    margin-right: 280px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition-base);
}

/* ============ TOPBAR ============ */
.app-topbar {
    background: rgba(255, 255, 255, 0.95);
    /* إزالة الخاصية المسببة للمشاكل من الهيدر */
    /* backdrop-filter: blur(10px); */
    border-bottom: 1px solid var(--secondary-200);
    padding: 0 var(--space-xl);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 990;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary-50);
    color: var(--primary-700);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--primary-100);
    transform: scale(1.05);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-800);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.topbar-search {
    position: relative;
}

.search-input {
    width: 300px;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid var(--secondary-300);
    border-radius: var(--radius-lg);
    background: white;
    color: var(--secondary-700);
    font-size: 0.9375rem;
    transition: var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-400);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.notification-btn,
.fullscreen-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--secondary-100);
    color: var(--secondary-600);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.notification-btn:hover,
.fullscreen-btn:hover {
    background: var(--secondary-200);
    color: var(--secondary-700);
}

.notification-badge {
    position: absolute;
    top: -2px;
    left: -2px;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: none;
    border: none;
    padding: var(--space-xs);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-menu-btn:hover {
    background: var(--secondary-100);
}

.user-avatar-sm {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

/* ============ CONTENT AREA ============ */
.content-wrapper {
    flex: 1;
    padding: var(--space-xl);
}

/* ============ CARDS ============ */
.card {
    background: white;
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-lg);
    transition: var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--secondary-200);
    padding: var(--space-lg);
    font-weight: 700;
    color: var(--secondary-800);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary-800);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    background: var(--secondary-50);
    border-top: 1px solid var(--secondary-200);
    padding: var(--space-md) var(--space-lg);
}

/* ============ TABLES ============ */
.table-container {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table thead th {
    background: var(--secondary-50);
    color: var(--secondary-600);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 2px solid var(--secondary-200);
    white-space: nowrap;
}

.table tbody tr {
    background: white;
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--primary-50);
}

.table tbody tr:nth-child(even) {
    background: var(--secondary-50);
}

.table tbody tr:nth-child(even):hover {
    background: var(--primary-50);
}

.table td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--secondary-200);
    vertical-align: middle;
}

.table-actions {
    display: flex;
    gap: var(--space-xs);
    white-space: nowrap;
}

/* ============ FORMS ============ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--secondary-700);
}

.form-control,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--secondary-300);
    border-radius: var(--radius-lg);
    background: white;
    color: var(--secondary-700);
    font-size: 0.9375rem;
    transition: var(--transition-fast);
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--secondary-500);
    margin-top: var(--space-xs);
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.5rem;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
}

.btn-secondary {
    background: var(--secondary-100);
    color: var(--secondary-700);
}

.btn-secondary:hover {
    background: var(--secondary-200);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #34d399);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #fbbf24);
    color: var(--secondary-900);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #f87171);
    color: white;
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--primary-500);
    color: var(--primary-600);
}

.btn-outline-primary:hover {
    background: var(--primary-50);
}

/* ============ MODALS ============ */
.modal {
    z-index: 1055 !important;
}

.modal.show {
    display: block !important;
}

.modal-dialog {
    margin: var(--space-xl) auto;
    max-width: 800px;
}

.modal-content {
    border: none;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    background: var(--primary-50);
    border-bottom: 1px solid var(--primary-200);
    padding: var(--space-lg) var(--space-xl);
}

.modal-title {
    color: var(--primary-800);
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0;
}

.modal-body {
    padding: var(--space-xl);
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    background: var(--secondary-50);
    border-top: 1px solid var(--secondary-200);
    padding: var(--space-lg) var(--space-xl);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050 !important;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    /* إصلاح: إزالة backdrop-filter للمودال الخلفية */
    /* backdrop-filter: blur(4px); */
}

.modal-backdrop.fade {
    opacity: 0;
}

.modal-backdrop.show {
    opacity: 0.5;
}

/* إصلاح مشكلة overflow عند فتح المودال */
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* ضمان أن المودال يمكن التفاعل معه */
.modal.show {
    display: block !important;
}

.modal.show .modal-dialog {
    pointer-events: auto;
}

.modal-backdrop.show {
    opacity: 0.5;
}

/* إصلاح مشكلة backdrop العالق */
body.modal-open {
    overflow: hidden;
    padding-right: 0 !important;
}

/* ضمان أن المودالات تظهر فوق السايدبار */
.app-sidebar {
    z-index: 1000;
}

.modal {
    z-index: 1055 !important;
}

.modal.show {
    display: block !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

.modal-backdrop.show {
    opacity: 0.5;
    z-index: 1050 !important;
}

/* إصلاح مشكلة overflow عند فتح المودال */
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* إصلاح مشكلة المودالات المتعددة */
.modal.fade:not(.show) {
    opacity: 0;
}

.modal.fade.show {
    opacity: 1;
}

/* ============ ALERTS ============ */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.alert-message {
    font-size: 0.9375rem;
}

.alert-success {
    background: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}

.alert-warning {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.alert-danger {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-800);
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* ============ LOADING ============ */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
    .app-sidebar {
        transform: translateX(100%);
        width: 300px;
    }
    
    .app-main {
        margin-right: 0;
    }
    
    .sidebar-open .app-sidebar {
        transform: translateX(0);
    }
    
    .sidebar-open .app-main::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .app-topbar {
        padding: 0 var(--space-md);
        height: 60px;
    }
    
    .content-wrapper {
        padding: var(--space-lg);
    }
    
    .search-input {
        width: 200px;
    }
    
    .card-header,
    .card-body,
    .card-footer {
        padding: var(--space-md);
    }
    
    .modal-dialog {
        margin: var(--space-md);
    }
    
    .modal-body {
        padding: var(--space-lg);
    }
}

@media (max-width: 576px) {
    .topbar-right {
        gap: var(--space-sm);
    }
    
    .search-input {
        display: none;
    }
    
    .table-responsive {
        border: 1px solid var(--secondary-200);
        border-radius: var(--radius-lg);
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* ============ UTILITIES ============ */
.text-primary { color: var(--primary-600) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--secondary-500) !important; }

.bg-primary-light { background: var(--primary-50) !important; }
.bg-success-light { background: #d1fae5 !important; }
.bg-warning-light { background: #fef3c7 !important; }
.bg-danger-light { background: #fee2e2 !important; }

.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: var(--space-sm) !important; }
.mb-4 { margin-bottom: var(--space-lg) !important; }
.mb-6 { margin-bottom: var(--space-xl) !important; }

.p-0 { padding: 0 !important; }
.p-3 { padding: var(--space-md) !important; }
.p-4 { padding: var(--space-lg) !important; }
.p-5 { padding: var(--space-xl) !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.d-flex { display: flex !important; }
.flex-column { flex-direction: column !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }

.gap-2 { gap: var(--space-sm) !important; }
.gap-3 { gap: var(--space-md) !important; }
.gap-4 { gap: var(--space-lg) !important; }

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

/* ============ FOOTER ============ */
.app-footer {
    background: rgba(255, 255, 255, 0.95);
    /* إزالة الخاصية التالية للمودالات */
    /* backdrop-filter: blur(10px); */
    border-top: 1px solid var(--border);
    margin-top: auto;
    padding: 1rem 0;
}

.app-footer p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
}

.app-footer .text-primary {
    color: var(--primary) !important;
    font-weight: 600;
}

.app-footer i {
    color: var(--primary);
}

/* تحسين الطباعة */
@media print {
    .app-sidebar,
    .app-topbar,
    .app-footer,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .app-main {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* إصلاح مشكلة النوافذ المنبثقة */
#wrapper, .app-wrapper, .app-main {
    /* هذه الخصائص هي التي تكسر النوافذ - يجب إلغاؤها أو تصفيرها */
    transform: none !important;
    perspective: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: auto !important; /* دع المتصفح يحدد الطبقات تلقائياً */
}

/* التأكد من أن النافذة تظهر فوق كل شيء */
.modal {
    z-index: 1055 !important;
}
.modal-backdrop {
    z-index: 1050 !important;
}
/* القائمة الجانبية والهيدر يجب أن يكونا أقل من النافذة */
.app-sidebar, .app-topbar, .navbar {
    z-index: 1040 !important; 
}