:root {
    --primary: #a855f7;
    --primary-dark: #7c3aed;
    --primary-rgb: 168, 85, 247;
    --primary-dark-rgb: 124, 58, 237;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: #060212;
    color: #f8fafc;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

.neon-purple { color: var(--primary); text-shadow: 0 0 15px rgba(var(--primary-rgb), 0.6); }
.glass-nav { background: rgba(6, 2, 18, 0.9); backdrop-filter: blur(15px); border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.section-card { background: linear-gradient(145deg, #0f0720, #080415); border: 1px solid rgba(var(--primary-rgb), 0.1); transition: all 0.4s ease; }
.section-card:hover { transform: translateY(-10px); border-color: var(--primary); box-shadow: 0 10px 40px rgba(var(--primary-rgb), 0.2); }
.btn-primary { background: linear-gradient(90deg, var(--primary-dark), var(--primary)); box-shadow: 0 5px 20px rgba(var(--primary-dark-rgb), 0.3); transition: all 0.3s; }
.btn-primary:hover { transform: scale(1.05); box-shadow: 0 5px 30px rgba(var(--primary-dark-rgb), 0.5); }
.btn-primary:disabled { opacity: 0.6; transform: none; cursor: not-allowed; }
.badge-verified { background: rgba(var(--primary-rgb), 0.1); border: 1px solid rgba(var(--primary-rgb), 0.3); color: var(--primary); }

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.profile-circle { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: bold; cursor: pointer; border: 2px solid rgba(255,255,255,0.1); position: relative; overflow: hidden; flex-shrink: 0; }

#profile-menu, #currency-menu { opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all 0.2s ease; }
#profile-menu.open, #currency-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.currency-option.active-currency { background: rgba(var(--primary-rgb), 0.12); color: var(--primary); }

/* ============ CART PAGE ============ */
.cart-grid { display: grid; grid-template-columns: 400px 1fr; gap: 24px; align-items: start; }
@media (max-width: 1000px) { .cart-grid { grid-template-columns: 1fr; } }

.cart-summary { background: #0d0221; border: 1px solid rgba(var(--primary-rgb), 0.25); border-radius: 14px; padding: 22px; position: sticky; top: 100px; }
@media (max-width: 1000px) { .cart-summary { position: static; } }

.cart-products { display: flex; flex-direction: column; gap: 14px; }

.cart-item { background: #0d0221; border: 1px solid rgba(var(--primary-rgb), 0.2); border-radius: 14px; padding: 16px; display: flex; gap: 16px; align-items: stretch; transition: border-color 0.2s; }
.cart-item:hover { border-color: rgba(var(--primary-rgb), 0.5); }
.cart-item-img { width: 110px; height: 140px; flex-shrink: 0; background: linear-gradient(160deg, #2a1145, #060212); border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cart-item-img img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 4px; }
.cart-item-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cart-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cart-item-title { color: #fff; font-weight: 700; font-size: 0.95rem; line-height: 1.4; flex: 1; }
.badge-dept { padding: 4px 12px; border-radius: 6px; font-size: 0.65rem; font-weight: 800; background: linear-gradient(90deg, var(--primary-dark), var(--primary)); color: #fff; text-transform: uppercase; white-space: nowrap; flex-shrink: 0; }
.cart-item-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-global { padding: 3px 10px; border-radius: 4px; font-size: 0.68rem; font-weight: 800; background: rgba(96, 165, 250, 0.12); color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.35); }
.badge-cashback { padding: 3px 10px; border-radius: 4px; font-size: 0.68rem; font-weight: 800; background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.35); }
.cart-item-note { font-size: 0.75rem; color: #94a3b8; }
.cart-item-note strong { color: var(--primary); font-weight: 800; }
.cart-item-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; margin-top: auto; border-top: 1px solid rgba(255,255,255,0.06); }
.cart-actions { display: flex; align-items: center; gap: 10px; }
.cart-trash-btn { width: 38px; height: 38px; border-radius: 8px; background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #ef4444; cursor: pointer; transition: all 0.2s; display: grid; place-items: center; }
.cart-trash-btn:hover { background: #ef4444; color: #fff; }
.qty-controls { display: flex; align-items: center; background: #060212; border: 1px solid rgba(var(--primary-rgb), 0.25); border-radius: 8px; overflow: hidden; height: 38px; }
.qty-btn { width: 38px; height: 100%; border: 0; background: transparent; color: #cbd5e1; cursor: pointer; font-size: 1.05rem; font-weight: 800; transition: all 0.15s; display: grid; place-items: center; }
.qty-btn:hover:not(:disabled) { background: rgba(var(--primary-rgb), 0.15); color: var(--primary); }
.qty-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.qty-value { min-width: 46px; text-align: center; color: #fff; font-weight: 800; font-size: 1rem; padding: 0 6px; border-inline-start: 1px solid rgba(var(--primary-rgb), 0.2); border-inline-end: 1px solid rgba(var(--primary-rgb), 0.2); }
.cart-item-price { font-size: 1.2rem; font-weight: 900; color: #fff; white-space: nowrap; }
.cart-item-price small { display: block; font-size: 0.65rem; color: #94a3b8; font-weight: 400; text-align: end; }

.sum-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 0.9rem; color: #cbd5e1; }
.sum-total { font-size: 1.15rem; font-weight: 900; color: #fff; padding: 14px 0; border-top: 1px solid rgba(var(--primary-rgb), 0.3); margin-top: 6px; display: flex; justify-content: space-between; }
.sum-total span:last-child { color: var(--primary); }

.powered-by { text-align: center; font-size: 0.7rem; color: #94a3b8; margin-top: 12px; font-style: italic; }
.powered-by span { color: #003087; font-weight: 900; font-style: normal; }

.cart-empty { text-align: center; padding: 60px 20px; color: #94a3b8; }
.cart-empty i { font-size: 4rem; opacity: 0.3; margin-bottom: 16px; }

/* ============ SETTINGS ============ */
.settings-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.settings-sidebar { background: #0d0221; border: 1px solid rgba(var(--primary-rgb), 0.2); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 100px; }
.settings-group-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; background: transparent; border: 0; border-radius: 6px; color: #cbd5e1; font-size: 0.9rem; font-weight: 700; cursor: pointer; text-align: start; }
.settings-group-btn:hover { background: rgba(var(--primary-rgb), 0.08); color: var(--primary); }
.settings-group-btn i:first-child { width: 20px; text-align: center; color: var(--primary); }
.settings-group-btn i:last-child { margin-inline-start: auto; font-size: 0.7rem; opacity: 0.6; }
.settings-group-btn.collapsed i:last-child { transform: rotate(-90deg); }
.settings-group-items { display: flex; flex-direction: column; gap: 2px; padding-inline-start: 12px; margin-top: 2px; overflow: hidden; max-height: 400px; transition: max-height 0.25s ease; }
.settings-group-items.hidden { max-height: 0; }
.settings-item { display: block; width: 100%; padding: 10px 14px; background: transparent; border: 0; border-inline-end: 2px solid transparent; color: #94a3b8; font-size: 0.85rem; font-weight: 600; cursor: pointer; text-align: start; border-radius: 4px; }
.settings-item:hover { color: #fff; background: rgba(var(--primary-rgb), 0.05); }
.settings-item.active { color: var(--primary); background: rgba(var(--primary-rgb), 0.1); border-inline-end-color: var(--primary); }
.settings-content { background: #0d0221; border: 1px solid rgba(var(--primary-rgb), 0.2); border-radius: 10px; padding: 26px; min-height: 500px; }
.settings-panel.hidden { display: none; }
.settings-title { font-size: 1.4rem; font-weight: 800; color: #fff; margin: 0 0 6px; }
.settings-subtitle { font-size: 0.85rem; color: #94a3b8; margin: 0 0 24px; }
.settings-field { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid rgba(var(--primary-rgb), 0.12); }
.settings-field:last-child { border-bottom: 0; }
.settings-field-label { font-size: 0.85rem; color: #94a3b8; margin-bottom: 6px; }
.settings-input { background: #060212; border: 1px solid rgba(var(--primary-rgb), 0.25); border-radius: 6px; padding: 10px 14px; color: #f8fafc; font-size: 0.9rem; width: 100%; max-width: 320px; outline: none; }
.settings-input:focus { border-color: var(--primary); }
.settings-btn { background: rgba(var(--primary-rgb), 0.1); border: 1px solid rgba(var(--primary-rgb), 0.3); color: var(--primary); padding: 8px 18px; border-radius: 6px; font-size: 0.82rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.settings-btn:hover { background: var(--primary); color: #fff; }
.settings-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.68rem; font-weight: 800; background: rgba(34, 197, 94, 0.12); border: 1px solid rgba(34, 197, 94, 0.4); color: #22c55e; margin-inline-start: 8px; white-space: nowrap; }

/* ============ Avatar Upload ============ */
.avatar-wrapper {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid var(--primary);
    background: #060212;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.3);
    flex-shrink: 0;
}
.avatar-wrapper:hover { transform: scale(1.05); box-shadow: 0 0 25px rgba(var(--primary-rgb), 0.6); }
.avatar-wrapper img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; color: white; font-size: 1.5rem; opacity: 0; transition: opacity 0.3s ease; }
.avatar-wrapper:hover .avatar-overlay { opacity: 1; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 20px; }
.theme-card { background: #0a031a; border: 2px solid rgba(var(--primary-rgb), 0.2); border-radius: 10px; padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 12px; position: relative; }
.theme-card:hover { border-color: rgba(var(--primary-rgb), 0.6); }
.theme-card.active { border-color: var(--primary); box-shadow: 0 0 25px rgba(var(--primary-rgb), 0.3); }
.theme-card.active::after { content: '✓'; position: absolute; top: 10px; left: 10px; width: 22px; height: 22px; background: var(--primary); color: #fff; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.theme-preview { display: flex; gap: 8px; height: 60px; border-radius: 6px; overflow: hidden; }
.theme-preview .swatch { flex: 1; }
.theme-name { font-size: 0.82rem; font-weight: 700; color: #e2e8f0; text-align: center; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-top: 20px; }
.lang-card { background: #0a031a; border: 2px solid rgba(var(--primary-rgb), 0.2); border-radius: 10px; padding: 20px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative; }
.lang-card:hover { border-color: rgba(var(--primary-rgb), 0.6); }
.lang-card.active { border-color: var(--primary); box-shadow: 0 0 25px rgba(var(--primary-rgb), 0.3); }
.lang-card.active::after { content: '✓'; position: absolute; top: 10px; left: 10px; width: 22px; height: 22px; background: var(--primary); color: #fff; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.lang-flag { font-size: 2.5rem; line-height: 1; }
.lang-name { font-size: 0.95rem; font-weight: 700; color: #e2e8f0; }
.lang-native { font-size: 0.75rem; color: #94a3b8; }

/* ============ ADMIN ============ */
.admin-tab { padding: 10px 18px; border-radius: 8px; background: transparent; color: #94a3b8; font-size: 0.85rem; font-weight: 700; cursor: pointer; border: 1px solid transparent; display: flex; align-items: center; gap: 6px; }
.admin-tab:hover { color: #fff; background: rgba(var(--primary-rgb), 0.08); }
.admin-tab.active { color: #fff; background: rgba(var(--primary-rgb), 0.15); border-color: rgba(var(--primary-rgb), 0.4); }
.admin-item { background: #0d0221; border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-item:hover { border-color: rgba(var(--primary-rgb), 0.4); }
.admin-item .name { font-weight: 700; color: #fff; }
.admin-item .meta { font-size: 0.8rem; color: #94a3b8; margin-top: 4px; }
.admin-btn { padding: 6px 14px; border-radius: 6px; font-size: 0.78rem; font-weight: 700; cursor: pointer; border: 0; white-space: nowrap; }
.admin-btn-primary { background: rgba(var(--primary-rgb), 0.15); color: var(--primary); border: 1px solid rgba(var(--primary-rgb), 0.4); }
.admin-btn-primary:hover { background: var(--primary); color: #fff; }
.admin-btn-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.4); }
.admin-btn-danger:hover { background: #ef4444; color: #fff; }
.admin-btn-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.4); }
.admin-btn-warning:hover { background: #f59e0b; color: #fff; }

.badge-status { padding: 3px 10px; border-radius: 6px; font-size: 0.7rem; font-weight: 800; }
.badge-paid { background: rgba(34, 197, 94, 0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.4); }
.badge-pending { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.4); }
.badge-failed { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.4); }
.code-box { font-family: monospace; background: #060212; padding: 4px 10px; border-radius: 4px; color: var(--primary); font-size: 0.8rem; border: 1px solid rgba(var(--primary-rgb), 0.3); word-break: break-all; }

#product-modal.open, #codes-modal.open { display: flex; }
.pf-preview { width: 100%; height: 140px; background: #060212; border: 1px dashed rgba(var(--primary-rgb), 0.3); border-radius: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pf-preview img { width: 100%; height: 100%; object-fit: contain; }
.pf-preview .placeholder { color: #475569; font-size: 0.7rem; }

/* ============ Card Fields ============ */
.card-field-container { height: 44px; margin-bottom: 8px; border: 1px solid rgba(var(--primary-rgb), 0.25); border-radius: 8px; background: #060212; overflow: hidden; padding: 0 4px; }
#card-pay-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.payment-section { margin-bottom: 12px; }

/* ============ Out of Stock ============ */
.btn-out-of-stock { background: rgba(239, 68, 68, 0.15) !important; color: #ef4444 !important; border: 1px solid rgba(239, 68, 68, 0.5) !important; cursor: not-allowed !important; opacity: 1 !important; font-weight: 800 !important; }
.btn-out-of-stock:hover { transform: none !important; box-shadow: none !important; }
.badge-out-of-stock { padding: 3px 10px; border-radius: 4px; font-size: 0.68rem; font-weight: 800; background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.4); }
.pd-add-btn-disabled { opacity: 0.3 !important; cursor: not-allowed !important; pointer-events: none; }

/* ============ Custom Select Dropdowns ============ */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a855f7' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 14px center;
    background-size: 16px;
    padding: 12px 16px 12px 44px !important;
    background-color: #0d0221 !important;
    color: #f8fafc !important;
    border: 1px solid rgba(var(--primary-rgb), 0.25) !important;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    color-scheme: dark;
    transition: border-color 0.2s, box-shadow 0.2s;
}
select:hover { border-color: rgba(var(--primary-rgb), 0.5) !important; }
select:focus { border-color: var(--primary) !important; outline: none; box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15); }
select option { background-color: #0d0221 !important; color: #f8fafc !important; padding: 12px 14px; font-weight: 600; font-size: 0.9rem; }
select option:checked { background-color: var(--primary-dark) !important; color: #ffffff !important; background-image: linear-gradient(var(--primary-dark), var(--primary-dark)); }
[dir="rtl"] select { background-position: left 14px center; padding: 12px 16px 12px 44px !important; }
[dir="ltr"] select { background-position: right 14px center; padding: 12px 44px 12px 16px !important; }
#pf-department, #pf-delivery-type { min-height: 48px; line-height: 1.4; }

/* =========================================================
   ✅ RESPONSIVE — تحسينات الجوال والحاسوب
   ========================================================= */

/* ===== الشاشات الكبيرة (تلفزيونات وشاشات عريضة) ===== */
@media (min-width: 1440px) {
    .container { max-width: 1400px; }
}

/* ===== الأجهزة اللوحية (Tablets) ===== */
@media (max-width: 1024px) {
    .settings-layout { grid-template-columns: 1fr; }
    .settings-sidebar { position: static; }
    .settings-content { min-height: auto; }
}

/* ===== الجوال (Mobile) ===== */
@media (max-width: 768px) {

    /* --- Navbar --- */
    nav.glass-nav { padding-top: 10px !important; padding-bottom: 10px !important; }
    nav .container { padding-left: 12px !important; padding-right: 12px !important; }
    nav .text-3xl { font-size: 1.25rem !important; }
    nav .container > div { gap: 8px !important; }
    #search-input { width: 120px !important; padding-left: 30px !important; padding-right: 12px !important; font-size: 11px !important; }
    #currency-menu { left: auto !important; right: 0 !important; }
    #profile-menu { left: auto !important; right: 0 !important; }

    /* --- Home Hero --- */
    #home-page header { padding-top: 120px !important; padding-bottom: 40px !important; }
    #home-page h1 { font-size: 2.5rem !important; line-height: 1.2 !important; }
    #home-page p.text-xl { font-size: 1rem !important; }
    #home-page .btn-primary { padding: 14px 30px !important; font-size: 1rem !important; }

    /* --- Features Grid --- */
    #home-page section.py-10.bg-white\/5 .grid { gap: 16px !important; }
    #home-page section.py-10.bg-white\/5 .text-sm { font-size: 0.75rem !important; }

    /* --- Section Titles --- */
    section h2.text-2xl, section h2.text-3xl { font-size: 1.25rem !important; }

    /* --- Product Cards (Home) --- */
    #recent-products, #recommended-products { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    #recent-products .text-xs, #recommended-products .text-xs { font-size: 0.7rem !important; }

    /* --- Product Grid (Shop) --- */
    #products-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
    #products-grid .section-card { padding: 16px !important; }
    #products-grid img { max-height: 180px !important; }

    /* --- Product Detail Page --- */
    #product-page { padding-left: 12px !important; padding-right: 12px !important; }
    #product-page .grid.grid-cols-1.lg\:grid-cols-3 { grid-template-columns: 1fr !important; }
    #product-page h1 { font-size: 1.4rem !important; }
    #pd-image { max-height: 220px !important; }
    #product-page aside .sticky { position: static !important; }

    /* --- Cart Page --- */
    #cart-page { padding-left: 12px !important; padding-right: 12px !important; }
    #cart-page h1 { font-size: 1.5rem !important; }
    .cart-item { padding: 12px !important; gap: 10px !important; }
    .cart-item-img { width: 80px !important; height: 100px !important; }
    .cart-item-title { font-size: 0.82rem !important; }
    .cart-item-price { font-size: 1rem !important; }
    .cart-item-bottom { flex-wrap: wrap !important; gap: 8px !important; }
    .cart-actions { width: 100%; justify-content: space-between !important; }
    .cart-trash-btn { width: 34px !important; height: 34px !important; }
    .qty-btn { width: 34px !important; }
    .qty-value { min-width: 40px !important; font-size: 0.9rem !important; }
    .cart-summary { padding: 16px !important; }

    /* --- Settings --- */
    #settings-page { padding-left: 12px !important; padding-right: 12px !important; }
    #settings-page h1 { font-size: 1.5rem !important; }
    .settings-content { padding: 16px !important; }
    .settings-field { flex-direction: column !important; align-items: flex-start !important; gap: 10px !important; }
    .settings-input { max-width: 100% !important; }
    .settings-btn { width: 100% !important; padding: 10px !important; }
    .avatar-wrapper { width: 80px !important; height: 80px !important; }

    /* --- My Orders --- */
    #my-orders-page { padding-left: 12px !important; padding-right: 12px !important; }
    #my-orders-page h1 { font-size: 1.5rem !important; }
    #my-orders-list .flex.justify-between { flex-direction: column !important; align-items: flex-start !important; gap: 8px !important; }

    /* --- Login / Register / Reset --- */
    #login-page, #register-page, #reset-password-page, #verify-page { padding-left: 12px !important; padding-right: 12px !important; padding-top: 120px !important; }
    #login-page .section-card, #register-page .section-card,
    #reset-password-page .section-card, #verify-page .section-card { padding: 20px !important; border-radius: 1.5rem !important; }
    #login-page h2, #register-page h2, #reset-password-page h2, #verify-page h2 { font-size: 1.5rem !important; }
    #login-page input, #register-page input, #reset-password-page input, #verify-page input { padding: 12px !important; font-size: 0.9rem !important; }

    /* --- Admin --- */
    #admin-page .container { padding-left: 12px !important; padding-right: 12px !important; }
    #admin-login-box { padding: 20px !important; margin-top: 40px !important; }
    #admin-dashboard h1 { font-size: 1.4rem !important; }
    .admin-tab { padding: 8px 12px !important; font-size: 0.75rem !important; }
    .admin-tab span { display: none !important; } /* إخفاء النص وإظهار الأيقونة فقط */
    .admin-tab i { font-size: 1rem !important; margin: 0 !important; }
    .admin-item { flex-direction: column !important; align-items: stretch !important; padding: 12px !important; }
    .admin-item .flex.gap-2 { width: 100% !important; }
    .admin-item .admin-btn { flex: 1 !important; }
    #admin-tab-stats .grid.grid-cols-2.md\:grid-cols-4 { grid-template-columns: repeat(2, 1fr) !important; }
    #admin-tab-stats .text-2xl { font-size: 1.1rem !important; }

    /* --- Modals --- */
    #product-modal > div, #codes-modal > div { padding: 16px !important; margin: 8px !important; border-radius: 14px !important; }
    #product-modal h3, #codes-modal h3 { font-size: 1.1rem !important; }
    #product-modal .pf-preview { height: 100px !important; }

    /* --- Footer --- */
    footer { padding: 30px 16px !important; }
    footer .text-3xl { font-size: 1.5rem !important; }
    footer p { font-size: 0.75rem !important; }
    footer span { font-size: 0.65rem !important; }

    /* --- Search Page --- */
    #search-page { padding-left: 12px !important; padding-right: 12px !important; }
    #search-page h1 { font-size: 1.5rem !important; }
    #search-results-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }

    /* --- Theme & Lang Cards --- */
    .theme-grid, .lang-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    .theme-card, .lang-card { padding: 10px !important; }
    .theme-preview { height: 40px !important; }
    .theme-name, .lang-name { font-size: 0.72rem !important; }
    .lang-flag { font-size: 1.8rem !important; }
}

/* ===== الجوالات الصغيرة جداً (<= 400px) ===== */
@media (max-width: 400px) {
    #home-page h1 { font-size: 2rem !important; }
    #recent-products, #recommended-products { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
    #search-results-grid { grid-template-columns: 1fr !important; }
    .cart-item-img { width: 70px !important; height: 90px !important; }
    .cart-item-title { font-size: 0.75rem !important; }
    .admin-tab { padding: 6px 10px !important; }
}

/* ===== منع التحديد العشوائي على الجوال مع السماح بالنسخ في الحقول ===== */
* {
    -webkit-tap-highlight-color: transparent;
}
input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* ===== تحسين اللمس للأزرار على الجوال ===== */
@media (hover: none) and (pointer: coarse) {
    .btn-primary:hover { transform: none !important; }
    .section-card:hover { transform: none !important; }
    button, .cart-trash-btn, .qty-btn, .admin-btn { min-height: 40px; }
    .profile-circle { width: 38px !important; height: 38px !important; }
}

/* ===== تحسين الأداء على الشاشات الصغيرة (تقليل الظلال) ===== */
@media (max-width: 768px) {
    .glass-nav { backdrop-filter: blur(10px); }
    .section-card:hover { box-shadow: none !important; }
    .btn-primary { box-shadow: 0 3px 12px rgba(var(--primary-dark-rgb), 0.3) !important; }
}