:root {
    --ms-primary: #4f46e5;
    --ms-primary-dark: #4338ca;
    --ms-accent: #0ea5e9;
    --ms-dark: #0f172a;
    --ms-muted: #64748b;
    --ms-bg: #f8fafc;
    --ms-card: #ffffff;
    --ms-border: #e2e8f0;
    --ms-radius: 14px;
    --ms-shadow: 0 4px 24px rgba(15, 23, 42, .06);
    --ms-shadow-lg: 0 12px 40px rgba(15, 23, 42, .12);
    --bs-primary: var(--ms-primary);
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: var(--ms-primary);
    --bs-body-font-family: 'Cairo', 'Inter', system-ui, sans-serif;
}

html[dir="ltr"] body { font-family: 'Inter', 'Cairo', system-ui, sans-serif; }
html[dir="rtl"] body { font-family: 'Cairo', 'Inter', system-ui, sans-serif; }

body { background: var(--ms-bg); color: var(--ms-dark); }
a { text-decoration: none; }
main { min-height: 60vh; }

.btn-primary { background: var(--ms-primary); border-color: var(--ms-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--ms-primary-dark); border-color: var(--ms-primary-dark); }
.btn-outline-primary { color: var(--ms-primary); border-color: var(--ms-primary); }
.btn-outline-primary:hover { background: var(--ms-primary); border-color: var(--ms-primary); }
.text-primary { color: var(--ms-primary) !important; }
.bg-primary { background: var(--ms-primary) !important; }
.form-control:focus, .form-select:focus { border-color: var(--ms-primary); box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15); }

