/* إعادة تعيين الأنماط */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2196F3;
    --secondary-color: #64B5F6;
    --danger-color: #f44336;
    --success-color: #4CAF50;
    --warning-color: #FFA500;
    --dark-bg: #1a1a2e;
    --light-bg: #f5f5f5;
    --white: #ffffff;
    --text-dark: #333;
    --text-light: #666;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Google Fonts يتم تحميلها بشكل async في index.html مع display=swap في URL لتحسين الأداء */
/* font-display: swap يتم تطبيقه تلقائياً من خلال display=swap في Google Fonts URL */
/* هذا يمنع FOIT (Flash of Invisible Text) ويحسن FCP و LCP */

body {
    font-family: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* تحسين أداء النصوص */
    text-rendering: optimizeLegibility;
}

/* صفحة تسجيل الدخول */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: 10px;
    padding: 40px;
    box-shadow: var(--shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-light);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9em;
    color: var(--text-light);
}

/* القائمة الجانبية */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(100%);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-logo {
    max-width: 100%;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.sidebar-header h2 {
    color: var(--primary-color);
    font-size: 1.3em;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

.nav-link.active {
    background: var(--primary-color);
    color: var(--white);
}

.nav-link i {
    margin-left: 10px;
    font-size: 1.2em;
}

.nav-link {
    position: relative;
}

.nav-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger-color);
    color: var(--white);
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 0 5px;
    box-shadow: 0 2px 4px rgba(244, 67, 54, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

.nav-link.active .nav-badge {
    background: var(--white);
    color: var(--danger-color);
}

.mobile-nav-item {
    position: relative;
}

.mobile-nav-item .nav-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger-color);
    color: var(--white);
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 0 5px;
    box-shadow: 0 2px 4px rgba(244, 67, 54, 0.3);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.section-header h2 i {
    margin-left: 8px;
    color: var(--primary-color);
}

.settings-section h3 i {
    margin-left: 8px;
    color: var(--primary-color);
}

.btn i {
    margin-left: 5px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    margin-bottom: 15px;
}

.user-info p {
    font-size: 0.9em;
    color: var(--text-light);
}

/* عرض رقم الإصدار */
.app-version {
    text-align: center;
    padding: 10px 0;
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
}

.app-version small {
    color: var(--text-light);
    font-size: 0.75em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.version-btn {
    background: none !important;
    border: none !important;
    color: var(--text-light) !important;
    font-size: 0.75em !important;
    cursor: pointer !important;
    padding: 5px 10px !important;
    border-radius: 5px !important;
    transition: all 0.3s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    font-family: inherit !important;
    width: 100% !important;
    justify-content: center !important;
}

.version-btn:hover {
    background: var(--light-bg) !important;
    color: var(--primary-color) !important;
}

.version-btn:active {
    transform: scale(0.95);
}

/* Version Modal Styles */
.version-modal-content {
    padding: 0;
    overflow: hidden;
}

.version-modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 25px 30px;
    border-bottom: none;
    position: relative;
    overflow: hidden;
}

.version-modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.version-modal-header h3 {
    color: var(--white) !important;
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.version-modal-header h3 i {
    font-size: 1.3em;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.version-modal-header .btn-close {
    color: var(--white) !important;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.version-modal-header .btn-close:hover {
    opacity: 1;
    color: var(--white) !important;
}

.version-modal-body {
    padding: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

.version-header-info {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 30px 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.3);
}

.version-header-info::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
}

.version-header-info h2 {
    color: var(--white);
    margin: 0 0 15px 0;
    font-size: 2em;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.version-header-info h2 i {
    font-size: 1.2em;
    background: rgba(255, 255, 255, 0.2);
    padding: 12px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.version-header-info .version-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.version-header-info .version-meta-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 1em;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.version-header-info .version-meta-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.version-header-info .version-meta-item i {
    font-size: 1.1em;
}

.version-date {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95em;
    margin-top: 12px;
    position: relative;
    z-index: 1;
}

.version-info-section {
    margin-bottom: 30px;
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.version-info-section:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.version-info-section:last-child {
    margin-bottom: 0;
}

.version-info-section h4 {
    color: var(--text-dark);
    margin: 0 0 18px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2em;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--light-bg);
}

.version-info-section h4 i {
    font-size: 1.3em;
    padding: 8px;
    border-radius: 10px;
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.version-info-section h4 i.bi-star-fill {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
}

.version-info-section h4 i.bi-tools {
    background: rgba(255, 165, 0, 0.1);
    color: var(--warning-color);
}

.version-info-section h4 i.bi-graph-up-arrow {
    background: rgba(33, 150, 243, 0.1);
    color: var(--primary-color);
}

.version-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.version-list li {
    padding: 15px 18px;
    background: var(--light-bg);
    border-radius: 10px;
    border-right: 4px solid var(--primary-color);
    color: var(--text-dark);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.version-list li::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.version-list li:hover {
    background: rgba(33, 150, 243, 0.08);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
}

.version-list li:hover::before {
    width: 100%;
    opacity: 0.1;
}

.version-list li i {
    color: var(--primary-color);
    margin-top: 2px;
    font-size: 1.1em;
    flex-shrink: 0;
    background: rgba(33, 150, 243, 0.1);
    padding: 6px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.version-list li span {
    flex: 1;
    line-height: 1.6;
    font-size: 0.95em;
}

.version-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.version-empty-state i {
    font-size: 3em;
    color: var(--text-light);
    opacity: 0.5;
    margin-bottom: 15px;
    display: block;
}

.version-empty-state p {
    font-size: 1em;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 767.98px) {
    .version-modal-body {
        padding: 20px;
        max-height: 70vh;
    }
    
    .version-header-info {
        padding: 25px 20px;
    }
    
    .version-header-info h2 {
        font-size: 1.6em;
        flex-direction: column;
        gap: 10px;
    }
    
    .version-header-info .version-meta {
        gap: 8px;
    }
    
    .version-header-info .version-meta-item {
        font-size: 0.9em;
        padding: 6px 12px;
    }
    
    .version-info-section {
        padding: 15px;
    }
    
    .version-info-section h4 {
        font-size: 1.1em;
    }
    
    .version-list li {
        padding: 12px 15px;
        font-size: 0.9em;
    }
}

.app-version-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--light-bg);
    border-radius: 15px;
    font-size: 0.75em;
    color: var(--text-light);
    margin-left: 10px;
    transition: all 0.3s ease;
}

.app-version-badge:hover {
    background: var(--border-color);
    color: var(--text-dark);
}

/* Responsive - إخفاء badge في الموبايل */
@media (max-width: 767.98px) {
    .app-version-badge {
        display: none;
    }
}

/* معلومات المستخدم في الـ top-bar للهواتف - مخفي افتراضياً */
.mobile-top-user-info {
    display: none;
}

/* المحتوى الرئيسي */
.main-content {
    margin-right: 260px;
    min-height: 100vh;
    transition: margin 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-right: 0;
}

.top-bar {
    background: var(--white);
    padding: 15px 30px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-menu {
    display: none;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--primary-color);
}

.top-bar h1 {
    flex: 1;
    font-size: 1.5em;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar h1 i {
    color: var(--primary-color);
    font-size: 1.1em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    position: relative;
}

.header-actions .btn-icon {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    font-size: 1.2em;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: var(--light-bg);
    border: 2px solid transparent;
}

.header-actions .btn-icon:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(33, 150, 243, 0.3);
}

.header-actions .btn-icon.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.header-actions .sync-indicator {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    font-size: 0.9em;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .header-actions {
        gap: 8px;
        flex-wrap: nowrap;
    }
    
    .header-actions .btn-icon {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
        font-size: 1.1em;
    }
    
    .header-actions .sync-indicator {
        min-height: 40px;
        padding: 8px 12px;
        font-size: 0.85em;
    }
    
    .top-bar h1 {
        font-size: 1.2em;
    }
    
    .top-bar {
        padding: 12px 15px;
    }
}

.sync-indicator {
    font-size: 0.85em;
    padding: 6px 12px;
    background: var(--light-bg);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

/* إخفاء زر التحديث على الشاشات الكبيرة (يظهر فقط على الهاتف) */
.top-bar .header-actions #mobileRefreshBtn {
    display: none !important;
}

.sync-indicator:hover {
    background: var(--border-color);
    transform: scale(1.05);
}

.sync-indicator:active {
    transform: scale(0.95);
}

/* ✅ مؤشر حالة الاتصال */
.connection-indicator {
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 0.85em;
    margin-left: 10px;
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--success-color);
}

.connection-indicator.offline {
    background: var(--warning-color);
}

.connection-indicator.offline .connection-text::after {
    content: ' (وضع عدم الاتصال)';
    font-size: 0.9em;
    opacity: 0.9;
}

.connection-indicator:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.connection-indicator:active {
    transform: scale(0.95);
}

.content {
    padding: 30px;
}

/* ضمان أن جميع الأقسام لها مساحة سفلية كافية على الهاتف */
@media (max-width: 767.98px) {
    .section,
    .content {
        padding-bottom: 30px;
    }
    
    /* تحسينات عامة للنماذج والبطاقات */
    .card,
    .form-container,
    .data-card {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    /* تصغير الأزرار */
    .btn {
        padding: 10px 15px !important;
        font-size: 14px !important;
    }
    
    .btn-icon {
        padding: 8px 12px !important;
        font-size: 13px !important;
    }
    
    /* تحسين الجداول */
    .data-table {
        font-size: 13px !important;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px !important;
        font-size: 12px !important;
    }
    
    /* تحسين العناوين */
    .section-header h2 {
        font-size: 1.3em !important;
    }
    
    h3 {
        font-size: 1.1em !important;
    }
    
    h4 {
        font-size: 1em !important;
    }
}

/* الأقسام */
.section {
    display: none !important;
}

.section.active {
    display: block !important;
}

/* منع عرض الأقسام الفرعية للمخزون إلا عند الحاجة */
.inventory-section {
    display: none !important;
}

.inventory-section.active {
    display: block !important;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-header h2 {
    color: var(--text-dark);
}

/* الإحصائيات */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* قسم بطاقات الفنيين */
.technicians-section {
    margin-bottom: 30px;
}

.technicians-section .section-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.technicians-section .section-header h2 {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.technicians-section .section-header h2 i {
    color: var(--primary-color);
}

.technicians-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.technician-card {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.technician-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

/* ✅ بطاقة ذهبية مميزة للفني "مالك" في الفرع الأول */
.technician-card.premium-gold {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
    border: 3px solid #FFD700;
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.2), inset 0 0 20px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    animation: goldGlow 2s ease-in-out infinite alternate;
}

@keyframes goldGlow {
    0% {
        box-shadow: 0 8px 30px rgba(255, 215, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.2), inset 0 0 20px rgba(255, 255, 255, 0.1);
    }
    100% {
        box-shadow: 0 8px 40px rgba(255, 215, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.4), inset 0 0 20px rgba(255, 255, 255, 0.2);
    }
}

.technician-card.premium-gold::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 3s infinite;
}

.technician-card.premium-gold::after {
    content: '⭐';
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 1.5em;
    opacity: 0.3;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

.technician-card.premium-gold:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(255, 215, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.4);
    border-color: #FFD700;
}

.technician-card.premium-gold .technician-avatar {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5), 0 0 10px rgba(255, 215, 0, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.9);
    animation: avatarPulse 2s ease-in-out infinite;
}

.technician-card.premium-gold .technician-avatar-img {
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.technician-card.premium-gold .technician-avatar-fallback {
    color: #8B4513;
    font-weight: 800;
}

@keyframes avatarPulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5), 0 0 10px rgba(255, 215, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 215, 0, 0.7), 0 0 15px rgba(255, 215, 0, 0.5);
    }
}

.technician-card.premium-gold .technician-name {
    color: #8B4513;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.5), 0 0 8px rgba(255, 215, 0, 0.3);
    font-size: 1.3em;
    font-weight: 800;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}

.technician-card.premium-gold .technician-username {
    color: rgba(139, 69, 19, 0.8);
    font-weight: 600;
}

.technician-card.premium-gold .rating-stars .star {
    color: #FFD700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
    animation: starTwinkle 1.5s ease-in-out infinite;
}

.technician-card.premium-gold .rating-stars .star:nth-child(1) {
    animation-delay: 0s;
}

.technician-card.premium-gold .rating-stars .star:nth-child(2) {
    animation-delay: 0.1s;
}

.technician-card.premium-gold .rating-stars .star:nth-child(3) {
    animation-delay: 0.2s;
}

.technician-card.premium-gold .rating-stars .star:nth-child(4) {
    animation-delay: 0.3s;
}

.technician-card.premium-gold .rating-stars .star:nth-child(5) {
    animation-delay: 0.4s;
}

@keyframes starTwinkle {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
    }
    50% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 8px rgba(255, 215, 0, 1));
    }
}

.technician-card.premium-gold .rating-stars .star.empty {
    color: rgba(139, 69, 19, 0.3);
    animation: none;
}

.technician-card.premium-gold .rating-number {
    color: #8B4513;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.technician-card.premium-gold .technician-card-header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.technician-card.premium-gold .technician-monthly-rating {
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.technician-card.premium-gold .technician-stat-value {
    color: #8B4513;
    font-weight: 800;
}

.technician-card.premium-gold .technician-stat-label {
    color: rgba(139, 69, 19, 0.8);
    font-weight: 600;
}

.technician-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-bg);
    position: relative;
}

.technician-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.technician-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.technician-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.8em;
    font-weight: 700;
    flex-shrink: 0;
}

.technician-info {
    flex: 1;
    min-width: 0;
    padding-right: 50px; /* ✅ مساحة لأيقونة التعديل */
}

.technician-name-text {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.technician-name {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 5px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}

.technician-username {
    font-size: 0.9em;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.technician-rating {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.rating-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rating-label {
    font-size: 0.9em;
    color: var(--text-light);
    font-weight: 500;
}

.rating-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rating-stars {
    display: flex;
    gap: 3px;
    direction: ltr;
}

.rating-stars .star {
    font-size: 1.2em;
    color: var(--warning-color);
}

.rating-stars .star.empty {
    color: var(--border-color);
}

.rating-number {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--text-dark);
    min-width: 40px;
    text-align: left;
}

.rating-count {
    font-size: 0.85em;
    color: var(--text-light);
    margin-top: 5px;
}

.technician-stats {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--light-bg);
}

.technician-stat {
    flex: 1;
    text-align: center;
}

.technician-stat-value {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.technician-stat-label {
    font-size: 0.85em;
    color: var(--text-light);
}

.loading-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.loading-placeholder i {
    font-size: 2.5em;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: block;
    animation: spin 1s linear infinite;
}

.loading-placeholder p {
    font-size: 1.1em;
    margin: 0;
}

.empty-technicians {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-technicians i {
    font-size: 3em;
    color: var(--border-color);
    margin-bottom: 15px;
    display: block;
}

.empty-technicians p {
    font-size: 1.1em;
    margin: 0;
}

/* فلتر الفنيين */
.technicians-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.technicians-filters label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    color: var(--text-dark);
}

.technicians-filters .filter-input {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.technicians-filters .filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* زر تعديل التقييم */
.btn-edit-rating {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    flex-shrink: 0;
}

.technician-card-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--light-bg);
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.btn-edit-rating-footer {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.btn-edit-rating-footer:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.btn-edit-rating-footer i {
    font-size: 1.1em;
}

/* ✅ تصميم محسّن لجدول تقييمات وآراء العملاء */
.ratings-table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ratings-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
}

.ratings-table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

.ratings-table th {
    padding: 16px 20px;
    text-align: right;
    font-weight: 700;
    font-size: 0.95em;
    white-space: nowrap;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.ratings-table th:first-child {
    border-top-right-radius: 12px;
}

.ratings-table th:last-child {
    border-top-left-radius: 12px;
}

.ratings-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.ratings-table tbody tr:hover {
    background-color: var(--light-bg);
}

.ratings-table tbody tr:last-child {
    border-bottom: none;
}

.ratings-table td {
    padding: 16px 20px;
    text-align: right;
    vertical-align: middle;
    font-size: 0.9em;
}

.customer-name-cell {
    min-width: 150px;
}

.customer-name {
    font-weight: 600;
    color: var(--text-dark);
}

.repair-number-cell {
    min-width: 120px;
}

.repair-number-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--light-bg);
    color: var(--primary-color);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
}

.rating-cell {
    min-width: 150px;
}

.rating-display {
    display: flex;
    align-items: center;
    gap: 10px;
    direction: ltr;
    justify-content: flex-end;
}

.rating-stars-inline {
    display: flex;
    gap: 2px;
    direction: ltr;
}

.rating-stars-inline .star {
    font-size: 1em;
    color: var(--warning-color);
}

.rating-stars-inline .star.empty {
    color: var(--border-color);
}

.rating-number-badge {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.95em;
    min-width: 35px;
    text-align: center;
}

.comment-cell {
    max-width: 300px;
    min-width: 200px;
}

.comment-content {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
    line-height: 1.5;
    padding: 8px 12px;
    background: var(--light-bg);
    border-radius: 6px;
    cursor: help;
}

.comment-content i {
    color: var(--primary-color);
    flex-shrink: 0;
}

.no-comment {
    color: var(--text-light);
    font-style: italic;
}

.date-cell {
    min-width: 150px;
    white-space: nowrap;
}

.date-text {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    font-size: 0.85em;
}

.date-text i {
    color: var(--primary-color);
}

/* ✅ تصميم responsive للجدول */
@media (max-width: 768px) {
    .ratings-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .ratings-table {
        min-width: 800px;
    }
    
    .ratings-table th,
    .ratings-table td {
        padding: 12px 15px;
        font-size: 0.85em;
    }
    
    .comment-cell {
        max-width: 200px;
        min-width: 150px;
    }
}

.btn-edit-rating:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-edit-rating i {
    font-size: 1.1em;
}

/* التقييم الشهري */
.technician-monthly-rating {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--light-bg);
}

