:root {
    /* المتغيرات العامة */
    /* ألوان جذابة وعصرية */
    --primary-color: #FF6B35;
    /* برتقالي حيوي */
    --primary-dark: #E85A2A;
    --primary-light: #FF8C61;
    --secondary-color: #004E89;
    /* أزرق داكن أنيق */
    --accent-color: #FFD23F;
    /* أصفر ذهبي */

    /* خلفيات متدرجة */
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --card-gradient: linear-gradient(135deg, rgba(255, 107, 53, 0.05) 0%, rgba(0, 78, 137, 0.05) 100%);

    /* ألوان النصوص - محسّنة للوضوح القصوى */
    --text-primary: #020617;
    /* أسود كحلي غامق جداً */
    --text-secondary: #1e293b;
    /* كحلي غامق */
    --text-light: #475569;
    /* رمادي غامق مقروء */
    --text-color: #020617;
    /* لون النص الافتراضي */

    /* خلفيات */
    --bg-primary: #f8fafc;
    --bg-secondary: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --card-color: rgba(255, 255, 255, 0.95);

    /* ألوان الحالات */
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    /* ظلال */
    --shadow-sm: 0 2px 8px rgba(102, 126, 234, 0.15);
    --shadow-md: 0 4px 16px rgba(102, 126, 234, 0.2);
    --shadow-lg: 0 8px 32px rgba(102, 126, 234, 0.25);

    /* حدود */
    --border-radius: 16px;
    --border-color: rgba(102, 126, 234, 0.2);
}


body.dark-mode {
    /* نصوص محسّنة للوضع الليلي */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-light: #94a3b8;
    --text-color: #f1f5f9;

    /* خلفيات داكنة */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --glass-bg: rgba(15, 23, 42, 0.9);
    --card-color: rgba(30, 41, 59, 0.95);
    --border-color: rgba(148, 163, 184, 0.2);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);

    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* منع التقريب عند النقر المزدوج في PWA مع الحفاظ على التمرير */
    touch-action: manipulation;
}

/* إخفاء شريط السكرول مع الحفاظ على إمكانية التمرير */
/* للمتصفحات الحديثة (Firefox) */
* {
    scrollbar-width: none;
}

/* لمتصفحات WebKit (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* تأكيد إخفاء الـ scrollbar من الـ body و html */
html,
body {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

body {
    font-family: 'Cairo', 'Inter', 'Outfit', ' Almarai', sans-serif;
    background: var(--bg-primary);
    background-image: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    /* direction is handled by html[dir] attribute */
    line-height: 1.6;
    font-weight: 500;
    transition: var(--transition);
}

/* تخصيص الخط للغة الإنجليزية لضمان وضوح المسافات - مع استثناء الأيقونات */
body.lang-en,
body.lang-en :not(i):not([class*="fa-"]),
body.lang-en button:not(i):not([class*="fa-"]),
body.lang-en input,
body.lang-en select,
body.lang-en h1,
body.lang-en h2,
body.lang-en h3,
body.lang-en h4,
body.lang-en p,
body.lang-en span:not(i):not([class*="fa-"]) {
    font-family: 'Inter', 'Outfit', 'Segoe UI', Arial, sans-serif !important;
    word-spacing: 2px !important;
}

/* التأكد من أن الأيقونات تحتفظ بخطها الأصلي دائماً */
body.lang-en i.fas,
body.lang-en i.fab,
body.lang-en i.far,
body.lang-en [class*="fa-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
    word-spacing: normal !important;
}

/* Language Selector */
.lang-selector-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
}

.lang-btn {
    flex: 1;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--glass-bg);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Cairo', sans-serif;
}

.lang-btn:hover {
    background: rgba(255, 107, 53, 0.05);
    border-color: var(--primary-color);
}