/* Top bar & header */
.topbar { background: var(--ms-dark); color: #cbd5e1; padding: 6px 0; }
.topbar a { color: #cbd5e1; }
.topbar a:hover { color: #fff; }
.lang-switch { padding: 2px 10px; border: 1px solid #334155; border-radius: 20px; }
.site-header { background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--ms-border); }
.navbar-brand .brand-text { font-weight: 800; font-size: 1.25rem; color: var(--ms-dark); }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--ms-primary), var(--ms-accent)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.brand-logo { height: 42px; width: auto; }
.navbar .nav-link { color: #334155; font-weight: 600; padding: .5rem .9rem; border-radius: 8px; }
.navbar .nav-link:hover, .navbar .nav-link.active { color: var(--ms-primary); background: #eef2ff; }
.search-form { position: relative; min-width: 240px; }
.search-form .form-control { border-radius: 30px; padding-inline-end: 44px; background: #f1f5f9; border-color: transparent; }
.search-form .btn { position: absolute; top: 0; bottom: 0; inset-inline-end: 4px; color: var(--ms-muted); }
.cart-link { position: relative; font-size: 1.25rem; }
.cart-badge { position: absolute; top: 0; inset-inline-end: 0; background: #ef4444; color: #fff; font-size: .65rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }

/* Hero */
.hero { position: relative; overflow: hidden; background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #0c4a6e 100%); color: #fff; padding: 96px 0; }
.hero::before { content: ""; position: absolute; width: 600px; height: 600px; border-radius: 50%; background: radial-gradient(circle, rgba(14, 165, 233, .35), transparent 70%); top: -200px; inset-inline-end: -150px; }
.hero::after { content: ""; position: absolute; width: 400px; height: 400px; border-radius: 50%; background: radial-gradient(circle, rgba(236, 72, 153, .25), transparent 70%); bottom: -150px; inset-inline-start: -100px; }
.hero .container { position: relative; z-index: 1; }
.hero h1 { font-weight: 800; font-size: clamp(1.9rem, 4vw, 3.2rem); line-height: 1.2; }
.hero p { font-size: 1.15rem; color: #c7d2fe; }
.hero img { border-radius: 24px; box-shadow: var(--ms-shadow-lg); max-height: 380px; object-fit: cover; width: 100%; }
.btn-hero { padding: .8rem 2rem; border-radius: 40px; font-weight: 700; }

/* Sections */
.section { padding: 72px 0; }
.section-title { font-weight: 800; font-size: 2rem; }
.section-subtitle { color: var(--ms-muted); }
.section-title::after { content: ""; display: block; width: 64px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--ms-primary), var(--ms-accent)); margin: 12px auto 0; }

/* Store cards */
.store-card { display: block; background: var(--ms-card); border-radius: var(--ms-radius); padding: 36px 28px; text-align: center; border: 1px solid var(--ms-border); transition: all .3s ease; color: var(--ms-dark); height: 100%; position: relative; overflow: hidden; }
.store-card:hover { transform: translateY(-8px); box-shadow: var(--ms-shadow-lg); border-color: transparent; }
.store-card .store-icon { width: 84px; height: 84px; border-radius: 24px; display: inline-flex; align-items: center; justify-content: center; font-size: 2.3rem; color: #fff; margin-bottom: 20px; transition: transform .3s; }
.store-card:hover .store-icon { transform: scale(1.08) rotate(-4deg); }
.store-card h4 { font-weight: 800; }
.store-card p { color: var(--ms-muted); min-height: 48px; }
.store-card .store-cta { font-weight: 700; color: var(--ms-primary); }
.store-card img.store-img { width: 100%; height: 160px; object-fit: cover; border-radius: 12px; margin-bottom: 16px; }

/* Product cards */
.product-card { background: var(--ms-card); border-radius: var(--ms-radius); border: 1px solid var(--ms-border); overflow: hidden; display: flex; flex-direction: column; transition: all .25s ease; }
.product-card:hover { box-shadow: var(--ms-shadow-lg); transform: translateY(-4px); }
.product-img { display: block; position: relative; aspect-ratio: 4/3; background: #f1f5f9; overflow: hidden; }
.product-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.product-card:hover .product-img img { transform: scale(1.05); }
.img-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 3rem; color: #cbd5e1; }
.badge-tag { position: absolute; top: 12px; inset-inline-start: 12px; color: #fff; font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.bg-service { background: var(--ms-accent); }
.bg-sale { background: #ef4444; }
.product-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.product-cat { font-size: .75rem; color: var(--ms-muted); text-transform: uppercase; letter-spacing: .5px; }
.product-title { font-weight: 700; margin: 4px 0; }
.product-title a { color: var(--ms-dark); }
.product-title a:hover { color: var(--ms-primary); }
.product-desc { font-size: .85rem; color: var(--ms-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.product-price { font-weight: 800; color: var(--ms-primary); font-size: 1.05rem; }

/* Features */
.feature-box { text-align: center; padding: 28px 16px; background: #fff; border-radius: var(--ms-radius); border: 1px solid var(--ms-border); height: 100%; }
.feature-box i { font-size: 2.2rem; color: var(--ms-primary); background: #eef2ff; width: 72px; height: 72px; border-radius: 20px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.feature-box h6 { font-weight: 700; }
.feature-box p { color: var(--ms-muted); font-size: .9rem; margin: 0; }

/* Store page */
.store-hero { padding: 56px 0; color: #fff; position: relative; overflow: hidden; }
.store-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.35), transparent); }
.store-hero .container { position: relative; z-index: 1; }
.store-hero h1 { font-weight: 800; }
.cat-pill { display: inline-block; padding: 8px 18px; border-radius: 30px; background: #fff; border: 1px solid var(--ms-border); color: var(--ms-dark); font-weight: 600; transition: all .2s; }
.cat-pill:hover, .cat-pill.active { background: var(--ms-primary); color: #fff; border-color: var(--ms-primary); }
.sidebar-card { background: #fff; border-radius: var(--ms-radius); border: 1px solid var(--ms-border); padding: 20px; }
.sidebar-card .list-group-item { border: 0; padding: .6rem .5rem; border-radius: 8px; color: var(--ms-dark); }
.sidebar-card .list-group-item.active, .sidebar-card .list-group-item:hover { background: #eef2ff; color: var(--ms-primary); }

/* Product details */
.product-gallery { background: #fff; border-radius: var(--ms-radius); border: 1px solid var(--ms-border); overflow: hidden; }
.product-gallery .main-img { aspect-ratio: 1; background: #f1f5f9; display: flex; align-items: center; justify-content: center; }
.product-gallery .main-img img { width: 100%; height: 100%; object-fit: contain; }
.product-gallery .thumbs { display: flex; gap: 8px; padding: 12px; flex-wrap: wrap; }
.product-gallery .thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 2px solid transparent; cursor: pointer; }
.product-gallery .thumbs img.active { border-color: var(--ms-primary); }
.price-big { font-size: 2rem; font-weight: 800; color: var(--ms-primary); }
.qty-input { width: 120px; }

/* Cart / checkout */
.card-soft { background: #fff; border-radius: var(--ms-radius); border: 1px solid var(--ms-border); box-shadow: var(--ms-shadow); }
.cart-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: #f1f5f9; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--ms-border); }
.summary-row.total { border: 0; font-size: 1.25rem; font-weight: 800; }
.pay-option { border: 2px solid var(--ms-border); border-radius: 12px; padding: 14px 16px; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: all .2s; background: #fff; }
.pay-option:has(input:checked) { border-color: var(--ms-primary); background: #eef2ff; }
.pay-option i { font-size: 1.5rem; color: var(--ms-primary); }
.step-indicator { display: flex; gap: 8px; align-items: center; color: var(--ms-muted); }
.step-indicator .step { display: flex; align-items: center; gap: 6px; }
.step-indicator .step.active { color: var(--ms-primary); font-weight: 700; }
.step-indicator .num { width: 28px; height: 28px; border-radius: 50%; background: var(--ms-border); display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; }
.step-indicator .step.active .num { background: var(--ms-primary); color: #fff; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 11px; width: 2px; background: var(--ms-border); }
.timeline li { position: relative; padding-inline-start: 36px; padding-bottom: 20px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 4px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--ms-primary); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--ms-primary); }

/* Auth */
.auth-wrapper { min-height: calc(100vh - 220px); display: flex; align-items: center; padding: 48px 16px; position: relative; overflow: hidden; background: radial-gradient(1200px 500px at 10% -10%, #e0e7ff 0%, transparent 60%), radial-gradient(900px 400px at 100% 110%, #dbeafe 0%, transparent 60%), var(--ms-bg); }
.auth-card { width: 100%; max-width: 480px; margin: auto; background: #fff; border-radius: 24px; box-shadow: var(--ms-shadow-lg); border: 1px solid var(--ms-border); overflow: hidden; position: relative; z-index: 1; padding: 40px; }
.auth-card:has(.auth-head) { padding: 0; }
.auth-card > h2 { font-weight: 800; }
.auth-head { background: linear-gradient(135deg, var(--ms-primary), var(--ms-accent)); color: #fff; padding: 36px 32px 28px; text-align: center; position: relative; }
.auth-head::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.12); top: -120px; inset-inline-end: -80px; }
.auth-head .auth-icon { width: 64px; height: 64px; border-radius: 20px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); display: inline-flex; align-items: center; justify-content: center; font-size: 1.8rem; margin-bottom: 14px; position: relative; z-index: 1; }
.auth-head h2 { font-weight: 800; margin: 0; font-size: 1.6rem; position: relative; z-index: 1; }
.auth-head p { margin: 6px 0 0; color: rgba(255,255,255,.85); font-size: .95rem; position: relative; z-index: 1; }
.auth-body { padding: 32px; }
.auth-body .form-label { font-weight: 600; font-size: .9rem; color: #334155; }
.auth-body .form-control { padding: .7rem 1rem; border-radius: 12px; background: #f8fafc; border-color: var(--ms-border); }
.auth-body .form-control:focus { background: #fff; }
.auth-body .input-icon { position: relative; }
.auth-body .input-icon > i { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 14px; color: var(--ms-muted); pointer-events: none; }
.auth-body .input-icon > .form-control { padding-inline-start: 42px; }
.auth-body .input-icon > .toggle-pass { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 10px; border: 0; background: transparent; color: var(--ms-muted); padding: 4px 6px; }
.auth-body .btn-auth { padding: .8rem 1rem; font-weight: 700; border-radius: 40px; box-shadow: 0 8px 20px rgba(79, 70, 229, .25); }
.auth-footer { background: #f8fafc; border-top: 1px solid var(--ms-border); padding: 16px 32px; text-align: center; color: var(--ms-muted); }
.auth-footer a { font-weight: 700; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--ms-muted); font-size: .85rem; margin: 20px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--ms-border); }
.code-input { font-size: 2rem; letter-spacing: 12px; text-align: center; font-weight: 700; }

/* Card headers (shared) */
.card, .card-soft, .sidebar-card { --bs-card-border-color: var(--ms-border); --bs-card-border-radius: var(--ms-radius); --bs-card-inner-border-radius: calc(var(--ms-radius) - 1px); }
.card .card-header, .card-soft .card-header, .sidebar-card .card-header { background: linear-gradient(180deg, #fafbff, #f1f5f9); border-bottom: 1px solid var(--ms-border); padding: 14px 20px; font-weight: 700; color: var(--ms-dark); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top-left-radius: var(--ms-radius); border-top-right-radius: var(--ms-radius); position: relative; }
.card .card-header::before, .card-soft .card-header::before, .sidebar-card .card-header::before { content: ""; position: absolute; top: 12px; bottom: 12px; inset-inline-start: 0; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(180deg, var(--ms-primary), var(--ms-accent)); }
html[dir="rtl"] .card .card-header::before, html[dir="rtl"] .card-soft .card-header::before, html[dir="rtl"] .sidebar-card .card-header::before { border-radius: 4px 0 0 4px; }
.card-header i.bi { color: var(--ms-primary); }
.card-soft .card-header + .card-body, .card .card-header + .card-body { padding: 20px; }

/* Page header */
.page-header { background: #fff; border-bottom: 1px solid var(--ms-border); padding: 28px 0; }
.page-header h1 { font-weight: 800; font-size: 1.75rem; margin: 0; }
.breadcrumb { margin: 0; }

/* Footer */
.site-footer { background: var(--ms-dark); color: #cbd5e1; }
.site-footer h5, .site-footer h6 { color: #fff; }
.site-footer .text-muted { color: #94a3b8 !important; }
.footer-links li { padding: 4px 0; }
.footer-links a { color: #cbd5e1; }
.footer-links a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #1e293b; color: #94a3b8; }
.social { width: 38px; height: 38px; border-radius: 10px; background: #1e293b; color: #fff; display: inline-flex; align-items: center; justify-content: center; transition: background .2s; }
.social:hover { background: var(--ms-primary); color: #fff; }
.whatsapp-float { position: fixed; bottom: 24px; inset-inline-end: 24px; width: 56px; height: 56px; border-radius: 50%; background: #22c55e; color: #fff; font-size: 1.8rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(34, 197, 94, .4); z-index: 1000; }
.whatsapp-float:hover { color: #fff; transform: scale(1.08); }

.empty-state { text-align: center; padding: 64px 16px; color: var(--ms-muted); }
.empty-state i { font-size: 4rem; color: #cbd5e1; }

@media (max-width: 991px) {
    .hero { padding: 56px 0; }
    .search-form { min-width: 100%; }
}