/* Modal تعديل التقييم */
/* ===== Technician Rating Modal Styles ===== */
.technician-rating-modal {
    direction: rtl;
}

.technician-rating-modal-content {
    border: 2px solid var(--primary-color);
    box-shadow: 0 10px 40px rgba(33, 150, 243, 0.2);
    animation: slideDown 0.3s ease-out;
}

.technician-rating-header {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.1) 0%, rgba(33, 150, 243, 0.05) 100%);
    border-bottom: 2px solid var(--primary-color);
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.technician-rating-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.technician-rating-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
    animation: starPulse 2s infinite;
}

.technician-rating-icon i {
    font-size: 24px;
    color: var(--white);
}

@keyframes starPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.technician-rating-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.3em;
    font-weight: 700;
}

.technician-rating-close {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--primary-color);
    transition: all 0.3s ease;
    padding: 0;
    line-height: 1;
}

.technician-rating-close:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: rotate(90deg);
}

.technician-rating-body {
    padding: 25px;
}

.technician-rating-group {
    margin-bottom: 25px;
}

.technician-rating-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1em;
}

.technician-rating-label i {
    color: var(--primary-color);
    font-size: 1.1em;
}

.star-rating-edit-container {
    background: var(--light-bg);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.star-rating-edit-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.star-rating-edit {
    display: flex;
    gap: 8px;
    justify-content: center;
    direction: rtl;
    flex-direction: row-reverse;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.star-edit {
    font-size: 2.8em;
    color: var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.star-edit:hover {
    transform: scale(1.15) rotate(5deg);
    color: var(--warning-color);
}

.star-edit.active {
    color: var(--warning-color);
    transform: scale(1.1);
}

.star-edit.active i::before {
    content: "\f586"; /* bi-star-fill */
}

.star-rating-display {
    text-align: center;
    padding-top: 10px;
    border-top: 2px solid var(--border-color);
    margin-top: 15px;
}

.star-rating-display .rating-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 5px;
}

.star-rating-display .rating-max {
    font-size: 1.2em;
    color: var(--text-light);
    font-weight: 500;
}

.rating-error {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--danger-color);
    font-size: 0.9em;
    margin-top: 10px;
    padding: 10px 15px;
    background: rgba(244, 67, 54, 0.1);
    border-right: 3px solid var(--danger-color);
    border-radius: 8px;
}

.rating-error i {
    font-size: 1.1em;
}

.technician-note-group {
    margin-bottom: 0;
}

.technician-note-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95em;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: all 0.3s ease;
    background: var(--white);
    color: var(--text-dark);
}

.technician-note-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.technician-note-textarea::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

.technician-rating-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    background: var(--light-bg);
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    margin-top: 0;
}

.technician-rating-footer .btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.technician-rating-footer .btn i {
    font-size: 1.1em;
}

/* Responsive Design for Technician Rating Modal */
@media (max-width: 768px) {
    .technician-rating-header {
        padding: 15px 20px;
        flex-direction: row;
    }
    
    .technician-rating-icon {
        width: 40px;
        height: 40px;
    }
    
    .technician-rating-icon i {
        font-size: 20px;
    }
    
    .technician-rating-header h3 {
        font-size: 1.1em;
    }
    
    .technician-rating-body {
        padding: 20px;
    }
    
    .star-edit {
        font-size: 2.2em;
    }
    
    .star-rating-display .rating-value {
        font-size: 1.6em;
    }
    
    .technician-rating-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .technician-rating-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .technician-rating-header {
        padding: 12px 15px;
    }
    
    .technician-rating-icon {
        width: 35px;
        height: 35px;
    }
    
    .technician-rating-icon i {
        font-size: 18px;
    }
    
    .technician-rating-header h3 {
        font-size: 1em;
    }
    
    .technician-rating-body {
        padding: 15px;
    }
    
    .star-rating-edit-container {
        padding: 15px;
    }
    
    .star-edit {
        font-size: 1.8em;
        padding: 3px;
    }
    
    .star-rating-display .rating-value {
        font-size: 1.4em;
    }
    
    .technician-note-textarea {
        min-height: 80px;
        font-size: 0.9em;
    }
}

/* Responsive Design for Technicians */
@media (max-width: 991.98px) {
    .technicians-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .technician-card {
        padding: 20px;
    }
}

@media (max-width: 767.98px) {
    .technicians-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .technician-card {
        padding: 15px;
    }
    
    .technician-avatar {
        width: 50px;
        height: 50px;
        font-size: 1.5em;
    }
    
    .technician-name {
        font-size: 1.1em;
    }
    
    .technician-username {
        font-size: 0.85em;
    }
}

@media (max-width: 575.98px) {
    .technicians-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .technicians-section .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .technicians-section .section-header h2 {
        font-size: 1.3em;
    }
    
    .technicians-filters {
        width: 100%;
    }
    
    .technicians-filters .filter-input {
        flex: 1;
    }
    
    .technician-card {
        padding: 15px;
    }
    
    .technician-card-header {
        gap: 12px;
    }
    
    .btn-edit-rating {
        padding: 6px 10px;
        font-size: 0.9em;
    }
    
    .technician-avatar {
        width: 45px;
        height: 45px;
        font-size: 1.3em;
    }
    
    .technician-name {
        font-size: 1em;
    }
    
    .rating-stars .star {
        font-size: 1em;
    }
    
    .technician-stat-value {
        font-size: 1.1em;
    }
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    font-size: 2.5em;
    color: var(--primary-color);
}

.stat-icon i {
    font-size: 1em;
}

.stat-info h3 {
    font-size: 0.9em;
    color: var(--text-light);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
}

/* النماذج */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* الأزرار */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: rgba(24, 175, 57, 1);
    color: var(--white);
}

.btn-primary:hover {
    background: #1976D2;
}

.btn-secondary {
    background: var(--text-light);
    color: var(--white);
}

.btn-secondary:hover {
    background: #555;
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background: #388E3C;
}

.btn-warning {
    background: var(--warning-color);
    color: var(--white);
}

.btn-warning:hover {
    background: #FF8C00;
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background: #D32F2F;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.9em;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.8em;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s ease;
}

.btn-icon:hover {
    transform: scale(1.1);
}

/* قائمة الإجراءات المنسدلة في جدول الصيانة */
.actions-dropdown {
    position: relative;
    display: inline-flex;
    justify-content: flex-start;
    z-index: 1;
    overflow: visible; /* ✅ إصلاح: السماح للقائمة المنسدلة بالظهور خارج الحاوية */
}

.actions-dropdown-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    min-width: 100px;
    justify-content: center;
}

.actions-dropdown-btn:hover {
    background: var(--secondary-color);
    box-shadow: var(--shadow);
}

.actions-dropdown-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

.actions-dropdown-menu {
    display: none;
    position: absolute;
    top: auto;
    bottom: 100%;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 200px;
    max-width: 280px;
    z-index: 10000;
    margin-bottom: 5px;
    overflow-y: auto;
    max-height: 500px;
    padding: 4px 0;
}

/* ✅ إصلاح: عندما تكون القائمة مفتوحة، JavaScript يضبط position: fixed ديناميكياً */
.actions-dropdown-menu.show {
    display: block;
    /* position سيتم ضبطه ديناميكياً في JavaScript */
}

.actions-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-dark);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
    min-height: 44px;
}

.actions-dropdown-item:last-child {
    border-bottom: none;
}

.actions-dropdown-item:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

.actions-dropdown-item i {
    font-size: 1em;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.actions-dropdown-item-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.actions-dropdown-item-title {
    font-weight: 500;
    font-size: 0.85em;
    line-height: 1.3;
}

.actions-dropdown-item-desc {
    font-size: 0.7em;
    color: var(--text-light);
    line-height: 1.2;
    margin-top: 2px;
}

.actions-dropdown-item.delete-item {
    color: var(--danger-color);
}

.actions-dropdown-item.delete-item:hover {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger-color);
}

/* ✅ إخفاء زر عرض التفاصيل على الكمبيوتر - يظهر فقط على الهواتف */
.actions-dropdown-item.mobile-only {
    display: flex; /* افتراضي: يظهر على الهواتف */
}

/* إخفاء على الشاشات الكبيرة (768px وأكبر) */
@media (min-width: 768px) {
    .actions-dropdown-item.mobile-only {
        display: none !important;
    }
}

/* إظهار على الشاشات الصغيرة (أقل من 768px) */
@media (max-width: 767.98px) {
    .actions-dropdown-item.mobile-only {
        display: flex !important;
    }
}

/* إغلاق القائمة عند النقر خارجها */
.actions-dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: none;
}

.actions-dropdown-overlay.show {
    display: block;
}

/* Responsive Design للقائمة المنسدلة */
@media (max-width: 991.98px) {
    .actions-dropdown-btn {
        padding: 8px 16px;
        font-size: 0.9em;
        min-width: 100px;
    }
    
    .actions-dropdown-menu {
        min-width: 180px;
        max-width: 250px;
    }
    
    .actions-dropdown-item {
        padding: 9px 12px;
        gap: 8px;
    }
    
    .actions-dropdown-item i {
        font-size: 1em;
        width: 16px;
    }
    
    .actions-dropdown-item-title {
        font-size: 0.85em;
    }
    
    .actions-dropdown-item-desc {
        font-size: 0.7em;
    }
}

@media (max-width: 575.98px) {
    .actions-dropdown-btn {
        padding: 8px 12px;
        font-size: 0.85em;
        min-width: 90px;
    }
    
    .actions-dropdown-btn span {
        display: none; /* إخفاء النص على الشاشات الصغيرة جداً */
    }
    
    .actions-dropdown-menu {
        min-width: 180px;
        right: 0;
    }
    
    .actions-dropdown-item {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .actions-dropdown-item i {
        font-size: 1.1em;
        width: 18px;
    }
    
    .actions-dropdown-item-title {
        font-size: 0.85em;
    }
    
    .actions-dropdown-item-desc {
        font-size: 0.7em;
    }
}

/* الجداول */
.table-container {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

/* ✅ إصلاح: السماح للقائمة المنسدلة بالظهور خارج الجدول */
.table-container .actions-dropdown {
    overflow: visible;
    position: relative;
    z-index: 10;
}

.table-container table td {
    overflow: visible; /* ✅ إصلاح: السماح للقائمة المنسدلة بالظهور خارج الخلية */
    position: relative;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--primary-color);
    color: var(--white);
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: right;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--light-bg);
}

.data-table tbody tr.low-stock {
    background: #fff3cd;
}

/* الشارات */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    color: var(--white);
    font-size: 0.85em;
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: 500;
}

.badge-warning {
    background: var(--warning-color);
    color: var(--white);
}

/* النوافذ المنبثقة */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-sm {
    max-width: 450px;
}

/* التأكد من أن النماذج تستخدم العرض الكامل على الموبايل */
@media (max-width: 768px) {
    .modal-content.modal-sm {
        width: 98% !important;
        max-width: 98% !important;
    }
}

@media (max-width: 480px) {
    .modal-content.modal-sm {
        width: 100% !important;
        max-width: 100% !important;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-header h3 {
    color: var(--text-dark);
}

.btn-close {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

.btn-close:hover {
    color: var(--danger-color);
}

.modal form {
    padding: 25px;
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    min-height: 0;
    max-height: calc(90vh - 140px);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--light-bg);
}

/* تحسين شريط التمرير لمتصفحات Webkit (Chrome, Safari, Edge) */
.modal form::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.modal form::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 10px;
}

.modal form::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
    border: 2px solid var(--light-bg);
}

.modal form::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* شريط السحب الأفقي (السفلي) */
.modal form::-webkit-scrollbar:horizontal {
    height: 12px;
}

.modal form::-webkit-scrollbar-thumb:horizontal {
    background: var(--primary-color);
    border-radius: 10px;
    border: 2px solid var(--light-bg);
}

.modal form::-webkit-scrollbar-thumb:horizontal:hover {
    background: var(--secondary-color);
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding: 0 25px 25px 25px;
    flex-shrink: 0;
}

/* الفلاتر */
.filters-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input,
.filter-select {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
}

.search-input {
    flex: 1;
    min-width: 250px;
}

.filter-select {
    min-width: 150px;
}

/* تنسيق حقول التاريخ في الفلاتر */
.filter-select[type="date"] {
    min-width: 160px;
    cursor: pointer;
}

.filter-select[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.filter-select[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-pagination {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-pagination:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.btn-pagination.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.pagination-dots {
    padding: 8px 4px;
    color: var(--text-light);
    user-select: none;
}

/* تحسينات pagination للإعدادات */
.settings-section .pagination {
    margin-top: 20px;
    margin-bottom: 10px;
}

.table-container + .pagination {
    margin-top: 15px;
}

/* نافذة تأكيد الحذف المحسّنة */
.delete-confirmation-modal {
    border: 2px solid var(--danger-color);
    box-shadow: 0 10px 40px rgba(244, 67, 54, 0.2) !important;
}

.delete-modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 25px 30px;
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1) 0%, rgba(244, 67, 54, 0.05) 100%);
    border-bottom: 2px solid var(--danger-color);
    position: relative;
}

.delete-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--danger-color) 0%, #d32f2f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
    animation: pulse 2s infinite;
}

.delete-icon-wrapper i {
    font-size: 28px;
    color: white;
}

.delete-modal-header h3 {
    flex: 1;
    margin: 0;
    color: var(--danger-color);
    font-size: 1.4em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.delete-modal-header .modal-close {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid var(--danger-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--danger-color);
    font-size: 1.1em;
}

.delete-modal-header .modal-close:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

.delete-modal-body {
    padding: 30px;
}

.warning-message {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid var(--warning-color);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 25px;
}

.warning-message p {
    margin: 0;
    color: var(--text-dark);
    font-size: 1.05em;
    line-height: 1.6;
    white-space: pre-line;
    font-weight: 500;
}

.delete-confirm-section {
    margin-top: 20px;
}

.delete-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--text-dark);
    font-size: 1.05em;
    font-weight: 600;
}

.delete-label i {
    color: var(--primary-color);
    font-size: 1.2em;
}

.delete-label strong {
    color: var(--danger-color);
    font-weight: 700;
    font-size: 1.1em;
}

.delete-confirm-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1em;
    text-align: center;
    letter-spacing: 3px;
    font-weight: 600;
    transition: all 0.3s ease;
    background: var(--white);
    color: var(--text-dark);
    font-family: 'Courier New', monospace;
    text-transform: lowercase;
}

.delete-confirm-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.delete-confirm-input::placeholder {
    letter-spacing: 1px;
    color: var(--text-light);
    font-weight: normal;
}

.input-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    color: var(--text-light);
    font-size: 0.9em;
}

.input-hint i {
    color: var(--primary-color);
}

.delete-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 30px;
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 10px 10px;
}

.delete-modal-footer .btn {
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.btn-cancel {
    background: var(--white);
    border: 2px solid var(--border-color);
    color: var(--text-dark);
}

.btn-cancel:hover {
    background: var(--light-bg);
    border-color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-confirm-delete {
    background: linear-gradient(135deg, var(--danger-color) 0%, #d32f2f 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.btn-confirm-delete:hover:not(:disabled) {
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

.btn-confirm-delete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Responsive */
@media (max-width: 576px) {
    .delete-confirmation-modal {
        max-width: 95% !important;
        margin: 20px;
    }
    
    .delete-modal-header {
        flex-wrap: wrap;
        padding: 20px;
    }
    
    .delete-icon-wrapper {
        width: 50px;
        height: 50px;
    }
    
    .delete-icon-wrapper i {
        font-size: 24px;
    }
    
    .delete-modal-header h3 {
        font-size: 1.2em;
    }
    
    .delete-modal-body {
        padding: 20px;
    }
    
    .delete-modal-footer {
        flex-direction: column-reverse;
        padding: 15px 20px;
    }
    
    .delete-modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* نافذة تعديل التقييم التراكمي المحسّنة */
.rating-edit-modal {
    border: 2px solid var(--warning-color);
    box-shadow: 0 10px 40px rgba(255, 152, 0, 0.2) !important;
}

.rating-modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 25px 30px;
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1) 0%, rgba(255, 152, 0, 0.05) 100%);
    border-bottom: 2px solid var(--warning-color);
    position: relative;
}

.rating-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--warning-color) 0%, #f57c00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    animation: starPulse 2s infinite;
}