.lang-btn.active-lang {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.lang-btn i {
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    body {
        padding-bottom: 70px;
        /* مساحة للشريط السفلي */
    }
}

/* إخفاء العناصر الخاصة بالعملاء فقط عن البائعين والأدمن والمندوبين */
body.seller .customer-only,
body.admin .customer-only,
body.delivery .customer-only {
    display: none !important;
}


p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

label {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 5px;
    display: inline-block;
}

.text-primary {
    color: var(--text-primary) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-light {
    color: var(--text-light) !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.fw-800 {
    font-weight: 800 !important;
}

/* تحسين وضوح النصوص */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 700;
}

p,
span,
div {
    color: var(--text-color);
}

.copyable-id {
    cursor: pointer;
    text-decoration: underline dotted;
    transition: all 0.2s ease;
    display: inline-block;
}

.copyable-id:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

/* الأزرار - تم نقل التعريف إلى الأسفل لتجنب التكرار */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* البطاقات الزجاجية */
.glass-card {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* الشريط العلوي */
/* تم نقل تنسيقات الهيدر إلى sticky-header.css لتحسين الأداء ومنع التعارض */


.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.logo:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

.logo-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    transition: filter 0.3s ease;
}

/* تغيير لون الشعار في الوضع الليلي */
.dark-mode .logo-img {
    filter: brightness(0) invert(1);
}

/* Cart logo styling */
.cart-logo-img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    transition: filter 0.3s ease;
}

/* تغيير لون شعار السلة في الوضع الليلي */
.dark-mode .cart-logo-img {
    filter: brightness(0.9);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    transition: font-size 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.header-controls {
    display: flex;
    gap: 10px;
}

/* الأزرار */
.btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
}

.btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9rem;
}

/* نظام التنقل بين الصفحات */
.page {
    display: none;
    animation: fadeIn 0.5s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تنبيهات */
/* تنبيهات - Premium Toast Style */
#alertsContainer {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.alert {
    width: 100%;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    padding: 14px 20px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    transform-origin: top center;
    animation: toast-enter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    pointer-events: auto;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    border-inline-start: 4px solid transparent;
    /* Default border */
}

/* Status Colors via Border/Icon */
.alert.success {
    border-inline-start-color: #10b981;
}

.alert.error {
    border-inline-start-color: #ef4444;
}

.alert.warning {
    border-inline-start-color: #f59e0b;
}

.alert.info {
    border-inline-start-color: #3b82f6;
}

/* Icon Colors */
.alert.success i {
    color: #10b981;
}

.alert.error i {
    color: #ef4444;
}

.alert.warning i {
    color: #f59e0b;
}

.alert.info i {
    color: #3b82f6;
}

@keyframes toast-enter {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.qr-container {
    background: white;
    padding: 15px;
    border-radius: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px auto;
    width: fit-content;
}

/* نماذج الإدخال */
.form-group {
    margin-bottom: 20px;
    /* Reduced margin for more balanced layout */
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-primary) !important;
    /* ضمان السواد في الوضع النهاري */
}

.form-input {
    width: 100%;
    padding: 15px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
    background: var(--card-color);
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.form-input::placeholder {
    color: var(--text-light);
    opacity: 0.8;
}

.dark-mode .form-input {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* تحسين القوائم المنسدلة في الوضع الليلي */
.dark-mode select.form-input option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.dark-mode .form-input:focus {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.2);
}

/* بطاقات المنتجات */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 منتجات في صف واحد */
    gap: 20px;
    margin-top: 15px;
}

.product-card {
    background: var(--card-color);
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    backdrop-filter: blur(var(--blur-intensity));
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    padding: 12px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(46, 125, 50, 0.2);
}

.product-image {
    width: 100%;
    max-width: 100%;
    height: 140px;
    object-fit: cover;
    object-position: center;
    border-radius: 12px;
    margin-bottom: 10px;
    display: block;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-primary);
    /* استخدام اللون الأساسي للعناوين */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.product-market {
    font-size: 0.75rem;
    color: var(--text-secondary);
    /* استخدام اللون الثانوي للنصوص الفرعية */
    margin-bottom: 8px;
    font-weight: 500;
}

.qr-code-container {
    display: flex;
    justify-content: center;
    margin: 15px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0;
}

/* سلة التسوق */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(76, 175, 80, 0.2);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    font-size: 1.3rem;
    font-weight: 700;
    border-top: 2px solid var(--accent-color);
    margin-top: 20px;
}

