/* Arabic Font Support - دعم الخطوط العربية */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@100;200;300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@200;300;400;500;700;800;900&display=swap');

/* Apply Arabic fonts to all elements */
* {
    font-family: 'Cairo', 'Noto Sans Arabic', 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* Ensure Arabic text rendering */
html {
    font-family: 'Cairo', 'Noto Sans Arabic', 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

body {
    font-family: 'Cairo', 'Noto Sans Arabic', 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    direction: rtl;
    text-align: right;
}

/* Fallback for specific elements */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Cairo', 'Noto Sans Arabic', 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    font-weight: 600;
}

p, span, div, a, button, input, textarea, select {
    font-family: 'Cairo', 'Noto Sans Arabic', 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* Custom styles for the application */

/* Navbar styles */
.nav-item-simple {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: white;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.nav-item-simple:hover {
    background-color: #1d4ed8;
}

.nav-item-active-simple {
    background-color: #1d4ed8;
}

.nav-text {
    color: white;
    font-weight: 500;
    white-space: nowrap;
}

/* Admin dropdown styles */
.admin-dropdown {
    background: white;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    border-radius: 8px;
}

.admin-dropdown.show {
    display: block !important;
}

.admin-dropdown.hidden {
    display: none !important;
}

/* User dropdown styles */
.user-dropdown {
    background: white;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    border-radius: 8px;
}

/* Enhanced animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Mobile menu animations */
@keyframes mobileMenuSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes mobileMenuSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* تحسين الوضوح على الموبايل */
@media (max-width: 768px) {
    /* إزالة جميع تأثيرات blur */
    * {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    /* تحسين وضوح النصوص */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
    
    /* تحسين وضوح الصور والأيقونات */
    img, svg {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    /* تحسين وضوح الحدود */
    * {
        border-image-slice: 1;
    }
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Button animations */
.btn-animate {
    transition: all 0.3s ease;
}

.btn-animate:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Enhanced table styles */
.table-enhanced {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.table-enhanced th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Status badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-active {
    background-color: #dcfce7;
    color: #166534;
}

.status-inactive {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Loading animation */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced form styles */
.form-enhanced input,
.form-enhanced select,
.form-enhanced textarea {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-enhanced input:focus,
.form-enhanced select:focus,
.form-enhanced textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* Modal animations */
.modal-enter {
    animation: modalEnter 0.3s ease-out;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive improvements */
@media (max-width: 768px) {
    .nav-item-light {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .nav-text {
        font-size: 0.875rem;
    }
    
    /* تحسينات إضافية للموبايل */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .mobile-optimized {
        font-size: 16px;
        line-height: 1.5;
    }
    
    .mobile-button {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 16px;
        border-radius: 12px;
    }
    
    .mobile-input {
        min-height: 48px;
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 12px;
    }
    
    /* تحسين النوافذ المنبثقة للموبايل */
    .modal-mobile {
        margin: 16px;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
    }
    
    /* تحسين القوائم المنسدلة للموبايل */
    .dropdown-mobile {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 400px;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    /* تحسين الناف بار للموبايل */
    .mobile-navbar {
        background: rgba(30, 64, 175, 0.98);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    /* تحسين أزرار الناف بار */
    .mobile-nav-button {
        min-height: 48px;
        min-width: 48px;
        border-radius: 12px;
        transition: all 0.3s ease;
    }
    
    .mobile-nav-button:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: scale(1.05);
    }
    
    /* تحسين القوائم المنسدلة */
    .mobile-dropdown {
        background: rgba(255, 255, 255, 0.98);
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    }
    
    /* تحسين التنبيهات */
    .mobile-alert {
        background: rgba(255, 255, 255, 0.98);
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        margin: 8px 0;
        padding: 16px;
        transition: all 0.3s ease;
    }
    
    .mobile-alert:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    }
}

/* تحسينات خاصة للشاشات الصغيرة جداً */
@media (max-width: 480px) {
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .card {
        margin-bottom: 16px;
        border-radius: 12px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    /* إخفاء بعض العناصر على الشاشات الصغيرة */
    .hide-on-small {
        display: none !important;
    }
    
    /* تحسين الجداول للشاشات الصغيرة */
    .table-small {
        font-size: 12px;
    }
    
    .table-small th,
    .table-small td {
        padding: 8px 4px;
    }
    
    /* تحسين الناف بار للشاشات الصغيرة */
    .mobile-nav-item-light {
        padding: 20px 16px;
        font-size: 22px;
        min-height: 64px;
    }
    
    .mobile-quick-action {
        padding: 20px 16px;
        font-size: 20px;
        min-height: 64px;
    }
    
    .mobile-nav-text {
        font-size: 22px;
    }
    
    .mobile-icon {
        width: 32px;
        height: 32px;
    }
    
    /* تحسين معلومات المستخدم للشاشات الصغيرة */
    .mobile-user-info {
        padding: 20px;
        margin: 16px 4px;
    }
    
    .mobile-user-info .w-14 {
        width: 3.5rem;
        height: 3.5rem;
    }
    
    .mobile-user-info .text-lg {
        font-size: 1.25rem;
    }
    
    /* تحسين التنبيهات للشاشات الصغيرة */
    #mobileAlertsDropdown {
        margin: 16px 4px;
    }
    
    /* تحسين العناوين الفرعية */
    .mobile-section-title {
        font-size: 16px;
        padding: 12px 20px;
        margin: 24px 4px 12px 4px;
    }
    
    /* تحسين الفواصل */
    .mobile-divider {
        margin: 20px 4px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .admin-dropdown {
        background: rgba(17, 24, 39, 0.95);
        border-color: rgba(55, 65, 81, 0.5);
    }
    
    .admin-dropdown a {
        color: #d1d5db;
    }
    
    .admin-dropdown a:hover {
        background: rgba(55, 65, 81, 0.5);
    }
}