.rating-icon-wrapper i {
    font-size: 28px;
    color: white;
}

.rating-modal-header h3 {
    flex: 1;
    margin: 0;
    color: var(--warning-color);
    font-size: 1.4em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rating-modal-header .modal-close {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid var(--warning-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--warning-color);
    font-size: 1.1em;
}

.rating-modal-header .modal-close:hover {
    background: var(--warning-color);
    color: white;
    transform: rotate(90deg);
}

.rating-modal-body {
    padding: 30px;
}

.rating-info-section {
    margin-bottom: 30px;
}

.rating-description {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px 0;
    padding: 15px 20px;
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    color: var(--text-dark);
    font-size: 1.05em;
    line-height: 1.6;
    font-weight: 500;
}

.rating-description i {
    color: var(--primary-color);
    font-size: 1.2em;
}

.current-rating-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--light-bg);
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

.current-label {
    color: var(--text-light);
    font-size: 0.95em;
}

.current-value {
    color: var(--warning-color);
    font-size: 1.2em;
    font-weight: 700;
}

.rating-stars-section {
    text-align: center;
}

.rating-stars-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
    padding: 20px;
    background: var(--light-bg);
    border-radius: 12px;
    flex-wrap: wrap;
}

.star-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 10px;
    border-radius: 8px;
}

.star-wrapper:hover {
    background: rgba(255, 152, 0, 0.1);
    transform: translateY(-5px);
}

.star-wrapper i {
    font-size: 48px;
    color: var(--border-color);
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.star-wrapper i.bi-star-fill {
    color: var(--warning-color);
    animation: starGlow 1.5s ease-in-out infinite;
}

.star-wrapper:hover i {
    transform: scale(1.2);
    filter: drop-shadow(0 4px 8px rgba(255, 152, 0, 0.4));
}

.star-number {
    font-size: 0.85em;
    color: var(--text-light);
    font-weight: 600;
    margin-top: 5px;
}

.selected-rating-display {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1) 0%, rgba(255, 152, 0, 0.05) 100%);
    border-radius: 12px;
    border: 2px solid var(--warning-color);
}

.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--warning-color) 0%, #f57c00 100%);
    color: white;
    border-radius: 50px;
    font-size: 1.5em;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    margin-bottom: 10px;
}

.rating-badge i {
    font-size: 1.2em;
}

.rating-badge #ratingText {
    font-size: 1.3em;
}

.rating-max {
    font-size: 0.8em;
    opacity: 0.9;
}

.rating-label {
    margin: 0;
    color: var(--text-dark);
    font-size: 1em;
    font-weight: 600;
}

.rating-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 30px;
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 10px 10px;
}

.rating-modal-footer .btn {
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.btn-cancel-rating {
    background: var(--white);
    border: 2px solid var(--border-color);
    color: var(--text-dark);
}

.btn-cancel-rating:hover {
    background: var(--light-bg);
    border-color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-save-rating {
    background: linear-gradient(135deg, var(--warning-color) 0%, #f57c00 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.btn-save-rating:hover {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

/* Animations for rating modal */
@keyframes starPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes starGlow {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(255, 152, 0, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(255, 152, 0, 0.8));
    }
}

/* Responsive for rating modal */
@media (max-width: 576px) {
    .rating-edit-modal {
        max-width: 95% !important;
        margin: 20px;
    }
    
    .rating-modal-header {
        flex-wrap: wrap;
        padding: 20px;
    }
    
    .rating-icon-wrapper {
        width: 50px;
        height: 50px;
    }
    
    .rating-icon-wrapper i {
        font-size: 24px;
    }
    
    .rating-modal-header h3 {
        font-size: 1.2em;
    }
    
    .rating-modal-body {
        padding: 20px;
    }
    
    .rating-stars-container {
        gap: 10px;
        padding: 15px;
    }
    
    .star-wrapper i {
        font-size: 36px;
    }
    
    .rating-modal-footer {
        flex-direction: column-reverse;
        padding: 15px 20px;
    }
    
    .rating-modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

.pagination-dots {
    padding: 8px 5px;
    color: var(--text-light);
}

/* التقارير */
.report-filters {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.report-result {
    margin-top: 25px;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
}

.summary-card h3 {
    color: var(--text-light);
    font-size: 1em;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 1.8em;
    font-weight: bold;
}

.summary-value.revenue {
    color: var(--success-color);
}

.summary-value.expense {
    color: var(--danger-color);
}

.summary-value.profit {
    color: var(--success-color);
}

.report-details {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.report-details h3 {
    margin: 20px 0 15px 0;
    color: var(--text-dark);
}

/* الإعدادات */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.settings-section {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.settings-section h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
}

/* تبويبات الفروع */
.branch-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
}

.branch-tab {
    background: transparent;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.branch-tab:hover {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.05);
}

.branch-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(33, 150, 243, 0.05);
}

.branch-tab i {
    font-size: 18px;
}

/* نماذج الفروع */
.branch-form {
    display: none;
    animation: fadeIn 0.3s ease;
}

.branch-form.active {
    display: block;
}

/* أقسام لوحة التحكم للفروع */
.dashboard-branch {
    display: none;
    animation: fadeIn 0.3s ease;
}

.dashboard-branch.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.branch-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.branch-header h4 {
    margin: 0;
    color: var(--text-dark);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.branch-header h4 i {
    color: var(--primary-color);
}

.backup-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* أقسام المزامنة والنسخ الاحتياطي */
.sync-backup-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.sync-backup-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.sync-backup-section h4 {
    margin-bottom: 15px;
    color: var(--text-dark);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-backup-section h4 i {
    color: var(--primary-color);
    font-size: 18px;
}

.backup-info-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--light-bg);
    border-radius: 8px;
}

.info-label {
    font-weight: 500;
    color: var(--text-dark);
}

.info-value {
    color: var(--text-light);
    font-weight: 400;
}

.info-value.enabled {
    color: var(--success-color);
    font-weight: 500;
}

.info-value.disabled {
    color: var(--text-light);
}

.info-value.error {
    color: var(--danger-color);
}

/* إدارة التخزين */
.storage-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.storage-tab {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.storage-tab:hover {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.05);
}

.storage-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(33, 150, 243, 0.05);
}

.storage-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.storage-content.active {
    display: block;
}

.storage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.storage-header h5 {
    margin: 0;
    color: var(--text-dark);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.storage-header h5 i {
    color: var(--primary-color);
}

.storage-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 8px;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-label {
    font-weight: 500;
    color: var(--text-dark);
}

.summary-value {
    color: var(--primary-color);
    font-weight: 600;
}

.storage-files {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.storage-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    gap: 10px;
}

.file-checkbox {
    display: flex;
    align-items: center;
}

.file-checkbox-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.storage-bulk-controls {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: var(--light-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.storage-file-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.storage-file-item.database-item {
    border-left: 4px solid var(--primary-color);
    background: rgba(33, 150, 243, 0.02);
}

.source-badge {
    display: inline-block;
    vertical-align: middle;
}

.file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-name {
    font-weight: 500;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-name i {
    color: var(--primary-color);
}

.file-details {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: var(--text-light);
}

.file-size {
    font-weight: 500;
}

.file-actions {
    display: flex;
    gap: 10px;
}

.storage-bulk-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    text-align: center;
}

.database-info {
    padding: 15px;
    background: var(--light-bg);
    border-radius: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .info-label {
    font-weight: 500;
    color: var(--text-dark);
}

.info-row .info-value {
    color: var(--primary-color);
    font-weight: 600;
}

/* الرسائل */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* أنماط قارئ الباركود */
#barcode-scanner-container {
    text-align: center;
    padding: 20px;
}

#scanner-area {
    width: 100%;
    height: 300px;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

#scanner-result {
    margin-top: 20px;
}

.scanner-loading {
    color: #666;
    font-size: 1.1em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.scanner-loading i {
    font-size: 2em;
    color: #2196F3;
    animation: pulse 2s infinite;
}

.scanner-error {
    color: #f44336;
    font-size: 1.1em;
    text-align: center;
    padding: 20px;
}

.scanner-error h4 {
    color: #f44336;
    margin-bottom: 15px;
}

.scanner-error ul {
    text-align: right;
    margin: 15px 0;
    padding-right: 20px;
}

.scanner-error li {
    margin-bottom: 5px;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* تحسينات للكاميرا */
#scanner-area video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

#scanner-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* مؤشر المسح */
.scan-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    z-index: 1000;
    animation: fadeInOut 3s infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* أنماط العمليات الخاسرة */
.highlighted-row {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107 !important;
    animation: highlightPulse 2s ease-in-out;
}

@keyframes highlightPulse {
    0% { background-color: #fff3cd; }
    50% { background-color: #ffeaa7; }
    100% { background-color: #fff3cd; }
}

/* أنماط صفوف العمليات الخاسرة */
.loss-operation-row {
    background-color: #f8d7da !important;
    border-left: 4px solid #dc3545 !important;
}

.loss-operation-row:hover {
    background-color: #f5c6cb !important;
}

.loss-operation-row td {
    color: #721c24;
}

/* أنماط نموذج تسجيل الخسارة */
#lossRepairInfo {
    transition: all 0.3s ease;
}

#lossRepairInfo > div {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* إخفاء حاوية البطاقات على الشاشات الكبيرة */
@media (min-width: 576px) {
    #repairs-section .repairs-mobile-container {
        display: none !important;
    }
}

@media (min-width: 576px) {
    /* إخفاء حاوية البطاقات على الشاشات الكبيرة */
    #repairs-section .repairs-mobile-container {
        display: none !important;
    }
    
    #lossRepairInfo > div {
        grid-template-columns: 1fr 1fr;
    }
}

/* تحسين عرض أزرار النموذج على الموبايل */
@media (max-width: 575.98px) {
    #lossOperationModal .modal-content {
        width: 95%;
        margin: 10px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    #lossOperationModal .form-group > div[style*="display: flex"] {
        flex-direction: column;
    }
    
    #lossOperationModal .form-group > div[style*="display: flex"] > button {
        width: 100%;
        margin-top: 10px;
    }
}

/* أنماط رقم العملية القابل للنسخ */
.repair-number-copyable {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.repair-number-copyable:hover {
    background: var(--light-bg) !important;
    color: var(--primary-color) !important;
}

.repair-number-copyable:active {
    transform: scale(0.95);
}

.repair-number-copyable i {
    font-size: 0.85em;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.repair-number-copyable:hover i {
    opacity: 1;
}

/* معلومات Pagination */
.pagination-info {
    margin-top: 15px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9em;
}

/* أنماط QR Scanner للخسارة */
#lossBarcodeScannerModal .modal-content {
    width: fit-content !important;
    max-width: 90vw !important;
    padding: 0 !important;
}

#lossBarcodeScannerModal .modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

#loss-scanner-area {
    position: relative;
    width: 100%;
    min-height: 400px;
    max-height: 70vh;
    overflow: hidden;
}

#loss-scanner-area video {
    width: 100% !important;
    height: 100% !important;
    max-height: 400px !important;
    max-width: 100% !important;
    min-height: 0 !important;
    object-fit: cover !important;
    display: block !important;
    position: relative;
    z-index: 0;
}

#loss-scanner-area canvas {
    display: none !important;
}

/* Ensure html5-qrcode container is visible */
#loss-scanner-area > div {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 400px !important;
    overflow: hidden !important;
}

#loss-scanner-area > div > div {
    max-height: 400px !important;
    overflow: hidden !important;
}

#loss-scanner-area > div > div > video {
    width: 100% !important;
    height: 100% !important;
    max-height: 400px !important;
    max-width: 100% !important;
    min-height: 0 !important;
    object-fit: cover !important;
    z-index: 0 !important;
}

/* Mobile responsive */
@media (max-width: 575.98px) {
    #loss-scanner-area {
        min-height: 300px;
    }
    
    #loss-scanner-area video,
    #loss-scanner-area > div,
    #loss-scanner-area > div > div,
    #loss-scanner-area > div > div > video {
        max-height: 300px !important;
    }
}

/* أنماط تفاصيل العملية الخاسرة */
.loss-details {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row label {
    font-weight: bold;
    color: #495057;
    min-width: 120px;
}

.detail-row span {
    color: #6c757d;
    text-align: right;
    flex: 1;
}

.loss-amount {
    color: #dc3545 !important;
    font-weight: bold;
    font-size: 1.1em;
}

.loss-operation-form {
    max-width: 600px;
}

.loss-reason-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
}

.loss-amount-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: right;
    font-size: 1.1em;
    font-weight: bold;
}

.loss-notes-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: vertical;
}

/* أنماط أزرار التصدير */
.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-success:focus {
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5);
}

/* أنماط أزرار العمليات */
.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.header-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.header-actions .btn-sm {
    padding: 8px 16px;
    font-size: 0.9em;
}

/* أنماط التصدير */
.export-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #28a745;
}

.export-section h4 {
    color: #28a745;
    margin-top: 0;
    margin-bottom: 10px;
}

.export-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.export-stats {
    color: #666;
    font-size: 0.9em;
}

.export-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-options .btn {
    min-width: 120px;
}

/* أنماط رسائل التصدير */
.export-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 10px;
}

.export-message.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.export-message.warning {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

/* أنماط إدارة النسخ الاحتياطي */
.backup-management-content {
    padding: 20px;
}

.backup-status-card,
.backup-config-card,
.backup-actions-card,
.backup-list-card,
.backup-cleanup-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.backup-status-card h3,
.backup-config-card h3,
.backup-actions-card h3,
.backup-list-card h3,
.backup-cleanup-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #2196F3;
    padding-bottom: 10px;
}

.status-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.status-label {
    font-weight: bold;
    color: #666;
}

.status-value {
    font-weight: bold;
}

.status-value.enabled {
    color: #28a745;
}

.status-value.disabled {
    color: #dc3545;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.backup-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.backup-list {
    max-height: 400px;
    overflow-y: auto;
}

.backup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.backup-info {
    flex: 1;
}

.backup-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.backup-details {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: #666;
}

.backup-actions {
    display: flex;
    gap: 5px;
}