/* لوحة الأدمن */
.admin-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.admin-stat {
    text-align: center;
    padding: 20px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 10px 0;
}

/* نظام النجوم للتقييم */
.rating {
    display: flex;
    gap: 5px;
    margin: 10px 0;
}

.star {
    color: #ffc107;
    font-size: 1.2rem;
}

/* QR Scanner */
.scanner-frame {
    width: 220px;
    height: 220px;
    margin: 0 auto 15px;
    border: 4px solid var(--primary-color);
    padding: 10px;
    border-radius: 0;
    background: var(--card-color);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.qr-scanner-container {
    width: 100%;
    height: 100%;
    margin: 0 !important;
    border-radius: 0;
    overflow: hidden;
}

/* Ensure the video inside qrReader fits the container */
#qrReader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 0;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 15px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.divider span {
    padding: 0 10px;
}

.manual-input-fallback {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 15px;
    border: 1px dashed var(--border-color);
}

@media (max-width: 480px) {
    .scanner-frame {
        width: 180px;
        height: 180px;
        padding: 8px;
        border-width: 3px;
    }
}

/* تصميم متجاوب للهواتف */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .main-layout-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    #pagesContainer {
        width: 100%;
    }

    #alertsContainer {
        padding: 0 15px;
    }


    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* بطاقات منتجات مضغوطة للجوال */
    .product-card {
        padding: 8px;
        border-radius: 12px;
    }

    .product-image {
        height: 110px;
        margin-bottom: 6px;
        border-radius: 8px;
    }

    .product-name {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }

    .product-price {
        font-size: 0.95rem;
        margin-bottom: 2px;
    }

    .product-market {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
    }

    .logo h1 {
        font-size: 1.3rem;
    }

    .admin-panel {
        grid-template-columns: 1fr;
    }

    /* تصغير عناصر السلة للجوالات */
    .cart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 0;
    }

    .cart-item>div:first-child {
        width: 100%;
    }

    .cart-item>div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    .cart-item img {
        width: 60px !important;
        height: 60px !important;
    }

    .cart-item h4 {
        font-size: 0.9rem;
    }

    /* قوائم الطلبات المحسنة للموبايل (في الإعدادات) */
    .settings-orders-table {
        font-size: 0.85rem;
    }

    .settings-orders-table th,
    .settings-orders-table td {
        padding: 12px 8px;
    }

    /* Theme Preset Button Gradients */
    .preset-btn-sunset {
        background: linear-gradient(135deg, #FF6B35, #004E89);
    }

    .preset-btn-ocean {
        background: linear-gradient(135deg, #0077B6, #00B4D8);
    }

    .preset-btn-forest {
        background: linear-gradient(135deg, #2D6A4F, #52B788);
    }

    .preset-btn-royal {
        background: linear-gradient(135deg, #7209B7, #B5179E);
    }

    .preset-btn-lavender {
        background: linear-gradient(135deg, #9D4EDD, #C77DFF);
    }

    .preset-btn-teal {
        background: linear-gradient(135deg, #0D7377, #14FFEC);
    }

    /* تصغير status badges للجوالات */
    .status-badge {
        padding: 2px 6px;
        border-radius: 12px;
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    /* تصغير إضافي لعناصر السلة على الشاشات الصغيرة جداً */
    .cart-item {
        padding: 10px 0;
        gap: 8px;
    }

    .cart-item img {
        width: 50px !important;
        height: 50px !important;
    }

    .cart-item h4 {
        font-size: 0.85rem;
    }

    .cart-item>div:last-child {
        flex-wrap: wrap;
        gap: 8px;
    }

    .cart-item .btn {
        padding: 5px 8px;
        font-size: 0.8rem;
    }

    .cart-item .btn i {
        font-size: 0.75rem;
    }

    .cart-total {
        font-size: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* تخصيص شريط التمرير */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(200, 230, 201, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.dark-mode ::-webkit-scrollbar-track {
    background: rgba(50, 60, 50, 0.3);
}

/* تأثيرات إضافية */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* تنسيق جداول الإدارة المتقدمة */
/* Modern PWA Management Table */
.mgmt-table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 15px;
    border-radius: 12px;
}

.mgmt-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--glass-bg);
    /* Use existing glass background if defined, else fallback to semi-transparent white */
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
}

.mgmt-table tbody tr {
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.mgmt-table tbody tr:hover {
    background: rgba(var(--primary-color-rgb, 255, 107, 53), 0.05);
}

.mgmt-table tbody tr:active {
    background: rgba(var(--primary-color-rgb, 255, 107, 53), 0.1);
    transform: scale(0.998);
}

.mgmt-table th,
.mgmt-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);

    font-size: 0.9rem;
}

.mgmt-table th {
    background: rgba(var(--primary-color-rgb, 0, 119, 182), 0.1);
    /* Subtle primary tint */
    color: var(--primary-color);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8rem;
    border-bottom: 2px solid var(--primary-color);
}

.mgmt-table tr:last-child td {
    border-bottom: none;
}

.mgmt-table tr:hover {
    background: rgba(0, 119, 182, 0.05);
    /* Very subtle hover */
    transition: background 0.3s ease;
}

/* Mobile table styles moved to tables-mobile.css */



.btn-full-width {
    width: 100%;
}

.flex-gap-10 {
    display: flex;
    gap: 10px;
}


.dark-mode .mgmt-table {
    background: rgba(255, 255, 255, 0.05);
}

.dark-mode .mgmt-table td {
    color: var(--text-primary);
    /* نص فاتح في الوضع الليلي */
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.status-active {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #15803d;
    border: 1px solid #86efac;
}

.status-inactive {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.status-pending {
    background: linear-gradient(135deg, #fef9c3, #fef08a);
    color: #a16207;
    border: 1px solid #fde047;
}

.status-preparing {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1d4ed8;
    border: 1px solid #93c5fd;
}

.status-shipped,
.status-out_for_delivery {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}

.status-delivered {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #059669;
    border: 1px solid #a7f3d0;
}

.status-accepted {
    background: #f3e5f5;
    color: #7b1fa2;
}

.status-delivery {
    background: #e0f2f1;
    color: #00796b;
}

.status-cancelled {
    background: #ffebee;
    color: #c62828;
}

.mgmt-actions {
    display: flex;
    gap: 10px;
}

/* ===== ANIMATIONS ===== */
@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;
    }
}

/* ===== RESET & BASE ===== */
.user-menu-container {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 180px;
    padding: 8px;
    z-index: 1200;
    display: none;
    flex-direction: column;
    gap: 5px;
    transform-origin: top left;
    animation: dropdownPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dropdown-menu.active {
    display: flex;
}

.dropdown-item {
    background: transparent;
    border: none;
    padding: 10px 15px;
    border-radius: 12px;
    color: var(--text-color);
    font-size: 0.95rem;
    text-align: right;
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(16, 94, 62, 0.1);
    transform: translateX(-5px);
}

.dropdown-item.text-error:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

@keyframes dropdownPop {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.text-error {
    color: #dc3545 !important;
}

/* Header Cart Specific Sizing */
.cart-header-btn,
#guestOrderBtn,
#myOrdersBtn {
    position: relative;
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
}

.cart-header-btn i {
    font-size: 0.9rem;
}

.cart-badge-small {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-color);
    color: var(--text-color);
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid white;
}

/* Header Controls Spacing */
.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-10 {
    gap: 10px;
}

.gap-15 {
    gap: 15px;
}

.w-100 {
    width: 100%;
}

.m-0 {
    margin: 0;
}

.mt-20 {
    margin-top: 20px;
}

.mt-30 {
    margin-top: 30px;
}

.mb-15 {
    margin-bottom: 15px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}

.p-40-20 {
    padding: 40px 20px;
}

.fs-2rem {
    font-size: 2rem;
}

.fs-1-5rem {
    font-size: 1.5rem;
}

.fs-1-2rem {
    font-size: 1.2rem;
}

.fs-0-9rem {
    font-size: 0.9rem;
}

.lh-1-6 {
    line-height: 1.6;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.grid-2-columns {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .grid-2-columns {
        grid-template-columns: 1fr;
    }
}

.checkout-form,
.order-summary {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.order-item-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Compact Product Table for Order Details */
.compact-product-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.compact-product-table th {
    text-align: right;
    padding: 6px 4px;
    border-bottom: 2px solid var(--primary-color);
    color: var(--text-secondary);
    font-weight: 700;
}

.compact-product-table td {
    padding: 8px 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    vertical-align: middle;
}

.compact-product-table tr:last-child td {
    border-bottom: none;
}

.compact-table-name {
    font-weight: 700;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Special Categories Toggles */
.special-categories-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    margin-bottom: 0;
    cursor: pointer;
    font-size: 0.95rem;
    -webkit-user-select: none;
    user-select: none;
    color: var(--text-primary);
}

.role-admin {
    background: #e74c3c !important;
    color: white !important;
}

.role-seller {
    background: #f39c12 !important;
    color: white !important;
}

.role-delivery {
    background: #2ecc71 !important;
    color: white !important;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 25px;
    width: 25px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.checkbox-container:hover input~.checkmark {
    background-color: rgba(255, 255, 255, 0.2);
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 9px;
    top: 5px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container .label-text {
    margin-right: 10px;
}

/* Discount and Badge Styles */
.original-price-strikethrough {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 5px;
}

.discount-price {
    color: var(--danger-color);
    font-weight: 700;
}

.offer-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.compact-product-card {
    position: relative;
}

.compact-table-qty {
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
}

.compact-table-price {
    text-align: left;
    font-weight: 700;
}

.qr-container {
    padding: 20px;
    background: white;
    border-radius: 0;
    margin: 20px auto;
    width: fit-content;
    border: 1px solid #ddd;
}

.qr-container img,
.qr-container canvas,
.qr-code-container img,
.qr-code-container canvas,
#guestOrderQRCode img,
#guestOrderQRCode canvas,
#guestOrderQRCodeViewer img,
#guestOrderQRCodeViewer canvas,
#buyerOrderQRCode img,
#buyerOrderQRCode canvas {
    border-radius: 0 !important;
}

.order-status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}

.status-pending {
    background: #f1c40f;
    color: #000;
}

.status-accepted {
    background: #3498db;
    color: #fff;
}

.status-out_for_delivery {
    background: #e67e22;
    color: #fff;
}

.status-delivered {
    background: #2ecc71;
    color: #fff;
}

.status-cancelled {
    background: #e74c3c;
    color: #fff;
}

#offersContainer .product-card {
    border: 2px solid var(--accent-light);
    position: relative;
    overflow: hidden;
}

.offer-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-color);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.grid-300 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.grid-200 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.flex-start {
    justify-content: flex-start;
}

/* Component Specific Styles */
.hero-section {
    text-align: center;
}

.auth-link {
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    max-width: 420px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.qr-scanner-modal-content {
    max-width: 320px !important;
    overflow: hidden !important;
    /* مسح شريط السكرول */
}

/* إخفاء أي أزرار إضافية يحقنها المكتبة */
#qrReader button {
    display: none !important;
}

/* إطار صورة المنتج في المودال */
.modal-image-frame {
    width: 180px;
    height: 180px;
    margin: 0 auto 20px;
    border: 3px solid var(--primary-color);
    padding: 8px;
    border-radius: 25px;
    background: var(--card-color);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.modal-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
}

@media (max-width: 480px) {
    .modal-image-frame {
        width: 150px;
        height: 150px;
        padding: 6px;
        border-width: 2px;
    }
}

.cart-img-small {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    object-fit: cover;
}

/* ===== تحسينات عامة لوضوح النصوص ===== */
.text-primary {
    color: var(--text-primary) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-light {
    color: var(--text-light) !important;
}

/* تحسين وضوح النصوص في البطاقات الزجاجية */
.glass-card h1,
.glass-card h2,
.glass-card h3,
.glass-card h4,
.glass-card h5,
.glass-card h6 {
    color: var(--text-primary);
}

.glass-card p,
.glass-card span {
    color: var(--text-color);
}

/* تحسين وضوح النصوص في النماذج */
.form-label {
    color: var(--text-primary);
    font-weight: 600;
}

.form-input {
    color: var(--text-primary);
}

.form-input::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

/* تحسين وضوح النصوص في الأزرار */
.btn {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* تحسين قراءة النصوص في الوضع الليلي */
.dark-mode .glass-card {
    color: var(--text-color);
}

.dark-mode .form-input {
    color: var(--text-primary);
}

.dark-mode .form-input::placeholder {
    color: var(--text-light);
    opacity: 0.6;
}

/* ===== تنسيق بطاقات القوالب ===== */
.theme-preset-card {
    background: var(--glass-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}

.theme-preset-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.theme-preview {
    width: 100%;
    height: 80px;
    border-radius: 12px;
    margin-bottom: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-preset-card h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.theme-preset-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.theme-preset-card:active {
    transform: translateY(-2px);
}

/* Floating Action Button (FAB) */
.fab-scanner {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.fab-scanner span {
    display: none;
    margin-right: 12px;
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.fab-scanner:hover {
    width: 160px;
    border-radius: 35px;
    padding: 0 25px;
}

.fab-scanner:hover span {
    display: block;
}

@media (max-width: 768px) {
    .fab-scanner {
        bottom: 25px;
        left: 25px;
        width: 60px;
        height: 60px;
    }
}

/* Theme Preview Gradients */
.theme-preview-sunset {
    background: linear-gradient(135deg, #FF6B35, #004E89);
}

.theme-preview-ocean {
    background: linear-gradient(135deg, #0077B6, #00B4D8);
}

.theme-preview-forest {
    background: linear-gradient(135deg, #2D6A4F, #52B788);
}

.theme-preview-royal {
    background: linear-gradient(135deg, #7209B7, #B5179E);
}

.theme-preview-cherry {
    background: linear-gradient(135deg, #FF006E, #FB5607);
}

.theme-preview-mint {
    background: linear-gradient(135deg, #06FFA5, #00D9FF);
}

.theme-preview-crimson {
    background: linear-gradient(135deg, #D00000, #DC2F02);
}

.theme-preview-golden {
    background: linear-gradient(135deg, #F77F00, #FCBF49);
}

.theme-preview-lavender {
    background: linear-gradient(135deg, #9D4EDD, #C77DFF);
}

.theme-preview-teal {
    background: linear-gradient(135deg, #0D7377, #14FFEC);
}

/* Global Utilities */
.hidden {
    display: none !important;
}

.modal-content-sm {
    max-width: 600px;
}

/* معاينة الصورة في نموذج إضافة المنتج */
.image-preview-container {
    margin-top: 15px;
    padding: 15px;
    background: var(--glass-bg);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.image-preview {
    width: 100%;
    max-width: 300px;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    object-position: center;
    border-radius: 12px;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background: var(--card-color);
}

/* تحسينات للموبايل */
@media (max-width: 768px) {
    .image-preview-container {
        padding: 12px;
    }

    .image-preview {
        max-width: 100%;
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .image-preview {
        max-height: 200px;
    }
}

.qr-scanner-modal-content {
    position: relative;
}

/* Floating Action Button (FAB) Scanner */
.fab-scanner {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-scanner:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.fab-scanner i {
    font-size: 1.5rem;
}

.fab-scanner span {
    display: none;
}

/* Scaner container is now managed by scanner-frame */

/* Unused scanner styles removed */

/* Floating Navigation Button (Repurposed from Back to Top) */
.floating-nav-btn {
    position: fixed;
    bottom: 25px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(20px);
}

.floating-nav-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.floating-nav-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(255, 107, 53, 0.4);
}

.floating-nav-btn:active {
    transform: scale(0.9);
}

@media (max-width: 768px) {
    .floating-nav-btn {
        bottom: 25px;
        /* رجوعه للأسفل لمنع التداخل مع المحتوى */
        right: 20px;
        width: 56px;
        height: 56px;
    }
}