/* ================= المتغيرات والثيمات الـ 4 للمتجر (يتحكم بها الأدمن) ================= */
        :root, [data-theme="amazon"] {
            --header-bg: #131921;
            --subnav-bg: #232f3e;
            --btn-primary-bg: #ffd814;
            --btn-primary-text: #0F1111;
            --accent-color: #ffa41c;
            --price-color: #B12704;
            --store-bg: #f3f4f6;
            --card-bg: #ffffff;
            --text-main: #111111;
            --card-border: #e5e7eb;
        }
        [data-theme="ocean"] {
            --header-bg: #03045e;
            --subnav-bg: #0077b6;
            --btn-primary-bg: #00b4d8;
            --btn-primary-text: #ffffff;
            --accent-color: #90e0ef;
            --price-color: #023e8a;
            --store-bg: #e0fbfc;
            --card-bg: #ffffff;
            --text-main: #03045e;
            --card-border: #caf0f8;
        }
        [data-theme="royal"] {
            --header-bg: #0a0a0a;
            --subnav-bg: #171717;
            --btn-primary-bg: #d4af37;
            --btn-primary-text: #000000;
            --accent-color: #f3e5ab;
            --price-color: #ffd700;
            --store-bg: #121212;
            --card-bg: #1e1e1e;
            --text-main: #f5f5f5;
            --card-border: #333333;
        }
        [data-theme="modern"] {
            --header-bg: #ff5a1f;
            --subnav-bg: #c81e1e;
            --btn-primary-bg: #ff5a1f;
            --btn-primary-text: #ffffff;
            --accent-color: #fde8e8;
            --price-color: #e02424;
            --store-bg: #fff8f6;
            --card-bg: #ffffff;
            --text-main: #1f2937;
            --card-border: #fbd5d5;
        }

        :root {
            --pos-primary: #023e8a;
            --pos-secondary: #0077b6;
            --success: #25D366;
            --danger: #e63946;
        }

        * { box-sizing: border-box; font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif; margin: 0; padding: 0; }
        html { scroll-behavior: smooth; }
        body { background-color: var(--store-bg); color: var(--text-main); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; transition: background 0.3s, color 0.3s; }

        @keyframes fadeUpCard {
            0% { opacity: 0; transform: translateY(15px); }
            100% { opacity: 1; transform: translateY(0); }
        }
        @keyframes cartPulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.08); }
            100% { transform: scale(1); }
        }
        .animate-card { animation: fadeUpCard 0.3s ease forwards; }
        .pulse-effect { animation: cartPulse 0.35s ease-in-out; }

        /* الشريط العلوي للنظام */
        .system-switcher {
            background: #000; color: #fff; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center;
            font-size: 0.8rem; z-index: 300; border-bottom: 2px solid #ffa41c; flex-wrap: wrap; gap: 8px;
        }
        .sys-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
        .sys-btn {
            background: #222; color: #ddd; border: 1px solid #444; padding: 6px 10px; border-radius: 6px;
            cursor: pointer; font-weight: bold; transition: 0.2s; position: relative; font-size: 0.78rem;
        }
        .sys-btn.active, .sys-btn:hover { background: #ffa41c; color: #000; border-color: #ffa41c; }
        .badge-notify { background: var(--danger); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 50%; position: absolute; top: -5px; left: -5px; }

        .user-status-box { display: flex; align-items: center; gap: 6px; background: #1a1a1a; padding: 4px 8px; border-radius: 6px; border: 1px solid #333; }
        .user-badge { color: #ffd814; font-weight: bold; }

        .view-section { display: none; flex: 1; }
        .view-section.active { display: flex; flex-direction: column; }

        /* ================= 1. الهيدر الثابت للمتجر ================= */
        .store-sticky-top-wrapper { position: sticky; top: 0; z-index: 250; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
        .amz-header {
            background: var(--header-bg); color: white; padding: 10px 15px; display: flex; align-items: center;
            justify-content: space-between; gap: 10px; flex-wrap: wrap;
        }
        .amz-logo { font-size: 1.15rem; font-weight: bold; color: white; display: flex; align-items: center; gap: 8px; }
        .amz-logo img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent-color); }
        .amz-logo span { color: var(--accent-color); }
        
        .amz-search-bar { flex: 1; min-width: 160px; max-width: 550px; display: flex; border-radius: 8px; overflow: hidden; }
        .amz-search-bar input { flex: 1; padding: 8px 12px; border: none; font-size: 0.88rem; outline: none; color: #111; }
        .amz-search-bar button { background: var(--accent-color); color: #000; border: none; padding: 0 12px; cursor: pointer; font-weight: bold; }

        .header-cart-btn {
            background: var(--btn-primary-bg); color: var(--btn-primary-text); border: none; padding: 7px 14px;
            border-radius: 20px; font-weight: bold; font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; gap: 6px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.25);
        }

        .amz-subnav {
            background: var(--subnav-bg); color: white; padding: 9px 15px; display: flex; gap: 8px;
            overflow-x: auto; align-items: center; border-bottom: 2px solid var(--accent-color);
            scrollbar-width: none; scroll-behavior: smooth;
        }
        .amz-subnav::-webkit-scrollbar { display: none; }
        .amz-cat-link {
            color: #fff; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
            padding: 7px 15px; border-radius: 25px; cursor: pointer; font-size: 0.85rem; white-space: nowrap;
            transition: 0.25s; font-weight: 600;
        }
        .amz-cat-link.active, .amz-cat-link:hover {
            border-color: var(--accent-color); background: var(--btn-primary-bg); color: var(--btn-primary-text);
            font-weight: bold; transform: scale(1.04);
        }

        .promo-deals-banner {
            background: linear-gradient(135deg, #023e8a, #0077b6); color: white; padding: 12px 16px;
            margin: 12px 15px 0; border-radius: 12px; display: none; flex-direction: column; gap: 8px;
            box-shadow: 0 4px 12px rgba(0, 119, 182, 0.25); border: 1px solid var(--accent-color);
        }
        .promo-cards-row { display: flex; gap: 8px; flex-wrap: wrap; }
        .promo-offer-chip {
            background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.35); padding: 6px 12px;
            border-radius: 8px; font-size: 0.82rem; font-weight: bold; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 6px;
        }
        .promo-offer-chip:hover { background: var(--btn-primary-bg); color: var(--btn-primary-text); border-color: #fff; }

        .store-main-layout { display: flex; align-items: flex-start; gap: 18px; padding: 15px; max-width: 1450px; margin: 0 auto; width: 100%; flex: 1; padding-bottom: 95px; }
        .store-products-area { flex: 1; width: 100%; }

        .amz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 14px; }
        .amz-card {
            background: var(--card-bg); color: var(--text-main); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column;
            justify-content: space-between; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border: 1px solid var(--card-border);
            position: relative; transition: transform 0.25s ease;
        }
        .amz-card:hover { transform: translateY(-4px); border-color: var(--accent-color); }
        
        .amz-badge { position: absolute; top: 0; right: 0; background: #e47911; color: white; font-size: 0.7rem; font-weight: bold; padding: 4px 9px; border-bottom-left-radius: 10px; z-index: 2; }
        .discount-saving-badge {
            position: absolute; top: 0; left: 0; background: #e63946; color: white; font-size: 0.72rem;
            font-weight: bold; padding: 4px 9px; border-bottom-right-radius: 10px; z-index: 2;
        }

        .amz-img-wrap { width: 100%; height: 140px; background: #f8f8f8; overflow: hidden; }
        .amz-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
        .amz-card-body { padding: 12px; display: flex; flex-direction: column; flex: 1; justify-content: space-between; }
        .amz-title { font-size: 0.92rem; font-weight: bold; margin-bottom: 5px; }
        .amz-price { font-size: 1.2rem; font-weight: bold; color: var(--price-color); }
        .old-price-strike { font-size: 0.82rem; color: #888; text-decoration: line-through; margin-right: 5px; }
        
        .amz-btn-add {
            background: var(--btn-primary-bg); border: 1px solid rgba(0,0,0,0.1); color: var(--btn-primary-text);
            width: 100%; padding: 8px; border-radius: 8px; font-weight: bold; cursor: pointer; margin-top: 8px; font-size: 0.84rem;
        }

        /* السلة الثابتة */
        .store-sticky-cart {
            width: 365px; background: #ffffff; color: #111; border-radius: 12px; border: 2px solid #e5e7eb; padding: 15px;
            position: sticky; top: 125px; max-height: calc(100vh - 140px); display: flex; flex-direction: column;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1); z-index: 100;
        }
        .cart-header-title { font-size: 1.05rem; font-weight: bold; color: #131921; padding-bottom: 8px; border-bottom: 2px solid #f1f1f1; display: flex; justify-content: space-between; align-items: center; }
        .cart-items-scroll { flex: 1; overflow-y: auto; max-height: 185px; margin: 6px 0; }
        .simple-cart-item { display: flex; justify-content: space-between; align-items: center; padding: 7px 4px; border-bottom: 1px dashed #eee; font-size: 0.84rem; }
        
        .smart-reward-progress {
            background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; padding: 8px 10px;
            border-radius: 8px; font-size: 0.78rem; font-weight: bold; margin-bottom: 8px; display: none;
        }

        .coupon-box { display: none; gap: 6px; margin-bottom: 8px; }
        .coupon-box input { flex: 1; padding: 7px 10px; border: 1px dashed var(--pos-secondary); border-radius: 6px; font-size: 0.8rem; font-weight: bold; text-transform: uppercase; }
        .btn-apply-coupon { background: var(--pos-secondary); color: white; border: none; padding: 0 12px; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 0.78rem; }

        .btn-whatsapp-order { background: #25D366; color: white; border: none; width: 100%; padding: 12px; border-radius: 8px; font-size: 0.95rem; font-weight: bold; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 6px; }

        .mobile-cart-bar {
            display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #131921; color: white;
            padding: 12px 16px; z-index: 9000; justify-content: space-between; align-items: center;
            border-top: 3px solid #ffa41c; box-shadow: 0 -5px 20px rgba(0,0,0,0.4); cursor: pointer;
        }

        /* ================= 2. الكاشير والداشبورد ================= */
        #posView, #dashView { background: #f3f4f6; color: #111; }
        .pos-layout { display: flex; flex: 1; gap: 15px; padding: 15px; max-width: 1500px; margin: 0 auto; width: 100%; align-items: flex-start; }
        .main-area { flex: 1; width: 100%; }
        .side-panel { width: 420px; background: white; border-radius: 12px; border: 1px solid #ddd; padding: 15px; position: sticky; top: 15px; }

        .categories { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; position: sticky; top: 0; background: #f3f4f6; padding: 10px 4px; z-index: 50; scrollbar-width: none; }
        .cat-btn { flex: 1; min-width: 105px; padding: 9px 14px; border: none; background: white; color: var(--pos-primary); font-weight: bold; border-radius: 20px; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.06); white-space: nowrap; }
        .cat-btn.active { background: var(--pos-secondary); color: white; }

        .pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
        .pos-card { background: white; border-radius: 10px; padding: 8px; text-align: center; cursor: pointer; border: 2px solid transparent; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
        .pos-card:hover { border-color: var(--pos-secondary); }
        .pos-card img { width: 100%; height: 75px; object-fit: cover; border-radius: 6px; margin-bottom: 5px; }

        .invoice-box { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 12px; margin-bottom: 10px; }
        .inv-header { text-align: center; border-bottom: 2px dashed #ccc; padding-bottom: 8px; margin-bottom: 8px; }
        .inv-header img { width: 55px; height: 55px; object-fit: cover; border-radius: 50%; }
        .inv-header h3 { color: var(--pos-primary); font-size: 1.1rem; }
        .inv-header p { font-size: 0.75rem; color: #555; }
        .inv-meta { font-size: 0.78rem; background: #f8f9fa; padding: 8px; border-radius: 6px; margin-bottom: 8px; line-height: 1.6; }

        .data-table { width: 100%; border-collapse: collapse; }
        .data-table th { background: #f1f3f5; padding: 8px; text-align: right; font-size: 0.78rem; color: #333; border-bottom: 2px solid #ddd; }
        .data-table td { padding: 8px; border-bottom: 1px solid #eee; font-size: 0.82rem; }
        .item-details { font-size: 0.7rem; color: #666; display: block; }

        .btn { padding: 8px 12px; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; color: white; font-size: 0.82rem; transition: 0.2s; }
        .btn-success { background: #2a9d8f; }
        .btn-primary { background: var(--pos-primary); }
        .btn-danger { background: var(--danger); }
        .btn-warning { background: #f4a261; color: #111; }
        .btn-sm { padding: 4px 8px; font-size: 0.72rem; }

        .form-control { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 6px; margin-bottom: 6px; font-size: 0.85rem; }
        .summary { background: #f8f9fa; padding: 10px; border-radius: 8px; margin-top: 6px; }
        .summary-row { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 0.82rem; }
        .summary-total { font-size: 1.05rem; font-weight: bold; color: #B12704; border-top: 2px dashed #ccc; padding-top: 5px; margin-top: 4px; }

        .dashboard-container { flex: 1; padding: 15px; max-width: 1400px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 15px; }
        .dash-subtabs { display: flex; gap: 8px; border-bottom: 2px solid #ddd; padding-bottom: 10px; flex-wrap: wrap; }
        .dash-tab-btn { padding: 8px 14px; border: none; background: white; border-radius: 8px; cursor: pointer; font-weight: bold; color: var(--pos-primary); font-size: 0.85rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
        .dash-tab-btn.active { background: var(--pos-primary); color: white; }

        .dash-panel { display: none; flex-direction: column; gap: 15px; }
        .dash-panel.active { display: flex; }

        .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
        .stat-card { background: white; padding: 15px; border-radius: 10px; border-right: 5px solid var(--pos-secondary); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
        .dash-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 15px; }
        .card-box { background: white; padding: 15px; border-radius: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); overflow-x: auto; }

        .perm-checkbox-group { display: flex; flex-direction: column; gap: 8px; background: #f8fafc; padding: 12px; border-radius: 8px; border: 1px solid #e2e8f0; margin: 8px 0 12px; }
        .perm-label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer; }
        .perm-tag { display: inline-block; background: #e0f2fe; color: #0369a1; padding: 2px 7px; border-radius: 6px; font-size: 0.72rem; margin: 2px; font-weight: bold; }

        .admin-theme-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
        .admin-theme-card {
            border: 2px solid #ddd; border-radius: 10px; padding: 10px; text-align: center; cursor: pointer; transition: 0.2s; font-weight: bold; font-size: 0.82rem;
        }
        .admin-theme-card.active-theme { border-color: var(--pos-primary); box-shadow: 0 0 0 3px rgba(2, 62, 138, 0.2); transform: translateY(-2px); }
        .color-swatch-row { display: flex; height: 22px; border-radius: 6px; overflow: hidden; margin-bottom: 6px; }
        .color-swatch-row span { flex: 1; }

        /* المودال */
        .modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.65); justify-content: center; align-items: center; z-index: 9500; padding: 15px; }
        .modal-content { background: white; color: #111; padding: 22px; border-radius: 12px; width: 400px; max-width: 100%; }
        .quick-weights { display: flex; gap: 6px; margin: 8px 0 12px; flex-wrap: wrap; }
        .qw-btn { flex: 1; padding: 6px; background: #f0f8ff; border: 1px solid var(--pos-secondary); border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 0.78rem; }

        .online-orders-bar { background: #fff3cd; border: 1px solid #ffeeba; padding: 10px; border-radius: 8px; margin-bottom: 12px; }
        .online-order-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dashed #ccc; font-size: 0.8rem; flex-wrap: wrap; gap: 6px; }

        /* التجاوب الكامل للموبايل */
        @media (max-width: 950px) {
            .store-main-layout { flex-direction: column; padding-bottom: 90px; }
            .store-sticky-cart {
                display: none !important;
                position: fixed !important;
                top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
                width: 100% !important; height: 100vh !important; max-height: 100vh !important;
                z-index: 9200 !important; border-radius: 0 !important; overflow-y: auto !important;
                padding: 18px !important;
            }
            .store-sticky-cart.mobile-open { display: flex !important; }
            .mobile-cart-bar { display: flex !important; }
            .close-mobile-cart { display: inline-block !important; }
            .pos-layout { flex-direction: column; }
            .side-panel { width: 100%; position: static; }
            .dash-grid { grid-template-columns: 1fr; }
            .amz-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
        }

        @media print {
            body * { visibility: hidden; }
            body.printing-menu #autoMenuBoard, body.printing-menu #autoMenuBoard * { visibility: visible; }
            body.printing-menu #autoMenuBoard { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; margin: 0; }
            
            body:not(.printing-menu) #invoicePrintable, body:not(.printing-menu) #invoicePrintable * { visibility: visible; }
            body:not(.printing-menu) #invoicePrintable { position: absolute; left: 0; top: 0; width: 100%; border: none; box-shadow: none; }
            .no-print { display: none !important; }
        }

/* ================= إضافات نظام الـ SaaS والنسخة التجريبية والروابط المنفصلة ================= */
.demo-banner-top {
    background: linear-gradient(90deg, #b91c1c, #ea580c, #b91c1c);
    color: #fff;
    padding: 9px 15px;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 800;
    display: none;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    z-index: 400;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.demo-banner-top a {
    background: #ffd814;
    color: #000;
    padding: 4px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 900;
    font-size: 0.82rem;
    transition: 0.2s;
}
.demo-banner-top a:hover {
    transform: scale(1.05);
    background: #fff;
}

.sub-status-pill {
    background: #065f46;
    color: #a7f3d0;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: bold;
    border: 1px solid #10b981;
}
.sub-status-pill.warning {
    background: #92400e;
    color: #fde68a;
    border-color: #f59e0b;
}

.store-share-bar {
    background: #eff6ff;
    border: 2px dashed #3b82f6;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}
.store-share-input {
    flex: 1;
    min-width: 240px;
    padding: 8px 12px;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    background: #fff;
    color: #1e3a8a;
    font-weight: bold;
    font-size: 0.85rem;
    direction: ltr;
    text-align: left;
}

.expired-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 25, 0.96);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    color: #fff;
}
.expired-card {
    background: #1e293b;
    border: 3px solid #ef4444;
    border-radius: 18px;
    padding: 35px 25px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}