.no-backups {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* أنماط عمود الفني المستلم */
.technician-name {
    font-weight: 500;
    color: #495057;
    font-size: 0.9em;
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 4px;
    display: inline-block;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #495057;
}

.info-value {
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

.info-value.enabled {
    background: #d4edda;
    color: #155724;
}

.info-value.disabled {
    background: #f8d7da;
    color: #721c24;
}

.info-value.error {
    background: #f8d7da;
    color: #721c24;
}

/* أنماط الحذف التلقائي */
.cleanup-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.status-value.warning {
    color: #ff9800;
}

.status-value.success {
    color: #28a745;
}

.old-backups-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 5px;
    padding: 15px;
    margin-top: 15px;
}

.old-backups-warning h4 {
    color: #856404;
    margin-top: 0;
    margin-bottom: 10px;
}

.old-backups-list {
    max-height: 200px;
    overflow-y: auto;
}

.old-backup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: white;
    border-radius: 3px;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.backup-age {
    color: #dc3545;
    font-weight: bold;
}

.more-backups {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 10px;
}

/* أنماط الاستجابة للهواتف */
@media (max-width: 767.98px) {
    .backup-management-content {
        padding: 15px;
    }
    
    .backup-status-card,
    .backup-config-card,
    .backup-actions-card,
    .backup-list-card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .status-info {
        grid-template-columns: 1fr;
    }
    
    .backup-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .backup-actions {
        justify-content: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .backup-actions {
        flex-direction: column;
    }
}

/* ===========================================
   التصميم المتجاوب للهواتف المحمولة
   =========================================== */

/* الهواتف المتوسطة (أقل من 768px) */
@media (max-width: 767.98px) {
    /* إخفاء الـ sidebar التقليدي */
    .sidebar {
        display: none !important;
    }
    
    /* إظهار الـ navbar العائم */
    .mobile-navbar {
        display: block !important;
    }
    
    /* زر القائمة المتنقلة - مخفي */
    .mobile-menu-btn {
        display: none !important;
    }
    
    /* زر القائمة في الـ top bar - مخفي */
    .btn-menu {
        display: none !important;
    }
    
    /* المحتوى الرئيسي */
    .main-content {
        margin-right: 0 !important;
        padding: 20px 15px 120px !important; /* مساحة من الأسفل للـ navbar - زيادة من 110px إلى 120px */
        padding-bottom: max(120px, calc(120px + env(safe-area-inset-bottom, 0px))) !important;
        width: 100% !important;
        min-height: 100vh;
        position: relative;
        z-index: 1;
    }
}

/* الهواتف الصغيرة (أقل من 576px) */
@media (max-width: 575.98px) {
    /* إخفاء الـ sidebar التقليدي */
    .sidebar {
        display: none !important;
    }
    
    /* إظهار الـ navbar العائم */
    .mobile-navbar {
        display: block !important;
    }
    
    /* زر القائمة المتنقلة - مخفي */
    .mobile-menu-btn {
        display: none !important;
    }
    
    /* زر القائمة في الـ top bar - مخفي */
    .btn-menu {
        display: none !important;
    }
    
    /* تحسين الـ navbar للهواتف الصغيرة */
    .mobile-navbar {
        padding: 14px 0;
    }
    
    .mobile-nav-container {
        gap: 2px;
        padding: 0 4px;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .mobile-nav-item {
        min-width: 60px;
        max-width: 80px;
        padding: 10px 6px;
        flex: 0 0 auto;
    }
    
    .mobile-nav-item i {
        font-size: 1.4em;
        margin-bottom: 4px;
    }
    
    .mobile-nav-item span {
        font-size: 0.75em;
        line-height: 1.2;
    }
    
    /* على الشاشات الصغيرة جداً - تقليل حجم الأزرار أكثر */
    @media (max-width: 360px) {
        .mobile-nav-item {
            min-width: 55px;
            max-width: 70px;
            padding: 8px 4px;
        }
        
        .mobile-nav-item i {
            font-size: 1.3em;
            margin-bottom: 3px;
        }
        
        .mobile-nav-item span {
            font-size: 0.7em;
            line-height: 1.2;
        }
    }
    
    /* المحتوى الرئيسي */
    .main-content {
        margin-right: 0 !important;
        padding: 15px 10px 120px !important; /* زيادة من 110px إلى 120px */
        padding-bottom: max(120px, calc(120px + env(safe-area-inset-bottom, 0px))) !important;
        width: 100% !important;
    }
    
    .sidebar-header {
        padding: 15px;
        border-bottom: 1px solid #e9ecef;
    }
    
    .sidebar-nav {
        padding: 10px 0;
    }
    
    .nav-item {
        margin: 5px 0;
    }
    
    .nav-link {
        padding: 12px 20px;
        font-size: 1em;
    }
    
    /* معلومات المستخدم وزر تسجيل الخروج في الـ top-bar للهواتف */
    .mobile-top-user-info {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 10px 0;
        margin-top: 0;
        border-top: 1px solid var(--border-color);
        gap: 10px;
    }
    
    .mobile-user-info {
        display: flex;
        flex-direction: column;
        gap: 5px;
        flex: 1;
    }
    
    .mobile-user-info p {
        margin: 0;
        font-size: 0.8em;
        color: var(--text-light);
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    .mobile-user-info i {
        font-size: 0.9em;
        color: var(--primary-color);
    }
    
    .mobile-user-info strong {
        color: var(--text-dark);
        font-weight: 600;
    }
    
    .mobile-top-user-info .btn-xs {
        padding: 6px 12px;
        font-size: 0.75em;
        white-space: nowrap;
        min-height: 32px;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    .mobile-top-user-info .btn-xs i {
        font-size: 0.85em;
    }
    
    /* تصغير الأزرار في header-actions للهواتف - العنوان والأزرار في نفس الصف */
    .top-bar {
        display: grid !important;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 8px !important;
        padding: 10px 12px !important;
        overflow: visible;
        box-sizing: border-box;
        align-items: center;
    }
    
    /* العنوان في الصف الأول، العمود الأول */
    .top-bar h1 {
        grid-column: 1;
        grid-row: 1;
    }
    
    /* الأزرار في الصف الأول، العمود الثاني */
    .top-bar .header-actions {
        grid-column: 2;
        grid-row: 1;
    }
    
    /* بيانات المستخدم في الصف الثاني، كامل العرض */
    .top-bar .mobile-top-user-info {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    
    /* إخفاء زر القائمة */
    .top-bar .btn-menu {
        display: none !important;
    }
    
    .top-bar h1 {
        font-size: 0.95em;
        margin: 0;
        min-width: 0;
        padding: 6px 10px;
        border: 2px solid var(--primary-color);
        border-radius: 8px;
        background: var(--white);
        color: var(--text-dark);
        text-align: center;
        font-weight: bold;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    
    .top-bar h1 i {
        font-size: 0.85em;
        flex-shrink: 0;
    }
    
    .header-actions {
        gap: 4px !important;
        width: auto !important;
        max-width: none !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
        min-width: 180px; /* الحد الأدنى لضمان ظهور الأزرار */
    }
    
    /* إخفاء شريط التمرير في header-actions */
    .header-actions::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    
    /* إعادة تنظيم الأزرار في الهيدر العلوي - صف واحد مع تمرير أفقي */
    .top-bar .header-actions {
        display: flex;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 4px;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        flex-shrink: 0 !important;
        align-items: center;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
        padding-bottom: 2px;
        box-sizing: border-box;
    }
    
    /* إخفاء شريط التمرير في header-actions */
    .top-bar .header-actions::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
        height: 0;
        width: 0;
    }
    
    /* ضمان أن جميع الأزرار في header-actions لا تنكمش */
    .top-bar .header-actions > * {
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
    }
    
    .top-bar .header-actions #installButton {
        width: 100%;
        flex-basis: 100%;
        order: -1;
        margin-bottom: 5px;
    }
    
    /* إخفاء مؤشر المزامنة بالكامل على الهاتف */
    .top-bar .header-actions .sync-indicator {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* زر الوضع الليلي - مربع صغير مع border */
    .top-bar .header-actions .btn-icon[onclick*="toggleDarkMode"] {
        min-width: 36px;
        min-height: 36px;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 2px solid var(--primary-color);
        border-radius: 6px;
        background: var(--white);
        display: flex;
        align-items: center;
        justify-content: center;
        order: 1;
        flex-shrink: 0;
    }
    
    /* زر الإشعارات - مربع صغير مع border */
    .top-bar .header-actions .btn-icon[onclick*="showNotifications"],
    .top-bar .header-actions #notificationsBtn {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 2px solid var(--primary-color);
        border-radius: 6px;
        background: var(--white);
        display: flex;
        align-items: center;
        justify-content: center;
        order: 2;
        flex-shrink: 0;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        user-select: none;
    }
    
    /* تحسين الاستجابة على اللمس */
    .top-bar .header-actions #notificationsBtn:active {
        transform: scale(0.95);
        background: var(--primary-color);
        color: var(--white);
    }
    
    /* زر البروفايل - مربع صغير مع border */
    .top-bar .header-actions .btn-icon[onclick*="profile"] {
        min-width: 36px;
        min-height: 36px;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 2px solid var(--primary-color);
        border-radius: 6px;
        background: var(--white);
        display: flex;
        align-items: center;
        justify-content: center;
        order: 3;
        flex-shrink: 0;
    }
    
    /* زر تسجيل الخروج - مربع صغير مع border */
    .top-bar .header-actions .btn-icon.btn-logout,
    .top-bar .header-actions .btn-icon[onclick*="logout"] {
        min-width: 36px;
        min-height: 36px;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 2px solid var(--danger-color);
        border-radius: 6px;
        background: var(--white);
        display: flex;
        align-items: center;
        justify-content: center;
        order: 4;
        flex-shrink: 0;
    }
    
    .top-bar .header-actions .btn-icon.btn-logout i,
    .top-bar .header-actions .btn-icon[onclick*="logout"] i {
        color: var(--danger-color);
    }
    
    /* محاذاة الأزرار في صف واحد */
    .top-bar .header-actions {
        align-items: center;
    }
    
    /* تجاوز الأنماط العامة للأزرار في الهيدر العلوي */
    .top-bar .header-actions .btn-icon:not(.btn-logout):not([onclick*="logout"]) {
        min-width: 36px !important;
        min-height: 36px !important;
        padding: 0 !important;
        font-size: 1.1em !important;
        border: 2px solid var(--primary-color) !important;
        border-radius: 6px !important;
    }
    
    /* مؤشر المزامنة مخفي على الهاتف */
    .top-bar .header-actions .sync-indicator {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* زر التحديث للهاتف فقط - يظهر فقط على الهاتف */
    .top-bar .header-actions #mobileRefreshBtn {
        display: flex !important;
        min-width: 36px;
        min-height: 36px;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 2px solid var(--primary-color);
        border-radius: 6px;
        background: var(--white);
        align-items: center;
        justify-content: center;
        order: 0;
        flex-shrink: 0;
        cursor: pointer;
    }
    
    .top-bar .header-actions #mobileRefreshBtn i {
        color: var(--primary-color);
        font-size: 1.1em;
    }
    
    .top-bar .header-actions #mobileRefreshBtn:hover {
        background: var(--light-bg);
        transform: scale(1.05);
    }
    
    .top-bar .header-actions #mobileRefreshBtn:active {
        transform: scale(0.95);
    }
    
    /* ضمان أن جميع الأزرار بنفس الحجم ولا تنكمش */
    .top-bar .header-actions .btn-icon,
    .top-bar .header-actions .sync-indicator,
    .top-bar .header-actions #mobileRefreshBtn,
    .top-bar .header-actions #installButton {
        min-width: 36px !important;
        min-height: 36px !important;
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        font-size: 1.1em !important;
        border-radius: 6px !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
    }
    
    .header-actions .sync-indicator i {
        font-size: 0.85em;
    }
    
    /* الوضع الليلي */
    .dark-mode .mobile-top-user-info {
        border-top-color: #444;
    }
    
    .dark-mode .mobile-user-info p {
        color: #ccc;
    }
    
    .dark-mode .mobile-user-info strong {
        color: #fff;
    }
    
    /* إخفاء زر القائمة على الهاتف */
    .top-bar .btn-menu {
        display: none !important;
    }
    
    /* تحسين قائمة الإشعارات على الهاتف - تنسدل مباشرة تحت الـ top bar */
    .top-bar {
        position: relative !important;
        z-index: 1000 !important;
    }
    
    .notifications-list {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        min-width: auto !important;
        max-width: 100% !important;
        margin-top: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-radius: 0 !important;
        border-top: none !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.2) !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
        z-index: 10001 !important;
    }
    
    .notifications-list .notifications-items {
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* تحسين زر الإشعارات على الهاتف */
    .top-bar .header-actions #notificationsBtn {
        position: relative;
        z-index: 10001;
    }
    
    .top-bar .header-actions #notificationsBtn .notification-badge {
        pointer-events: none;
        z-index: 10002;
    }
}

/* Navbar عائم للهاتف */
.mobile-navbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 14px 0;
    padding-bottom: max(14px, calc(14px + env(safe-area-inset-bottom, 0px)));
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
    min-height: 86px; /* ضمان ارتفاع ثابت */
}

.mobile-nav-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    gap: 2px;
    padding: 0 4px;
    box-sizing: border-box;
}

/* إخفاء شريط التمرير في mobile-nav-container */
.mobile-nav-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
    height: 0;
    width: 0;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    text-decoration: none;
    color: var(--text-light);
    transition: all 0.3s ease;
    min-width: 60px;
    max-width: 80px;
    flex: 0 0 auto;
    border-radius: 8px;
    position: relative;
    box-sizing: border-box;
}

.mobile-nav-item i {
    font-size: 1.4em;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.mobile-nav-item span {
    font-size: 0.75em;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mobile-nav-item.active {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.1);
    font-weight: 600;
}

.mobile-nav-item:hover {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.05);
}

/* تحسين badge في mobile-nav-item */
.mobile-nav-item .nav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger-color);
    color: var(--white);
    border-radius: 50%;
    min-width: 16px;
    height: 16px;
    font-size: 0.6em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border: 1px solid var(--white);
    z-index: 10;
    padding: 0 4px;
    line-height: 1;
}

/* الوضع الليلي للـ navbar العائم */
.dark-mode .mobile-navbar {
    background: var(--dark-bg);
    border-top-color: #333;
}

.dark-mode .mobile-nav-item {
    color: #ffffff;
}

.dark-mode .mobile-nav-item.active {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.2);
}

.dark-mode .mobile-nav-item:hover {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.1);
}

