:root {
    /* نظام ألوان حديث ومتطور */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #8b5cf6;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1f2937;
    --light: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* تدرجات حديثة */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-warning: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-info: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-ai: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    
    /* ظلال حديثة */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --sidebar-width: 250px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
}

/* تحسينات عامة للكروت */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 1rem 1.5rem;
    border-bottom: none;
}

/* أزرار حديثة */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

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

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

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

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

.btn-gradient-ai {
    background: var(--gradient-ai);
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* مؤشرات الأداء الحديثة */
.kpi-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.kpi-label {
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.trend-up {
    color: var(--success);
}

.trend-down {
    color: var(--danger);
}

/* تحسينات الجداول */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: white;
}

.table thead th {
    background: var(--gradient-primary);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 1rem;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: var(--gray-50);
    transform: scale(1.01);
}

.table tbody td {
    padding: 1rem;
    border-color: var(--gray-200);
    vertical-align: middle;
}

/* شارات حديثة */
.badge {
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* تحسينات النماذج */
.form-control {
    border-radius: var(--border-radius);
    border: 2px solid var(--gray-200);
    padding: 0.75rem 1rem;
    transition: var(--transition);
    background: white;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

/* تأثيرات التحميل */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* تحسينات الإشعارات */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    background: white;
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease-out;
}

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

/* تحسينات الرسوم البيانية */
.chart-container {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    position: relative;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* تحسينات السايدبار */
#sidebar {
    background: var(--gradient-primary);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-xl);
}

#sidebar .sidebar-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

#sidebar ul li a {
    transition: var(--transition);
    border-radius: 8px;
    margin: 0.25rem 0.5rem;
}

#sidebar ul li a:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

/* تحسينات responsive */
@media (max-width: 768px) {
    .kpi-card {
        padding: 1.5rem;
    }
    
    .kpi-value {
        font-size: 2rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

.wrapper {
    display: flex;
    width: 100%;
}

/* السايدبار */
#sidebar {
    width: 250px;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 999;
    background: var(--gradient-primary);
    color: #fff;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-xl);
}

#sidebar .sidebar-header {
    padding: 20px;
    background: #2c3136;
    text-align: center;
}

#sidebar ul.components {
    padding: 20px 0;
    border-bottom: 1px solid #47494c;
}

#sidebar ul li {
    border-bottom: 1px solid #47494c;
}

#sidebar ul li:last-child {
    border-bottom: none;
}

#sidebar ul li a {
    padding: 15px 20px;
    font-size: 1.1em;
    display: block;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s;
}

#sidebar ul li a:hover,
#sidebar ul li a.active {
    color: #fff;
    background: #007bff;
}

#sidebar ul li.active > a {
    color: #fff;
    background: #007bff;
}

/* المحتوى الرئيسي */
#content {
    width: calc(100% - 250px);
    margin-right: 250px;
    min-height: 100vh;
    transition: all 0.3s;
    position: relative;
    background: #f4f6f9;
    padding: 20px;
}

/* LTR Layout Support */
html[dir="ltr"] #content {
    margin-right: 0;
    margin-left: 280px;
}

html[dir="ltr"] #sidebar {
    right: auto;
    left: 0;
}

/* POS Page - Auto Hide Sidebar */
body.pos-page #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

body.pos-page.rtl #sidebar {
    transform: translateX(100%);
}

body.pos-page #content {
    margin-right: 0;
    margin-left: 0;
    width: 100%;
    transition: all 0.3s ease;
}

/* Show sidebar toggle button on POS page */
body.pos-page .sidebar-toggle-btn {
    display: block;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

body.pos-page.rtl .sidebar-toggle-btn {
    left: auto;
    right: 20px;
}

body.pos-page .sidebar-toggle-btn:hover {
    background: #0056b3;
    transform: scale(1.05);
}

/* When sidebar is shown on POS page */
body.pos-page.sidebar-visible #sidebar {
    transform: translateX(0);
}

body.pos-page.sidebar-visible #content {
    margin-right: 280px;
}

body.pos-page.sidebar-visible.rtl #content {
    margin-right: 0;
    margin-left: 280px;
}

/* زر التبديل */
#sidebarCollapse {
    display: none;
}