/* زر القائمة المتنقلة */
.mobile-menu-btn {
    display: none; /* مخفي افتراضياً */
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.1em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: #1976D2;
    transform: scale(1.05);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

/* إظهار الزر في واجهة الهاتف فقط */
@media (max-width: 575.98px) {
    .mobile-menu-btn {
        display: block !important;
    }
    
    /* المحتوى الرئيسي */
    .main-content {
        margin-right: 0;
        padding: 20px 15px 120px; /* مساحة من الأسفل للـ navbar - زيادة من 110px إلى 120px */
        padding-bottom: max(120px, calc(120px + env(safe-area-inset-bottom, 0px)));
        width: 100%;
        min-height: 100vh;
        position: relative;
        z-index: 1;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .section-header h2 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    /* أزرار العمليات */
    .header-actions {
        flex-direction: row;
        gap: 4px;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
        flex-wrap: nowrap;
    }
    
    /* إخفاء شريط التمرير في header-actions */
    .header-actions::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    
    /* ضمان أن الأزرار لا تنكمش */
    .header-actions .btn-icon {
        flex-shrink: 0 !important;
    }
    
    /* الأزرار في الهيدر العلوي تبقى أفقية */
    .top-bar .header-actions {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
        width: auto !important;
    }
    
    /* أزرار قسم الصيانة - grid 2 أعمدة مع أيقونات فقط */
    #repairs-section .header-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }
    
    /* إخفاء النص وإظهار الأيقونات فقط في أزرار header-actions على الهواتف */
    #repairs-section .header-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 10px;
        border-radius: 8px;
        font-weight: 500;
        position: relative;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        font-size: 14px; /* الحفاظ على font-size للأيقونات */
        line-height: 1;
        color: transparent; /* إخفاء النص */
        text-indent: -9999px; /* إخفاء النص المباشر */
    }
    
    /* إخفاء النص فقط وليس الأيقونات */
    #repairs-section .header-actions .btn > *:not(i) {
        display: none !important;
    }
    
    #repairs-section .header-actions .btn i {
        display: inline-block !important;
        font-size: 1.4em !important;
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1 !important;
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        flex-shrink: 0;
        width: auto !important;
        height: auto !important;
        visibility: visible !important;
        opacity: 1 !important;
        font-style: normal !important;
        font-weight: normal !important;
        text-indent: 0 !important;
        font-variant: normal !important;
        text-transform: none !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
    }
    
    /* ضمان ظهور أيقونات Bootstrap Icons */
    #repairs-section .header-actions .btn i.bi::before {
        font-size: inherit !important;
    }
    
    /* استعادة اللون للأيقونة */
    #repairs-section .header-actions .btn.btn-primary i {
        color: var(--white) !important;
    }
    
    #repairs-section .header-actions .btn.btn-info i {
        color: var(--white) !important;
    }
    
    #repairs-section .header-actions .btn.btn-danger i {
        color: var(--white) !important;
    }
    
    /* عرض select الفرع بشكل مختلف */
    #repairs-section .header-actions select.filter-select {
        display: block;
        grid-column: 1 / -1;
        width: 100%;
        padding: 10px;
        font-size: 0.85em;
        min-height: 44px;
    }
    
    .header-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 1em;
        border-radius: 8px;
        font-weight: 500;
    }
    
    /* أزرار الجداول */
    .data-table .btn {
        padding: 6px 12px;
        font-size: 0.8em;
        border-radius: 6px;
        margin: 2px;
    }
    
    /* شريط التصفية - grid بأربعة أعمدة متساوية في الهواتف */
    #repairs-section .filters-bar {
        display: grid !important;
        grid-template-columns: repeat(1, 1fr) !important;
        gap: 6px !important;
        padding: 8px !important;
        flex-direction: row !important;
    }
    
    .filters-bar:not(#repairs-section .filters-bar) {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    #repairs-section .search-input,
    #repairs-section .filter-select {
        width: 100%;
        max-width: none;
        padding: 4px 3px !important;
        border-radius: 4px;
        border: 1px solid var(--border-color);
        font-size: 0.8em !important;
        transition: border-color 0.3s ease;
        min-height: 36px;
    }
    
    /* تحسين placeholder في الهواتف */
    #repairs-section .search-input::placeholder {
        font-size: 0.8em;
        opacity: 0.7;
    }
    
    /* تحسين select option في الهواتف */
    #repairs-section .filter-select option {
        font-size: 0.9em;
        padding: 4px;
    }
    
    .search-input,
    .filter-select {
        width: 100%;
        max-width: none;
        padding: 12px 15px;
        border-radius: 8px;
        border: 1px solid #ddd;
        font-size: 1em;
        transition: border-color 0.3s ease;
    }
    
    #repairs-section .search-input:focus,
    #repairs-section .filter-select:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
    }
    
    .search-input:focus,
    .filter-select:focus {
        outline: none;
        border-color: #2196F3;
        box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    }
    
    /* عرض بديل للهواتف - بطاقات بدلاً من الجدول */
    #repairsTable {
        display: none !important;
    }
    
    /* حاوية البطاقات للهواتف */
    #repairs-section .repairs-mobile-container {
        display: block !important;
    }
    
    /* إخفاء حاوية الجدول على الهواتف */
    #repairs-section .table-container {
        display: none !important;
    }
    
    /* تحسين قائمة الإجراءات على الهواتف */
    .actions-dropdown-menu {
        z-index: 10002 !important;
    }
    
    .actions-dropdown-menu.show {
        z-index: 10002 !important;
    }
    
    /* تحسين البطاقات على الهواتف */
    .repair-mobile-card {
        position: relative;
        overflow: visible;
    }
    
    .repair-mobile-card .actions-dropdown {
        position: relative;
        z-index: 1;
    }
    
    .repair-mobile-card .actions-dropdown-menu {
        position: fixed !important;
        z-index: 10002 !important;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    /* تحسين زر الإجراءات على الهواتف */
    .repair-mobile-card .actions-dropdown-btn {
        width: 100%;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.9em;
    }
    
    /* تحسين زر الاتصال على الهواتف */
    .repair-mobile-card .btn-success {
        width: 100%;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.9em;
    }
    
    /* الجداول */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -15px;
        padding: 0 15px;
    }
    
    .data-table {
        min-width: 600px;
        font-size: 0.85em;
        border-radius: 8px;
        overflow: hidden;
    }
    
    /* استثناء: جداول المصروفات والمستحقات - عرض كامل على الشاشات الصغيرة */
    .expenses-table-wrapper .data-table,
    .salaries-table-wrapper .data-table {
        min-width: unset;
        width: 100%;
    }
    
    .expenses-table-wrapper .table-container {
        margin: 0;
        padding: 0;
        overflow-x: visible;
    }
    
    /* ✅ السماح بالتمرير الأفقي لجدول المستحقات على الشاشات الصغيرة */
    .salaries-table-wrapper .table-container {
        margin: 0;
        padding: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .salaries-table-wrapper .data-table {
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
        white-space: nowrap;
        border-bottom: 1px solid #e9ecef;
    }
    
    .data-table th {
        background: #f8f9fa;
        font-weight: 600;
        color: #495057;
    }
    
    /* البطاقات الإحصائية */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px 15px;
        border-left-width: 3px;
    }
    
    .stat-card.stat-profit {
        border-width: 1.5px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5em;
    }
    
    .stat-content h3 {
        font-size: 1.8em;
    }
    
    /* النماذج - Responsive Modals for Mobile */
    .modal {
        padding: 0 !important;
        align-items: flex-start;
        padding-top: 5px;
    }
    
    .modal-content {
        width: 98% !important;
        max-width: 98% !important;
        margin: 0 auto;
        max-height: 95vh;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        display: flex;
        flex-direction: column;
    }
    
    /* التأكد من أن جميع النماذج تستخدم العرض الكامل على الموبايل */
    .modal-content,
    .modal-content.modal-sm,
    .modal-content.modal-lg {
        width: 98% !important;
        max-width: 98% !important;
    }
    
    .modal-content.modal-sm {
        width: 98% !important;
        max-width: 98% !important;
    }
    
    .modal-content.modal-lg {
        width: 98% !important;
        max-width: 98% !important;
    }
    
    .modal-header {
        padding: 0.6rem 0.8rem;
        flex-shrink: 0;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    
    .modal-header h2,
    .modal-header h3 {
        font-size: 1.3em;
        margin-bottom: 0;
    }
    
    .modal form {
        padding: 0.8rem;
        overflow-y: auto;
        overflow-x: auto;
        max-height: calc(95vh - 120px);
        flex: 1;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-body {
        padding: 0.8rem;
        overflow-y: auto;
        overflow-x: auto;
        max-height: calc(95vh - 120px);
        flex: 1;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-footer,
    .modal form > .modal-footer {
        padding: 0.6rem 0.8rem;
        flex-direction: column;
        gap: 10px;
        flex-shrink: 0;
    }
    
    .modal-footer .btn,
    .modal form > .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* تحسين عرض الجداول داخل النماذج على الموبايل */
    .modal-body table,
    .modal form table,
    .modal-body .data-table,
    .modal form .data-table {
        width: 100%;
        font-size: 0.85em;
        table-layout: auto;
    }
    
    .modal-body table th,
    .modal-body table td,
    .modal form table th,
    .modal form table td,
    .modal-body .data-table th,
    .modal-body .data-table td,
    .modal form .data-table th,
    .modal form .data-table td {
        padding: 8px 6px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* تحسين النماذج في صفحة settings على الموبايل */
    #settings-section .modal,
    #settings-section .modal-content,
    #settings-section .modal-content.modal-sm {
        width: 98% !important;
        max-width: 98% !important;
    }
}

/* ===== Extra Small Phones (480px) ===== */
@media (max-width: 480px) {
    .modal {
        padding: 0;
        align-items: flex-start;
    }

    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .modal-content.modal-sm {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .modal-content.modal-lg {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* التأكد من أن جميع النماذج تستخدم العرض الكامل على الشاشات الصغيرة */
    .modal-content,
    .modal-content.modal-sm,
    .modal-content.modal-lg {
        width: 100% !important;
        max-width: 100% !important;
    }

    .modal-header {
        padding: 0.6rem;
        flex-shrink: 0;
    }

    .modal-header h2,
    .modal-header h3 {
        font-size: 1.2em;
    }

    .modal form {
        padding: 0.6rem;
        overflow-y: auto;
        overflow-x: auto;
        max-height: calc(100vh - 110px);
        flex: 1;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    .modal-body {
        padding: 0.6rem;
        overflow-y: auto;
        overflow-x: auto;
        max-height: calc(100vh - 110px);
        flex: 1;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    .modal-footer,
    .modal form > .modal-footer {
        padding: 0.6rem;
        flex-shrink: 0;
    }
    
    /* تحسين عرض الجداول داخل النماذج على الشاشات الصغيرة */
    .modal-body table,
    .modal form table,
    .modal-body .data-table,
    .modal form .data-table {
        width: 100%;
        font-size: 0.8em;
        table-layout: auto;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-body table th,
    .modal-body table td,
    .modal form table th,
    .modal form table td,
    .modal-body .data-table th,
    .modal-body .data-table td,
    .modal form .data-table th,
    .modal form .data-table td {
        padding: 6px 4px;
        white-space: nowrap;
        min-width: 60px;
    }
    
    /* تحسين النماذج في صفحة settings على الشاشات الصغيرة */
    #settings-section .modal,
    #settings-section .modal-content,
    #settings-section .modal-content.modal-sm {
        width: 100% !important;
        max-width: 100% !important;
    }
}

@media (max-width: 768px) {
    /* حقول النماذج */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 0.9em;
        margin-bottom: 5px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px;
        font-size: 1em;
    }
    
    /* أزرار الإجراءات في الجداول */
    .btn-icon {
        width: 35px;
        height: 35px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9em;
    }
    
    /* قارئ الباركود */
    #scanner-area {
        height: 250px;
        margin-bottom: 15px;
    }
    
    #scanner-result {
        margin-top: 15px;
    }
    
    /* أنماط العمليات الخاسرة */
    .loss-operation-form {
        max-width: none;
    }
    
    
    .settings-container {
        padding: 10px;
        width: 100%;
        max-width: 100%;
    }
    
    .settings-section {
        margin-bottom: 20px;
        padding: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* التأكد من أن النماذج في settings تستخدم العرض الكامل */
    #userModal .modal-content,
    #userModal .modal-content.modal-sm {
        width: 98% !important;
        max-width: 98% !important;
    }
    
    /* تبويبات الفروع - استجابة */
    .branch-tabs {
        flex-direction: column;
        gap: 5px;
        border-bottom: none;
    }
    
    .branch-tab {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 14px;
        border-bottom: 2px solid var(--border-color);
        border-radius: 8px 8px 0 0;
    }
    
    .branch-tab.active {
        border-bottom-color: var(--primary-color);
    }
    
    .branch-form {
        padding-top: 15px;
    }
    
    .branch-header h4 {
        font-size: 16px;
    }
    
    /* إدارة التخزين - استجابة */
    .storage-tabs {
        flex-direction: column;
        gap: 5px;
    }
    
    .storage-tab {
        width: 100%;
        justify-content: center;
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .storage-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .storage-summary {
        flex-direction: column;
        gap: 10px;
    }
    
    .storage-file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .file-actions {
        width: 100%;
    }
    
    .file-actions .btn {
        width: 100%;
    }
    
    .storage-bulk-actions .btn {
        width: 100%;
    }
    
    /* أقسام المزامنة والنسخ الاحتياطي - استجابة */
    .sync-backup-section {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }
    
    .sync-backup-section h4 {
        font-size: 15px;
    }
    
    .backup-buttons {
        flex-direction: column;
    }
    
    .backup-buttons .btn {
        width: 100%;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    /* أنماط التصدير */
    .export-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .export-options {
        flex-direction: column;
        gap: 10px;
    }
    
    .export-options .btn {
        width: 100%;
        min-width: auto;
    }
}

/* تأكد من إخفاء الـ navbar العائم في الكمبيوتر */
@media (min-width: 768px) {
    .mobile-navbar {
        display: none !important;
    }
    
    .sidebar {
        display: flex !important;
    }
    
    .mobile-menu-btn {
        display: none !important;
    }
    
    /* إخفاء زر القائمة على أجهزة الكمبيوتر */
    .btn-menu {
        display: none !important;
    }
    
    .main-content {
        margin-right: 260px !important;
        padding: 0 !important;
    }
}

/* الهواتف المتوسطة (576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* إظهار زر القائمة على الشاشات المتوسطة */
    .btn-menu {
        display: block !important;
    }
    
    .sidebar {
        width: 280px;
    }
    
    .main-content {
        margin-right: 280px;
        padding: 20px 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .header-actions {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .header-actions .btn {
        flex: 1;
        min-width: 120px;
    }
    
    .modal-content {
        width: 90%;
        max-width: 500px;
    }
    
    .data-table {
        font-size: 0.95em;
    }
}

/* الأجهزة اللوحية (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar {
        width: 250px;
    }
    
    .main-content {
        margin-right: 250px;
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .header-actions {
        gap: 10px;
    }
    
    .modal-content {
        width: 80%;
        max-width: 600px;
    }
}

/* تحسينات إضافية للهواتف */
@media (max-width: 767.98px) {
    /* تحسين النصوص */
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.3;
    }
    
    /* تحسين المسافات */
    .section {
        margin-bottom: 20px;
    }
    
    /* تحسين الأزرار */
    .btn {
        min-height: 44px; /* الحد الأدنى للمس المريح */
        touch-action: manipulation;
    }
    
    /* تحسين الحقول */
    input, select, textarea {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* تحسين الروابط */
    a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* تحسين التمرير */
    .table-container {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    /* تحسين الظلال */
    .card, .modal-content, .sidebar {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    /* تحسين الألوان للوضوح */
    .btn-primary {
        background-color: rgba(24, 175, 57, 1);
        border-color: rgba(24, 175, 57, 1);
    }
    
    .btn-success {
        background-color: #2E7D32;
        border-color: #2E7D32;
    }
    
    .btn-danger {
        background-color: #D32F2F;
        border-color: #D32F2F;
    }
    
    .btn-info {
        background-color: #0288D1;
        border-color: #0288D1;
    }
}

/* تحسينات للشاشات الصغيرة جداً (أقل من 400px) */
@media (max-width: 399.98px) {
    .main-content {
        padding: 60px 5px 15px;
    }
    
    .section-header h2 {
        font-size: 1.3em;
    }
    
    .stat-card {
        padding: 15px 10px;
        border-left-width: 3px;
        gap: 15px;
    }
    
    .stat-card.stat-profit {
        border-width: 1.5px;
    }
    
    .stat-card.stat-profit .stat-value {
        font-size: 1.5em;
    }
    
    .stat-icon {
        font-size: 2em;
    }
    
    .stat-content h3 {
        font-size: 1.6em;
    }
    
    .modal-content {
        width: 98%;
        margin: 5px;
    }
    
    .data-table {
        font-size: 0.8em;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 4px;
    }
    
    .btn-icon {
        width: 30px;
        height: 30px;
        font-size: 0.8em;
    }
}

.header-actions .btn {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
}

/* أنماط الإشعارات */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-success h4 {
    color: #155724;
    margin-top: 0;
    margin-bottom: 10px;
}

.alert-success p {
    margin-bottom: 10px;
}

/* أنماط النماذج المحسنة */
.modal-content {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* أنماط الأزرار المحسنة */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: rgba(24, 175, 57, 1);
    color: white;
}

.btn-primary:hover {
    background-color: #1976D2;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9em;
}

/* أنماط الجداول المحسنة */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #333;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

/* أنماط التصفية */
.filters-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    align-items: center;
}

.search-input,
.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.search-input {
    flex: 1;
    max-width: 300px;
}

.filter-select {
    min-width: 150px;
}

.backup-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.system-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.system-info p {
    margin: 5px 0;
    color: #666;
}

.progress-container {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #e9ecef;
}

.history-date {
    font-weight: bold;
    color: #2196F3;
}

.history-details {
    color: #666;
}

.backup-badge {
    background: #4caf50;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-right: 10px;
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.alert h4 {
    margin-top: 0;
    margin-bottom: 10px;
}

.alert p {
    margin-bottom: 10px;
}

/* أنماط النسخ الاحتياطية */
.backup-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.backup-section h4 {
    color: #2196F3;
    margin-bottom: 15px;
}

.backup-list {
    max-height: 300px;
    overflow-y: auto;
}

.backup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 5px;
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
}

.backup-info {
    flex: 1;
}

.backup-name {
    font-weight: bold;
    color: #333;
}

.backup-size {
    color: #666;
    font-size: 0.9em;
}

.backup-actions {
    display: flex;
    gap: 5px;
}

.backup-actions button {
    padding: 5px 10px;
    font-size: 0.8em;
}

/* أنماط الإشعارات */
.notification-panel {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.notification-panel h4 {
    color: #856404;
    margin-top: 0;
}

.notification-panel p {
    color: #856404;
    margin-bottom: 10px;
}

.whatsapp-button {
    background: #25d366;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    transition: background 0.3s ease;
}

.whatsapp-button:hover {
    background: #128c7e;
    color: white;
    text-decoration: none;
}

/* أنماط الإحصائيات المتقدمة */
.advanced-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card-advanced {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #2196F3;
}

.stat-card-advanced.warning {
    border-left-color: #ff9800;
}

.stat-card-advanced.danger {
    border-left-color: #f44336;
}

.stat-card-advanced.success {
    border-left-color: #4caf50;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
}

.stat-trend {
    font-size: 0.8em;
    margin-top: 5px;
}

.stat-trend.up {
    color: #4caf50;
}

.stat-trend.down {
    color: #f44336;
}

/* أنماط التنظيف التلقائي */
.auto-cleanup-info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.auto-cleanup-info h4 {
    color: #1976d2;
    margin-top: 0;
}

.cleanup-schedule {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.cleanup-date {
    font-weight: bold;
    color: #1976d2;
}

.cleanup-status {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
}

.cleanup-status.active {
    background: #4caf50;
    color: white;
}

.cleanup-status.inactive {
    background: #f44336;
    color: white;
}

.cleanup-status.pending {
    background: #ff9800;
    color: white;
}

.barcode-container img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background: white;
    border-radius: 5px;
}

.label-container {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.label-container img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background: white;
    border-radius: 5px;
}

.advanced-label-container {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.advanced-label-container img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background: white;
    border-radius: 5px;
}

.barcode-section, .label-section, .advanced-label-section {
    margin-bottom: 30px;
}

.barcode-section h3, .label-section h3, .advanced-label-section h3 {
    color: #2196F3;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #2196F3;
}

.info-section h4 {
    color: #2196F3;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section ul {
    margin: 10px 0;
    padding-right: 20px;
}

.info-section li {
    margin-bottom: 5px;
    color: #666;
}

/* أنماط الطباعة للباركود */
@media print {
    .barcode-container, .label-container, .advanced-label-container {
        background: white !important;
        border: 1px solid #000 !important;
        margin: 10px 0 !important;
        padding: 10px !important;
    }
    
    .barcode-container img, .label-container img, .advanced-label-container img {
        border: 1px solid #000 !important;
        background: white !important;
    }
    
    .no-print {
        display: none !important;
    }
}

/* تقسيم التقارير */
.report-breakdown {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-item.total-breakdown {
    background: var(--light-bg);
    border-radius: 5px;
    margin-top: 10px;
    font-size: 1.1em;
}

.breakdown-item strong {
    color: var(--primary-color);
    font-size: 1.1em;
}

/* تنسيقات رفع الصور */
.image-upload-container {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.image-upload-container button {
    white-space: nowrap;
}

.camera-container {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.camera-container video {
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* تنسيقات الفواتير */
.invoice-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.invoice-item input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.95em;
}

.invoice-summary {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.invoice-summary p {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    font-size: 1.05em;
}

.invoice-total {
    font-size: 1.3em !important;
    color: var(--primary-color);
    border-top: 2px solid var(--border-color);
    padding-top: 15px !important;
    margin-top: 15px !important;
}

/* ============================================
   تنسيقات المخزن الجديدة - بطاقات و Grid
   ============================================ */

/* Grid Layout للمخزون */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    padding: 15px;
}

@media (max-width: 768px) {
    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 12px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .inventory-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }
}

/* بطاقات المخزن - حجم أصغر */
.inventory-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.inventory-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 14px;
    height: 60%;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.inventory-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.2);
    border-color: var(--primary-color);
}

.inventory-card:hover::before {
    opacity: 1;
}

.inventory-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light-bg);
}

.inventory-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    color: white;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
    overflow: hidden;
    padding: 5px;
}

.brand-logo-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: 30px;
    max-height: 30px;
    /* إزالة الفلتر للسماح للشعارات الملونة بالظهور بشكل صحيح */
}

.inventory-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.inventory-card-icon-old {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    color: white;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.inventory-card-title {
    flex: 1;
    margin-right: 15px;
}

.inventory-card-title h3 {
    color: var(--text-dark);
    font-size: 0.95em;
    margin: 0 0 3px 0;
    font-weight: 600;
}

.inventory-card-title p {
    color: var(--text-light);
    font-size: 0.8em;
    margin: 0;
}

.inventory-card-body {
    margin-bottom: 10px;
}

.inventory-card-barcode,
.inventory-card-qrcode {
    text-align: center;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 8px;
    margin: 10px 0;
}

.inventory-card-barcode img,
.inventory-card-qrcode img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    max-height: 150px;
    width: auto;
    margin: 0 auto;
    display: block;
}

.inventory-card-barcode-code,
.inventory-card-qrcode-code {
    margin-top: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.75em;
    color: var(--text-dark);
    letter-spacing: 1px;
    text-align: center;
    word-break: break-word;
}

.inventory-card-barcode-code-copy {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.7em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.inventory-card-barcode-code-copy:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.inventory-card-image {
    width: 100%;
    min-height: 250px;
    max-height: 350px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    overflow: hidden;
    padding: 15px;
    box-sizing: border-box;
    position: relative;
}

.inventory-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: 10px;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: high-quality;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: block;
}

.inventory-card:hover .inventory-card-image img {
    transform: scale(1.02) translateZ(0);
}

.inventory-card-image img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.inventory-card-image img[loading="lazy"].loaded {
    opacity: 1;
}

/* ضمان عرض الصورة المقتطعة بشكل صحيح */
.inventory-card-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}

.inventory-card-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: var(--light-bg);
    border-radius: 6px;
    margin-top: 10px;
}

.inventory-card-price-label {
    color: var(--text-light);
    font-size: 0.9em;
}

.inventory-card-price-value {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1em;
}

.inventory-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.inventory-card-actions .btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.8em;
    min-width: 90px;
    white-space: nowrap;
}

.inventory-card-actions .btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    user-select: none;
}

.inventory-card.phone-sold-out .inventory-card-actions .btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.inventory-card.phone-sold-out .inventory-card-actions .btn:not(:disabled) {
    opacity: 0.6;
}

/* تعتيم البطاقات المباعة للهواتف */
.inventory-card.phone-sold-out {
    opacity: 0.5;
    filter: grayscale(0.7);
    pointer-events: auto; /* السماح بالنقر للعرض */
}

.inventory-card.phone-sold-out:hover {
    opacity: 0.6;
    filter: grayscale(0.6);
}

/* علامة SOLD OUT */
.phone-sold-out-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--danger-color);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.85em;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.phone-sold-out-badge span {
    display: block;
}

/* تبويبات المخزن */
.inventory-tabs {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: var(--white);
    border-bottom: 2px solid var(--light-bg);
    flex-wrap: wrap;
    align-items: center;
}

.inventory-tab {
    padding: 12px 24px;
    background: var(--light-bg);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.inventory-tab:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.inventory-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(33, 150, 243, 0.3);
}

/* أزرار داخل تبويبات المخزن (على الكمبيوتر فقط) */
.inventory-tab-button {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    border: 2px solid transparent;
    white-space: nowrap;
}

.inventory-tab-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* تحسين الأزرار على الموبايل - أيقونات فقط */
@media (max-width: 768px) {
    .inventory-tab-button {
        display: flex !important;
        padding: 10px 12px !important;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
        align-items: center;
    }
    
    .inventory-tab-button span {
        display: none !important;
    }
    
    .inventory-tab-button i {
        display: inline-block !important;
        font-size: 1.2em;
        margin: 0;
    }
}

/* أزرار الفلترة */
.filter-buttons {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    overflow-x: auto;
}

.filter-button {
    padding: 10px 20px;
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.filter-button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(33, 150, 243, 0.3);
}

/* أزرار الماركات */
.brand-buttons {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: var(--white);
    border-bottom: 2px solid var(--light-bg);
    flex-wrap: wrap;
    overflow-x: auto;
}

.brand-button {
    padding: 15px 25px;
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 100px;
    text-align: center;
}

.brand-button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(33, 150, 243, 0.3);
}

.brand-button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 6px 15px rgba(33, 150, 243, 0.3);
}

.brand-button-icon {
    font-size: 32px;
    color: var(--primary-color);
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
}

.brand-button:hover .brand-button-icon,
.brand-button.active .brand-button-icon {
    color: white;
}

.brand-button-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    transition: all 0.3s ease;
    filter: brightness(0.9);
}

.brand-button:hover .brand-button-image,
.brand-button.active .brand-button-image {
    filter: brightness(1.4);
    transform: scale(1.1);
}

.brand-button-name {
    font-weight: 600;
    font-size: 0.9em;
}

/* نافذة المعاينة */
.preview-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.preview-modal-content {
    background: var(--white);
    margin: 30px auto;
    padding: 0;
    border-radius: 15px;
    max-width: 800px;
    width: 90%;
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.preview-modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 30px 30px 30px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--light-bg);
}

/* تحسين شريط التمرير لمتصفحات Webkit (Chrome, Safari, Edge) */
.preview-modal-body::-webkit-scrollbar {
    width: 10px;
}

.preview-modal-body::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 10px;
}

.preview-modal-body::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
    border: 2px solid var(--light-bg);
}

.preview-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.preview-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid var(--light-bg);
    flex-shrink: 0;
    background: var(--white);
    border-radius: 15px 15px 0 0;
}

.preview-modal-header h3 {
    color: var(--text-dark);
    margin: 0;
    font-size: 1.5em;
}

.preview-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.preview-modal-close:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

.preview-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.preview-item {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.preview-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(33, 150, 243, 0.2);
}

.preview-item-icon {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.preview-item-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.preview-item-quantity {
    color: var(--text-light);
    font-size: 0.9em;
}

/* قسم المخزن */
.inventory-section {
    display: none;
}

.inventory-section.active {
    display: block;
}

/* البحث في المخزن */
.inventory-search {
    padding: 15px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.inventory-search input {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.inventory-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.inventory-search select {
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1em;
    background: var(--white);
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.inventory-search select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.inventory-search select:hover {
    border-color: var(--primary-color);
}

/* Empty state */
.inventory-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.inventory-empty-icon {
    font-size: 64px;
    color: var(--border-color);
    margin-bottom: 20px;
}

.inventory-empty-text {
    font-size: 1.1em;
    margin-bottom: 20px;
}

/* تنسيقات نموذج قطع الغيار */
.spare-part-item-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    padding: 10px;
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.spare-part-item-row .spare-part-item-custom {
    grid-column: 1 / -1;
    margin-top: 5px;
}

.spare-part-item-row select,
.spare-part-item-row input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.9em;
}

.spare-part-item-row .btn {
    padding: 8px 12px;
}

@media (max-width: 768px) {
    .spare-part-item-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* تنسيقات Modal محسّنة */
.modal-lg {
    max-width: 900px;
}

/* Phone Details Modal Styles */
.phone-details-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 30px 30px 30px;
    /* تحسين شريط التمرير */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--light-bg);
}

/* تحسين شريط التمرير لمتصفحات Webkit (Chrome, Safari, Edge) */
.phone-details-content::-webkit-scrollbar {
    width: 10px;
}

.phone-details-content::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 10px;
}

.phone-details-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
    border: 2px solid var(--light-bg);
}

.phone-details-content::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.phone-details-image {
    text-align: center;
    margin-bottom: 20px;
}

.phone-details-image img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
    object-fit: contain;
}

.phone-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.phone-details-card {
    background: var(--white);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.phone-details-card-title {
    margin: 0 0 12px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1em;
}

.phone-details-card-title-success {
    border-bottom-color: var(--success-color);
    color: var(--success-color);
}

.phone-details-card-title-danger {
    border-bottom-color: var(--danger-color);
    color: var(--danger-color);
}

.phone-details-card-title-info {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.phone-details-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.phone-details-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--light-bg);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.phone-details-item strong {
    color: var(--text-dark);
    font-weight: 600;
}

.phone-details-value {
    font-family: 'Courier New', monospace;
    color: var(--text-light);
    word-break: break-word;
    text-align: left;
}

.phone-details-badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-warning {
    background: #fff3e0;
    color: #e65100;
}

.phone-specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.phone-spec-item {
    padding: 10px;
    background: var(--light-bg);
    border-radius: 8px;
    text-align: center;
}

.phone-spec-item-full {
    grid-column: span 2;
}

.phone-spec-label {
    font-size: 0.85em;
    color: var(--text-light);
    margin-bottom: 4px;
}

.phone-spec-value {
    font-weight: bold;
    color: var(--text-dark);
    font-size: 1.1em;
    word-break: break-word;
}

.phone-prices-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    color: var(--white);
}

.phone-prices-title {
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2em;
}

.phone-prices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.phone-price-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.phone-price-item-primary {
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.phone-price-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 8px;
}

.phone-price-value {
    font-size: 1.5em;
    font-weight: bold;
}

.phone-profit {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.phone-profit-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 5px;
}

.phone-profit-value {
    font-size: 1.3em;
    font-weight: bold;
}

.phone-additional-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.phone-details-card-success {
    border-right: 4px solid var(--success-color);
}

.phone-details-card-danger {
    border-right: 4px solid var(--danger-color);
}

.phone-details-text {
    color: var(--text-dark);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .inventory-card {
        padding: 15px;
    }
    
    .inventory-card-image {
        min-height: 200px;
        max-height: 280px;
    }
    
    .inventory-card-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    
    .preview-modal {
        padding: 0 !important;
        align-items: flex-start;
        padding-top: 10px;
    }
    
    .preview-modal-content {
        margin: 0 auto;
        width: 95% !important;
        max-width: 95% !important;
        max-height: 90vh;
        border-radius: 12px;
    }
    
    .preview-modal-header {
        padding: 0.75rem 1rem;
        flex-shrink: 0;
    }
    
    .preview-modal-body {
        padding: 1rem;
        overflow-y: auto;
        max-height: calc(90vh - 120px);
        flex: 1;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }
    
    .preview-modal-header h3 {
        font-size: 1.3em;
    }
    
    .phone-details-content {
        padding: 15px 20px 20px 20px;
    }
    
    .phone-details-image {
        margin-bottom: 15px;
    }
    
    .phone-details-image img {
        max-height: 200px;
    }
    
    .phone-details-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .phone-details-card {
        padding: 12px;
    }
    
    .phone-details-card-title {
        font-size: 1em;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
    
    .phone-details-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 8px;
        gap: 5px;
    }
    
    .phone-specs-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .phone-spec-item-full {
        grid-column: span 1;
    }
    
    .phone-prices-card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .phone-prices-title {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .phone-prices-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .phone-price-value {
        font-size: 1.3em;
    }
    
    .phone-additional-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .preview-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .inventory-tabs {
        padding: 12px;
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .inventory-tab {
        padding: 8px 12px;
        font-size: 0.85em;
        flex: 1;
        min-width: calc(33.333% - 4px);
    }
    
    /* تحسين أزرار المخزن في الهواتف الصغيرة */
    .inventory-tab-button {
        flex: 1;
        min-width: 44px;
        padding: 8px !important;
    }
    
    .inventory-search {
        flex-direction: column;
        align-items: stretch;
    }
    
    .inventory-search select,
    .inventory-search input {
        width: 100%;
        max-width: 100%;
    }
    
    .brand-buttons {
        padding: 15px;
        gap: 10px;
    }
    
    .brand-button {
        min-width: 80px;
        padding: 12px 15px;
    }
}

@media (max-width: 575.98px) {
    .inventory-search {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .inventory-search select,
    .inventory-search input {
        padding: 10px 15px;
        font-size: 0.95em;
    }
    
    /* تحسين inventory-tabs في الهواتف الصغيرة جدًا */
    .inventory-tabs {
        padding: 10px;
        gap: 4px;
    }
    
    .inventory-tab {
        padding: 8px 10px;
        font-size: 0.8em;
    }
    
    .inventory-tab-button {
        min-width: 44px;
        padding: 8px !important;
    }
    
    /* تصغير حجم filters-bar في الهواتف الصغيرة جداً */
    #repairs-section .filters-bar {
        gap: 4px !important;
        padding: 6px !important;
    }
    
    #repairs-section .search-input,
    #repairs-section .filter-select {
        padding: 6px 4px !important;
        font-size: 0.75em !important;
        min-height: 32px;
        border-radius: 3px;
    }
    
    .preview-modal {
        padding: 0;
        align-items: flex-start;
    }
    
    .preview-modal-content {
        margin: 0 auto;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .preview-modal-header {
        padding: 0.75rem;
    }
    
    .preview-modal-header h3 {
        font-size: 1.2em;
    }
    
    .preview-modal-body {
        padding: 0.75rem;
        max-height: calc(100vh - 110px);
    }
    
    .phone-details-content {
        padding: 0.75rem;
        max-height: calc(100vh - 110px);
    }
    
    .phone-details-image img {
        max-height: 150px;
    }
    
    .phone-details-card {
        padding: 10px;
    }
    
    .phone-prices-card {
        padding: 12px;
    }
    
    .phone-price-value {
        font-size: 1.2em;
    }
    
    .phone-profit-value {
        font-size: 1.1em;
    }
}

/* تم إزالة التنسيق المتضارب */

/* تحسينات للطباعة */
@media print {
    .sidebar,
    .mobile-navbar,
    .top-bar,
    .section-header button,
    .filters-bar,
    .pagination,
    .btn-icon,
    .mobile-menu-btn {
        display: none !important;
    }
    
    /* استثناء modal بروفايل العميل من الإخفاء */
    .modal:not(.customer-profile-modal) {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* تحسينات لبروفايل العميل عند الطباعة */
    .customer-profile-modal {
        position: static !important;
        display: block !important;
        background: white !important;
    }
    
    .customer-profile-content {
        max-height: none !important;
        overflow: visible !important;
        height: auto !important;
    }
}

/* Profile Styles */
/* صورة الملف الشخصي */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.profile-avatar-container {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--primary-color);
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.profile-avatar-container:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(33, 150, 243, 0.4);
}

.profile-avatar-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

.profile-avatar-container:hover .profile-avatar-overlay {
    opacity: 1;
}

.profile-avatar-upload-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--white);
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
}

.profile-avatar-upload-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.profile-avatar-upload-btn i {
    font-size: 24px;
}

.profile-avatar-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.profile-avatar-hint {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
    margin: 0;
    padding: 0 20px;
}

.profile-avatar-hint i {
    margin-left: 5px;
    color: var(--primary-color);
}

/* الأيقونة الافتراضية للملف الشخصي من Bootstrap */
.profile-avatar-default {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border-radius: 50%;
}

.profile-avatar-default i {
    font-size: 120px;
    opacity: 0.9;
    line-height: 1;
}

/* تحسينات للأيقونة الافتراضية على الشاشات الصغيرة */
@media (max-width: 575.98px) {
    .profile-avatar-default i {
        font-size: 100px;
    }
    
    .profile-avatar-container {
        width: 120px;
        height: 120px;
    }
}

.profile-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== Technician Rating in Profile ===== */
.technician-rating-section {
    margin-top: 20px;
}

.technician-rating-card {
    background: var(--white);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.1);
}

.technician-rating-display {
    direction: rtl;
}

.rating-main-display {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
}