/* تعديلات السايدبار للشاشات الصغيرة */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        position: relative;
    }

    body.sidebar-active {
        overflow: hidden;
    }

    #sidebarCollapse {
        display: block;
    }

    #sidebar {
        margin-right: -250px;
        box-shadow: none;
    }

    #sidebar.active {
        margin-right: 0;
        box-shadow: 0 0 15px rgba(0,0,0,0.2);
    }

    /* LTR mobile layout */
    html[dir="ltr"] #sidebar {
        margin-right: 0;
        margin-left: -280px;
        left: 0;
        right: auto;
    }

    html[dir="ltr"] #sidebar.active {
        margin-left: 0;
    }

    #content {
        width: 100%;
        margin-right: 0;
        padding: 15px;
        transition: transform 0.3s ease-in-out;
    }

    html[dir="ltr"] #content {
        margin-left: 0;
    }

    body.sidebar-active #content {
        transform: translateX(-250px);
    }

    html[dir="ltr"] body.sidebar-active #content {
        transform: translateX(250px);
    }

    .overlay {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.7);
        z-index: 998;
        opacity: 0;
        transition: opacity 0.3s ease-in-out;
    }

    .overlay.active {
        display: block;
        opacity: 1;
    }

    /* تحسين مظهر السايدبار في الموبايل */
    #sidebar .sidebar-header {
        padding: 15px;
        border-bottom: 1px solid #47494c;
    }

    #sidebar ul.components {
        padding: 10px 0;
    }

    #sidebar ul li a {
        padding: 12px 20px;
        font-size: 16px;
    }

    #sidebar ul li a i {
        width: 24px;
        text-align: center;
        margin-left: 8px;
    }
}

/* تنسيق عام */
.nav-link i {
    margin-left: 10px;
    width: 20px;
    text-align: center;
}

.card {
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 15px;
}

.table th {
    background-color: #f8f9fa;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

.card-body {
    padding: 20px;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
}

/* تنسيق أزرار الإجراءات في الجداول */
.btn-whatsapp {
    background-color: #25d366;
    color: #fff;
}

.btn-whatsapp:hover {
    background-color: #128c7e;
    color: #fff;
}

.table .btn-group {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.table .btn-group .btn {
    margin: 2px;
    white-space: nowrap;
}

/* جداول متجاوبة للموبايل */
@media (max-width: 767.98px) {
    .table-responsive-stack thead {
        display: none;
    }
    
    .table-responsive-stack tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
    }
    
    .table-responsive-stack td {
        display: block;
        text-align: right;
        padding: 0.75rem;
        border: none;
        position: relative;
        padding-right: 50%;
        white-space: normal;
    }
    
    .table-responsive-stack td:before {
        content: attr(data-label);
        position: absolute;
        right: 0;
        width: 45%;
        padding-right: 0.75rem;
        font-weight: bold;
        text-align: right;
    }
    
    .table-responsive-stack td:not(:last-child) {
        border-bottom: 1px solid #dee2e6;
    }
    
    .table-responsive-stack .btn-group {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .table-responsive-stack .btn-group .btn {
        width: 100%;
        margin: 0;
    }
    
    .table-responsive-stack .badge {
        display: inline-block;
        margin: 0 auto;
    }
}

/* Custom Buttons */
.btn-info {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-info:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

/* Stats Cards */
.card .display-6 {
    font-size: 2rem;
    font-weight: 500;
}

/* Navbar */
.navbar {
    padding: 15px;
    background: white !important;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

/* أزرار التحكم */
.btn-toggle-sidebar {
    display: none;
}

@media (max-width: 768px) {
    .btn-toggle-sidebar {
        display: block;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
        width: 45px;
        height: 45px;
        border-radius: 50%;
        background: #0d6efd;
        color: white;
        border: none;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }
}

/* تنسيق بطاقات الحجوزات */
.booking-card {
    transition: all 0.3s ease;
    height: 100%;
}

.booking-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.booking-card .card-header {
    padding: 1rem;
}

.booking-card .badge {
    font-size: 0.9rem;
}

.booking-card .card-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.booking-card .card-text {
    margin-bottom: 0.5rem;
}

.booking-card .card-text i {
    width: 20px;
    text-align: center;
    margin-left: 8px;
}

.booking-card .btn {
    margin-bottom: 0.5rem;
}

.booking-card .btn i {
    margin-left: 8px;
}

.booking-card.border-warning {
    border-width: 2px;
}

.booking-card.border-info {
    border-width: 2px;
}