.rating-value-large {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.rating-value-large .rating-number {
    font-size: 3.5em;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.rating-value-large .rating-max {
    font-size: 1.8em;
    color: var(--text-light);
    font-weight: 500;
}

.rating-stars-display {
    display: flex;
    justify-content: center;
    gap: 8px;
    direction: rtl;
    flex-direction: row-reverse;
}

.rating-details {
    margin-top: 20px;
}

.rating-detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: var(--light-bg);
    border-radius: 8px;
    margin-bottom: 12px;
    border-right: 3px solid var(--primary-color);
}

.rating-detail-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-dark);
    flex: 1;
}

.rating-detail-item label i {
    color: var(--primary-color);
    font-size: 1.1em;
}

.rating-detail-item .rating-value {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--warning-color);
    margin: 0 5px;
}

.rating-detail-item .rating-count {
    font-size: 0.9em;
    color: var(--text-light);
    font-weight: 500;
}

.rating-note {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.05) 0%, rgba(33, 150, 243, 0.02) 100%);
    border-radius: 10px;
    border-right: 4px solid var(--primary-color);
}

.rating-note label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
    font-size: 1.05em;
}

.rating-note label i {
    color: var(--primary-color);
    font-size: 1.1em;
}

.note-content {
    background: var(--white);
    padding: 15px;
    border-radius: 8px;
    color: var(--text-dark);
    line-height: 1.8;
    font-size: 0.95em;
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.note-date {
    margin-top: 12px;
    font-size: 0.85em;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.note-date i {
    color: var(--text-light);
}

.no-rating-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.no-rating-message i {
    font-size: 3em;
    color: var(--border-color);
    margin-bottom: 15px;
    display: block;
}

.no-rating-message p {
    font-size: 1.1em;
    margin: 0;
}

.loading-rating {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.loading-rating i {
    font-size: 2.5em;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-rating p {
    font-size: 1em;
    margin: 0;
}

/* Responsive Design for Technician Rating in Profile */
@media (max-width: 768px) {
    .technician-rating-card {
        padding: 20px;
    }
    
    .rating-value-large .rating-number {
        font-size: 2.8em;
    }
    
    .rating-value-large .rating-max {
        font-size: 1.5em;
    }
    
    .rating-stars-display {
        gap: 6px;
    }
    
    .rating-stars-display i {
        font-size: 1.5em !important;
    }
    
    .rating-detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .note-content {
        font-size: 0.9em;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .technician-rating-card {
        padding: 15px;
    }
    
    .rating-value-large .rating-number {
        font-size: 2.2em;
    }
    
    .rating-value-large .rating-max {
        font-size: 1.2em;
    }
    
    .rating-stars-display i {
        font-size: 1.3em !important;
    }
    
    .rating-detail-item {
        padding: 10px 12px;
    }
    
    .rating-note {
        padding: 15px;
    }
}

.profile-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.profile-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-info-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.profile-info-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-right: 3px solid #2196F3;
}

.profile-info-item label {
    font-weight: bold;
    color: #555;
    min-width: 150px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-info-item span {
    color: #333;
    flex: 1;
}

.biometric-register-section {
    margin-bottom: 30px;
}

/* نموذج تعديل الملف الشخصي */
.profile-edit-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-edit-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-edit-form label {
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-edit-form label i {
    color: var(--primary-color);
    font-size: 1.1em;
}

.profile-edit-form input[type="text"],
.profile-edit-form input[type="password"] {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: var(--white);
    color: var(--text-dark);
}

.profile-edit-form input[type="text"]:focus,
.profile-edit-form input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.profile-edit-form input[type="text"]:invalid:not(:placeholder-shown),
.profile-edit-form input[type="password"]:invalid:not(:placeholder-shown) {
    border-color: var(--danger-color);
}

.profile-edit-form .form-hint {
    font-size: 0.85em;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.profile-edit-form .form-hint i {
    color: var(--primary-color);
}

.validation-message {
    font-size: 0.9em;
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    transition: all 0.3s ease;
}

.validation-message.loading {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.1);
}

.validation-message.success {
    color: var(--success-color);
    background: rgba(76, 175, 80, 0.1);
}

.validation-message.error {
    color: var(--danger-color);
    background: rgba(244, 67, 54, 0.1);
}

.validation-message i {
    font-size: 1.1em;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.form-actions .btn {
    min-width: 120px;
    padding: 12px 24px;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.form-actions .btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.form-actions .btn-primary:hover:not(:disabled) {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.form-actions .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.form-actions .btn-secondary {
    background: var(--light-bg);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.form-actions .btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.credentials-list-section {
    margin-top: 30px;
}

.credentials-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.credential-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

.credential-item:hover {
    border-color: rgba(79, 90, 100, 1);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
}

.credential-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.credential-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.credential-details {
    flex: 1;
}

.credential-name {
    font-weight: bold;
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.credential-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #666;
    flex-wrap: wrap;
}

.credential-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Responsive design for profile */
@media (max-width: 768px) {
    .profile-container {
        padding: 10px;
    }
    
    .profile-section {
        padding: 15px;
    }
    
    .profile-info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .profile-info-item label {
        min-width: auto;
    }
    
    .profile-edit-form {
        gap: 15px;
    }
    
    .profile-edit-form input[type="text"],
    .profile-edit-form input[type="password"] {
        padding: 10px 12px;
        font-size: 0.95em;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        min-width: auto;
    }
    
    .credential-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .credential-item button {
        width: 100%;
    }
    
    .credential-meta {
        flex-direction: column;
        gap: 8px;
    }
}

/* أنماط أزرار أنواع الصيانة */
.repair-type-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.repair-type-tab {
    flex: 1;
    padding: 12px 20px;
    background: var(--light-bg);
    color: var(--text-dark);
    border: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.repair-type-tab:hover {
    background: var(--secondary-color);
    color: var(--white);
    transform: translateY(-2px);
}

.repair-type-tab.active {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

/* تصميم متجاوب لأزرار أنواع الصيانة */
@media (max-width: 768px) {
    .repair-type-tabs {
        flex-direction: row;
        gap: 5px;
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .repair-type-tab {
        border-radius: 8px;
        padding: 10px 8px;
        font-size: 13px;
    }
}

/* Customer Profile Styles - Professional & Modern Design */

.customer-profile-modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.customer-profile-content {
    max-width: 1200px;
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.15);
    background: var(--white);
    position: relative;
    animation: slideUp 0.4s ease;
    font-family: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.customer-profile-content .modal-body {
    padding: 0;
}

.customer-profile-header {
    border-bottom: none;
    padding: 28px 40px;
    background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #3949ab 100%);
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    border-bottom: 3px solid rgba(255, 255, 255, 0.15);
}

.customer-profile-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.customer-profile-header h3 {
    margin: 0;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.75em;
    font-weight: 800;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 1;
}

.customer-profile-header .profile-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.customer-profile-header .btn-profile-action {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    padding: 10px 18px;
    border-radius: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    backdrop-filter: blur(8px);
    cursor: pointer;
    font-size: 14px;
    letter-spacing: 0.3px;
}

.customer-profile-header .btn-profile-action:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.customer-profile-header .btn-close {
    color: var(--white);
    font-size: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
}

.customer-profile-header .btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
}

.customer-info-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    color: var(--text-dark);
    padding: 35px 40px;
    border-radius: 12px;
    margin: 30px 40px 30px 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.customer-info-header {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
    padding-bottom: 28px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

.customer-avatar {
    width: 110px;
    height: 110px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1976D2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.2em;
    color: var(--white);
    border: 4px solid var(--white);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.25), 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.customer-info-details {
    flex: 1;
}

.customer-info-details h2 {
    margin: 0 0 8px 0;
    font-size: 2.1em;
    font-weight: 800;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    color: var(--text-dark);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.customer-info-details .shop-name {
    margin: 6px 0 0 0;
    font-size: 1.15em;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

.customer-info-details .customer-type {
    margin: 10px 0 0 0;
    font-size: 0.95em;
    color: var(--text-light);
    font-weight: 500;
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

.customer-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    position: relative;
    z-index: 1;
}

.customer-info-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 1em;
    background: var(--white);
    padding: 18px 20px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
}

.customer-info-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.12);
    transform: translateY(-2px);
}

.customer-info-item i {
    font-size: 1.5em;
    color: var(--primary-color);
    margin-top: 2px;
    flex-shrink: 0;
}

.customer-info-item-label {
    font-size: 0.85em;
    color: var(--text-light);
    margin-bottom: 6px;
    font-weight: 500;
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

.customer-info-item-value {
    font-weight: 700;
    font-size: 1.05em;
    color: var(--text-dark);
    font-family: 'Cairo', 'Tajawal', sans-serif;
    line-height: 1.4;
}

.customer-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 22px;
    margin: 0 40px 35px 40px;
}

.customer-stat-card {
    color: var(--white);
    padding: 32px 28px;
    border-radius: 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.customer-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18) !important;
}

.customer-stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shimmer 2s infinite;
}

.customer-stat-card.stat-invoices {
    background: linear-gradient(135deg, #2e7d32 0%, #388e3c 50%, #43a047 100%);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.3);
}

.customer-stat-card.stat-total {
    background: linear-gradient(135deg, #e65100 0%, #f57c00 50%, #ff9800 100%);
    box-shadow: 0 6px 20px rgba(230, 81, 0, 0.3);
}

.customer-stat-card.stat-debts {
    background: linear-gradient(135deg, rgba(255, 0, 0, 1) 0%, rgba(168, 50, 0, 1) 100%);
    box-shadow: 0 6px 20px rgba(255, 0, 0, 0.3);
}

.customer-stat-card .stat-decorative-circle {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.customer-stat-card .stat-decorative-circle.circle-1 {
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
}

.customer-stat-card .stat-decorative-circle.circle-2 {
    bottom: -30px;
    left: -30px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.08);
}

.customer-stat-value {
    font-size: 3.2em;
    font-weight: 800;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-family: 'Cairo', 'Tajawal', sans-serif;
    letter-spacing: -1px;
    line-height: 1.1;
}

.customer-stat-label {
    opacity: 0.98;
    font-size: 1.1em;
    font-weight: 600;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    letter-spacing: 0.2px;
}

.customer-stat-label i {
    font-size: 1.3em;
}

.customer-sales-section {
    margin: 0 40px 40px 40px;
    padding-top: 30px;
    border-top: 2px solid rgba(0, 0, 0, 0.06);
}

.customer-sales-section h3 {
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 1.65em;
    color: var(--text-dark);
    padding-bottom: 18px;
    border-bottom: 2px solid var(--primary-color);
    font-weight: 800;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    letter-spacing: -0.3px;
}

.customer-sales-section .section-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary-color), #1976D2);
    color: var(--white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.customer-sales-section .section-badge {
    background: linear-gradient(135deg, var(--primary-color), #1976D2);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.customer-sales-empty {
    text-align: center;
    padding: 70px 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px dashed rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.customer-sales-empty i {
    font-size: 4.5em;
    color: var(--text-light);
    margin-bottom: 20px;
    display: block;
    opacity: 0.6;
}

.customer-sales-empty p {
    color: var(--text-light);
    font-size: 1.15em;
    margin: 0;
    font-weight: 500;
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

.customer-sales-table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--white);
}

.customer-sales-table thead {
    background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #3949ab 100%);
    color: var(--white);
}

.customer-sales-table thead th {
    padding: 18px 20px;
    font-weight: 700;
    font-size: 1.05em;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.3px;
}

.customer-sales-table tbody tr {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: var(--white);
}

.customer-sales-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.04), rgba(33, 150, 243, 0.01));
    border-left: 3px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.08);
}

.customer-sales-table tbody td {
    padding: 20px;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    color: var(--text-dark);
}

.invoice-number-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.invoice-number-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), #1976D2);
    color: var(--white);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.invoice-number-text {
    color: var(--primary-color);
    font-size: 1.1em;
    font-weight: 700;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    letter-spacing: 0.3px;
}

/* علامة مميزة للفواتير المرتجعة */
.return-badge {
    position: absolute;
    top: -4px;
    left: -2px;
    background: var(--danger-color);
    color: var(--white);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(228, 36, 15, 0.4);
    z-index: 10;
    animation: pulse-badge 2s infinite;
    cursor: help;
}

.return-badge i {
    font-size: 14px;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 6px rgba(255, 165, 0, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 3px 10px rgba(255, 165, 0, 0.6);
    }
}

.invoice-date-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
}

.invoice-date-cell i {
    color: var(--primary-color);
}

.invoice-items-badge {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1976d2;
    padding: 8px 16px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 1.05em;
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.invoice-amount {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 1.05em;
}

.invoice-amount-currency {
    color: var(--text-light);
    font-size: 0.9em;
}

.invoice-final-amount {
    color: var(--success-color);
    font-size: 1.3em;
    font-weight: 800;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    text-shadow: 0 1px 3px rgba(33, 150, 243, 0.15);
    letter-spacing: -0.3px;
}

.invoice-remaining-amount {
    color: var(--danger-color);
    font-size: 1.3em;
    font-weight: 800;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    letter-spacing: -0.3px;
}

.invoice-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.btn-invoice-action {
    padding: 10px 18px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn-invoice-pdf {
    background: linear-gradient(135deg, #2e7d32 0%, #388e3c 100%);
    color: var(--white);
    box-shadow: 0 3px 10px rgba(46, 125, 50, 0.25);
    font-family: 'Cairo', 'Tajawal', sans-serif;
    font-weight: 600;
}

.btn-invoice-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(46, 125, 50, 0.35);
    background: linear-gradient(135deg, #388e3c 0%, #43a047 100%);
}

.btn-invoice-view {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: var(--white);
    box-shadow: 0 3px 10px rgba(26, 35, 126, 0.25);
    font-family: 'Cairo', 'Tajawal', sans-serif;
    font-weight: 600;
}

.btn-invoice-view:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(26, 35, 126, 0.35);
    background: linear-gradient(135deg, #283593 0%, #3949ab 100%);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Responsive Design for Customer Profile */
@media (max-width: 991.98px) {
    .customer-profile-content {
        max-width: 95%;
        padding: 0;
    }

    .customer-profile-header {
        padding: 20px;
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .customer-profile-header .profile-actions {
        width: 100%;
        justify-content: space-between;
    }

    .customer-info-card {
        padding: 25px;
    }

    .customer-info-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .customer-avatar {
        width: 80px;
        height: 80px;
        font-size: 2.5em;
    }

    .customer-info-details h2 {
        font-size: 1.8em;
    }

    .customer-info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .customer-stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .customer-sales-table {
        font-size: 0.9em;
    }

    .customer-sales-table thead th,
    .customer-sales-table tbody td {
        padding: 12px 10px;
    }
}

@media (max-width: 767.98px) {
    .customer-profile-modal {
        padding: 0 !important;
        align-items: flex-start;
        padding-top: 10px;
    }

    .customer-profile-content {
        width: 95% !important;
        max-width: 95% !important;
        max-height: 90vh;
        border-radius: 12px;
        margin: 0 auto;
    }
    
    .customer-profile-header {
        padding: 0.75rem 1rem;
    }

    .customer-profile-header {
        padding: 15px;
        border-radius: 15px 15px 0 0;
    }

    .customer-profile-header h3 {
        font-size: 1.4em;
    }

    .customer-profile-header .btn-profile-action {
        padding: 8px 12px;
        font-size: 12px;
    }

    .customer-info-card {
        padding: 20px;
        border-radius: 15px;
    }

    .customer-avatar {
        width: 70px;
        height: 70px;
        font-size: 2em;
    }

    .customer-info-details h2 {
        font-size: 1.5em;
    }

    .customer-info-details .shop-name {
        font-size: 1em;
    }

    .customer-info-item {
        font-size: 1em;
        padding: 12px;
    }

    .customer-stat-card {
        padding: 20px;
    }

    .customer-stat-value {
        font-size: 2.5em;
    }

    .customer-stat-label {
        font-size: 1em;
    }

    .customer-sales-section h3 {
        font-size: 1.3em;
        flex-wrap: wrap;
    }

    .customer-sales-table {
        font-size: 0.85em;
    }
    
    .table-container.customer-sales-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-container.customer-sales-table table {
        min-width: 600px;
    }

    .customer-sales-table thead th,
    .customer-sales-table tbody td {
        padding: 10px 8px;
    }

    .invoice-actions {
        flex-direction: column;
        width: 100%;
    }

    .btn-invoice-action {
        width: 100%;
        justify-content: center;
    }
}

/* ===== Extra Small Phones (480px) - Customer Profile ===== */
@media (max-width: 480px) {
    .customer-profile-modal {
        padding: 0;
        align-items: flex-start;
    }

    .customer-profile-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .customer-profile-header {
        padding: 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .customer-profile-header .profile-actions {
        flex-direction: column;
        width: 100%;
    }

    .customer-profile-header .btn-profile-action {
        width: 100%;
        justify-content: center;
    }

    .customer-info-grid {
        gap: 10px;
    }

    .customer-info-item {
        font-size: 0.9em;
        padding: 10px;
    }

    .customer-stat-value {
        font-size: 2em;
    }

    .customer-sales-table {
        font-size: 0.8em;
    }

    .invoice-number-icon {
        width: 30px;
        height: 30px;
        font-size: 0.9em;
    }
}

/* إخفاء روابط الشريط الجانبي في الهيدر العلوي */
.top-bar .nav-link,
.top-bar .sidebar-nav,
.top-bar .sidebar {
    display: none !important;
}

/* التأكد من أن الـ sidebar في مكانه الصحيح */
.sidebar {
    position: fixed !important;
    right: 0 !important;
    top: 0 !important;
    width: 260px !important;
    height: 100vh !important;
    z-index: 1000 !important;
}

/* التأكد من أن روابط الشريط الجانبي تظهر فقط داخل الـ sidebar */
.sidebar-nav .nav-link {
    display: flex !important;
}

/* منع ظهور أي روابط خارج الـ sidebar */
body > .nav-link,
.main-content > .nav-link,
.top-bar > .nav-link {
    display: none !important;
}

/* ========== أنماط جدول المستحقات ========== */

/* Grid Layout للمصروفات والمستحقات */
.expenses-grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
    box-sizing: border-box;
}

.expenses-table-wrapper,
.salaries-table-wrapper {
    background: var(--white);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ✅ إضافة شريط تمرير أفقي لجدول المستحقات */
.salaries-table-wrapper .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--light-bg);
}

.salaries-table-wrapper .table-container::-webkit-scrollbar {
    height: 8px;
}

.salaries-table-wrapper .table-container::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 4px;
}

.salaries-table-wrapper .table-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.salaries-table-wrapper .table-container::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.salaries-table-wrapper .data-table {
    min-width: 600px;
    width: 100%;
}

.table-title {
    color: var(--primary-color);
    font-size: 1.3em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-title i {
    font-size: 1.2em;
}

/* أنماط بروفايل المستخدم */
.user-profile-content {
    padding: 20px;
}

.profile-section {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--light-bg);
    border-radius: 8px;
}

.profile-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--white);
    border-radius: 5px;
}

.info-label {
    color: var(--text-light);
    font-weight: 500;
}

.info-value {
    color: var(--text-dark);
    font-weight: 600;
}

.salary-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.salary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--white);
    border-radius: 5px;
    border-right: 4px solid var(--border-color);
}

.salary-item.total {
    border-right-color: var(--primary-color);
    background: var(--light-bg);
}

.salary-label {
    color: var(--text-light);
    font-weight: 500;
}

.salary-value {
    font-size: 1.2em;
    font-weight: 700;
}

.salary-value.primary {
    color: var(--primary-color);
}

.salary-value.danger {
    color: var(--danger-color);
}

.salary-value.success {
    color: var(--success-color);
}

.deductions-list {
    margin-top: 20px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge-warning {
    background: var(--warning-color);
    color: var(--white);
}

.badge-danger {
    background: var(--danger-color);
    color: var(--white);
}

/* Responsive Design للمستحقات */
@media (max-width: 991.98px) {
    .expenses-grid-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .expenses-table-wrapper,
    .salaries-table-wrapper {
        padding: 15px;
    }
    
    .profile-section {
        padding: 15px;
    }
    
    .salary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .salary-value {
        font-size: 1.1em;
    }
}

@media (max-width: 767.98px) {
    .expenses-grid-container {
        gap: 15px;
        padding: 0 5px;
    }
    
    .expenses-table-wrapper,
    .salaries-table-wrapper {
        padding: 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .expenses-table-wrapper > div:first-child,
    .salaries-table-wrapper > div:first-child {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .expenses-table-wrapper .btn,
    .salaries-table-wrapper .btn {
        font-size: 0.9em;
        padding: 8px 12px;
    }
    
    .table-title {
        font-size: 1.1em;
    }
    
    .profile-section {
        padding: 12px;
        margin-bottom: 20px;
    }
    
    .profile-section h4 {
        font-size: 1.1em;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .salary-item {
        padding: 12px;
    }
    
    .salary-value {
        font-size: 1em;
    }
    
    /* تحسين الجداول داخل expenses-table-wrapper */
    .expenses-table-wrapper .table-container,
    .salaries-table-wrapper .table-container {
        margin: 0 -5px;
        padding: 0 5px;
    }
    
    .expenses-table-wrapper .filters-bar,
    .salaries-table-wrapper .filters-bar {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .expenses-table-wrapper .filters-bar .search-input,
    .expenses-table-wrapper .filters-bar .filter-select,
    .salaries-table-wrapper .filters-bar .search-input,
    .salaries-table-wrapper .filters-bar .filter-select {
        flex: 1;
        min-width: 150px;
    }
}

@media (max-width: 575.98px) {
    .expenses-table-wrapper,
    .salaries-table-wrapper {
        padding: 8px;
        margin: 0 -5px;
        border-radius: 8px;
    }
    
    .expenses-table-wrapper > div:first-child,
    .salaries-table-wrapper > div:first-child {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .expenses-table-wrapper .btn,
    .salaries-table-wrapper .btn {
        width: 100%;
        padding: 10px;
        font-size: 0.9em;
    }
    
    .table-title {
        font-size: 1em;
        margin-bottom: 12px;
    }
    
    .profile-section {
        padding: 10px;
    }
    
    .info-item,
    .salary-item {
        padding: 10px;
        font-size: 0.9em;
    }
    
    /* تحسين عرض الجداول داخل expenses-table-wrapper على الشاشات الصغيرة */
    .expenses-table-wrapper .table-container {
        margin: 0;
        padding: 0;
        border-radius: 6px;
    }
    
    /* ✅ السماح بالتمرير الأفقي لجدول المستحقات على الشاشات الصغيرة */
    .salaries-table-wrapper .table-container {
        margin: 0;
        padding: 0;
        border-radius: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .expenses-table-wrapper .data-table {
        min-width: unset;
        width: 100%;
        font-size: 0.85em;
    }
    
    /* ✅ الحفاظ على min-width لجدول المستحقات للسماح بالتمرير الأفقي */
    .salaries-table-wrapper .data-table {
        min-width: 600px;
        width: 100%;
        font-size: 0.85em;
    }
    
    .expenses-table-wrapper .data-table th,
    .expenses-table-wrapper .data-table td,
    .salaries-table-wrapper .data-table th,
    .salaries-table-wrapper .data-table td {
        padding: 8px 6px;
        font-size: 0.85em;
        white-space: normal;
        word-break: break-word;
    }
    
    /* تحسين filters-bar داخل expenses-table-wrapper */
    .expenses-table-wrapper .filters-bar,
    .salaries-table-wrapper .filters-bar {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
        padding: 0;
    }
    
    .expenses-table-wrapper .filters-bar .search-input,
    .expenses-table-wrapper .filters-bar .filter-select,
    .salaries-table-wrapper .filters-bar .search-input,
    .salaries-table-wrapper .filters-bar .filter-select {
        width: 100%;
        min-width: 100%;
        padding: 10px;
        font-size: 0.9em;
    }
}

/* ========== أنماط خزنة الفرع ========== */
.treasury-section {
    margin-bottom: 30px;
    width: 100%;
    overflow-x: hidden;
}

.treasury-header {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
}

.treasury-header h2 {
    color: var(--primary-color);
    font-size: 1.5em;
    margin: 0;
}

.treasury-summary {
    margin-bottom: 20px;
}

.summary-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.sales-filter-section {
    margin-bottom: 20px;
}

.sales-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.branch-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
}

.branch-switcher label {
    font-weight: 500;
    color: var(--text-dark);
}

.filter-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9em;
    background: var(--white);
    color: var(--text-dark);
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

/* Responsive Design للخزنة */
@media (max-width: 767.98px) {
    .treasury-header h2 {
        font-size: 1.2em;
    }
    
    .summary-card {
        padding: 12px !important;
    }
    
    .sales-summary {
        grid-template-columns: 1fr;
    }
    
    .branch-switcher {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .branch-switcher label {
        font-size: 0.9em;
    }
    
    /* إضافة مساحة سفلية إضافية لأقسام الخزنة */
    #branch-treasury-section,
    #treasury-deposits-section,
    #treasury-withdrawals-section {
        padding-bottom: 30px;
    }
    
    /* تحسينات responsive لصفحة خزنة الفرع */
    .treasury-header {
        padding: 15px !important;
    }
    
    .treasury-summary,
    .sales-summary {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .summary-card {
        padding: 15px !important;
    }
    
    .sales-filter-section {
        padding: 15px !important;
    }
    
    .branch-switcher {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    
    .filter-input {
        width: 100% !important;
        padding: 10px !important;
    }
}

@media (max-width: 575.98px) {
    .treasury-header {
        padding: 10px !important;
    }
    
    .treasury-header h2 {
        font-size: 1em !important;
    }
    
    .summary-card {
        padding: 12px !important;
    }
    
    .summary-card label {
        font-size: 0.8em !important;
    }
    
    .summary-card div {
        font-size: 1.1em !important;
    }
    
    .sales-filter-section {
        padding: 10px !important;
        margin-bottom: 12px !important;
    }
    
    .sales-filter-section h3 {
        font-size: 1em !important;
        margin-bottom: 10px !important;
    }
    
    .branch-switcher label {
        font-size: 0.85em !important;
    }
    
    .filter-input {
        font-size: 0.9em !important;
        padding: 8px !important;
    }
}

/* جدول معاملات الخزنة - تخصيص لون الرأس */
#treasuryTransactionsTable thead {
    background: rgba(24, 175, 57, 1) !important;
}

/* تحسين التصميم المتجاوب لشريط الفلترة */
@media (max-width: 575.98px) {
    .treasury-transactions-section .filters-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .treasury-transactions-section .filters-bar > div {
        width: 100%;
        min-width: 100%;
    }
}

/* أنماط البحث عن العملاء */
.customer-search-wrapper {
    position: relative;
    width: 100%;
}

.customer-search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    background: var(--white);
    color: var(--text-dark);
    transition: border-color 0.3s ease;
}

.customer-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.customer-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-shadow: var(--shadow);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
}

.customer-dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    color: var(--text-dark);
}

.customer-dropdown-item:last-child {
    border-bottom: none;
}

.customer-dropdown-item:hover,
.customer-dropdown-item.selected {
    background-color: var(--light-bg);
}

.customer-dropdown-item .customer-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.customer-dropdown-item .customer-phone {
    font-size: 0.9em;
    color: var(--text-light);
}

.customer-dropdown-item .customer-shop {
    font-size: 0.85em;
    color: var(--text-light);
    font-style: italic;
}

.customer-dropdown-empty {
    padding: 15px;
    text-align: center;
    color: var(--text-light);
    font-style: italic;
}

/* تحسين التصميم المتجاوب للبحث عن العملاء */
@media (max-width: 575.98px) {
    .customer-dropdown {
        max-height: 250px;
    }
    
    .customer-dropdown-item {
        padding: 10px 12px;
    }
}

/* ============================================
   Floating Chat Modal (Desktop Only)
   ============================================ */

/* النموذج العائم للشات - يظهر فقط على شاشات الكمبيوتر */
@media (min-width: 768px) {
    .floating-chat-modal {
        position: fixed;
        left: 20px; /* أقصى يسار الشاشة */
        right: auto;
        top: 50%;
        transform: translateY(-50%);
        width: 90vw;
        max-width: 500px;
        height: 80vh;
        max-height: 700px;
        background: var(--white);
        border-radius: 12px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
        z-index: 2000; /* أعلى من sidebar */
        display: flex;
        flex-direction: column;
        overflow: hidden;
        animation: slideInFromLeft 0.3s ease;
    }

    @keyframes slideInFromLeft {
        from {
            opacity: 0;
            transform: translateY(-50%) translateX(-20px);
        }
        to {
            opacity: 1;
            transform: translateY(-50%) translateX(0);
        }
    }

    .floating-chat-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 15px 20px;
        background: var(--white);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        border-bottom: 1px solid var(--border-color);
        border-radius: 12px 12px 0 0;
        position: relative;
        z-index: 100;
    }

    .floating-chat-header h3 {
        font-size: 20px;
        font-weight: 700;
        color: var(--primary-color);
        margin: 0;
        flex: 1;
        text-align: center;
    }

    .floating-chat-header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .floating-chat-delete-btn {
        background: var(--danger-color);
        border: none;
        color: var(--white);
        cursor: pointer;
        padding: 8px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        width: 36px;
        height: 36px;
        box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
    }

    .floating-chat-delete-btn:hover {
        background: #D32F2F;
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
    }

    .floating-chat-delete-btn:active {
        transform: scale(0.95);
    }

    .floating-chat-delete-btn svg {
        width: 18px;
        height: 18px;
    }

    .floating-chat-refresh-btn {
        background: var(--primary-color);
        border: none;
        color: var(--white);
        cursor: pointer;
        padding: 8px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        width: 36px;
        height: 36px;
        box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
    }

    .floating-chat-refresh-btn:hover {
        background: var(--secondary-color);
        transform: scale(1.05) rotate(90deg);
        box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
    }

    .floating-chat-refresh-btn:active {
        transform: scale(0.95) rotate(90deg);
    }

    .floating-chat-refresh-btn.refreshing {
        animation: rotateRefresh 1s linear infinite;
    }

    @keyframes rotateRefresh {
        from {
            transform: rotate(0deg);
        }
        to {
            transform: rotate(360deg);
        }
    }

    .floating-chat-refresh-btn svg {
        width: 20px;
        height: 20px;
    }

    .floating-chat-close-btn {
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-dark);
        transition: all 0.3s ease;
        border-radius: 8px;
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .floating-chat-close-btn:hover {
        background: var(--light-bg);
        color: var(--danger-color);
        transform: scale(1.1);
    }

    .floating-chat-close-btn:active {
        transform: scale(0.95);
    }

    .floating-chat-body {
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        background: linear-gradient(135deg, var(--light-bg) 0%, var(--secondary-color) 20%);
    }

    .floating-chat-body iframe {
        width: 100%;
        height: 100%;
        border: none;
        background: transparent;
    }

    .floating-chat-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(2px);
        z-index: 1999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .floating-chat-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* تحسينات للشاشات الكبيرة */
    @media (min-width: 992px) {
        .floating-chat-modal {
            max-width: 450px;
            max-height: 650px;
        }
    }

    @media (min-width: 1200px) {
        .floating-chat-modal {
            max-width: 500px;
            max-height: 700px;
        }
    }
}

/* إخفاء النموذج على الموبايل */
@media (max-width: 767.98px) {
    .floating-chat-modal,
    .floating-chat-overlay {
        display: none !important;
    }
}

/* Phone Action Modal Styles */
.phone-number-clickable {
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
    transition: all 0.2s ease;
    user-select: none;
}

.phone-number-clickable:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

.phone-number-clickable:active {
    transform: scale(0.98);
}

/* Phone Action Modal */
#phoneActionModal {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#phoneActionModal.show {
    display: flex;
    opacity: 1;
}

#phoneActionModal .modal-content {
    animation: slideInModal 0.3s ease;
}

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

#phoneActionModal .modal-body {
    padding: 20px;
}

#phoneActionModal .modal-body p {
    margin: 0;
}

#phoneActionModal #phoneActionModalNumber {
    direction: ltr;
    text-align: center;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* Phone Action Buttons */
.btn-phone-action {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-family: inherit;
}

.btn-phone-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-phone-action:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn-phone-action i {
    font-size: 1.2em;
}

/* WhatsApp Button Specific - استخدام nth-child بدلاً من onclick selector */
.btn-phone-action:nth-child(3) {
    background: #25D366;
}

.btn-phone-action:nth-child(3):hover {
    background: #20BA5A;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

/* Call Button Specific */
.btn-phone-action:nth-child(2) {
    background: var(--success-color);
}

.btn-phone-action:nth-child(2):hover {
    background: #45a049;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* Copy Button Specific */
.btn-phone-action:nth-child(1) {
    background: var(--primary-color);
}

.btn-phone-action:nth-child(1):hover {
    background: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

/* Responsive Design for Phone Modal */
@media (max-width: 575.98px) {
    #phoneActionModal .modal-content.modal-sm {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px;
    }
    
    #phoneActionModal .modal-body {
        padding: 15px;
    }
    
    .btn-phone-action {
        padding: 12px 15px;
        font-size: 0.95em;
    }
    
    #phoneActionModal .modal-body i.bi-telephone-fill {
        font-size: 2.5em !important;
    }
    
    #phoneActionModal #phoneActionModalNumber {
        font-size: 1.1em !important;
    }
}

/* Dark Mode Support */
.dark-mode #phoneActionModal .modal-content {
    background: var(--dark-bg);
    color: var(--white);
}

.dark-mode #phoneActionModal .modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.dark-mode #phoneActionModal .modal-header h3 {
    color: var(--white);
}

.dark-mode #phoneActionModal .modal-body p {
    color: var(--white);
}

.dark-mode .phone-number-clickable {
    color: var(--secondary-color);
}

.dark-mode .phone-number-clickable:hover {
    color: var(--primary-color);
}