:root {
    --primary: #1e90ff;
    --primary-light: #54a8ff;
    --primary-dark: #1879e6;
    --accent: #1e90ff;
    --accent-light: #54a8ff;
    --accent-dark: #1879e6;
    --bg: #f5f8ff;
    --bg-card: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #22a67e;
    --danger: #dc2626;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 1280px;
    --navbar-height: 64px;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Cairo', sans-serif; font-weight: 700; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== Animations ===== */
@keyframes fadeUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ===== Glass Utilities ===== */
.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.glass-dark {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(30, 144, 255, 0.1);
}
.glass-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}
.fade-up {
    animation: fadeUp 0.5s ease both;
}
.fade-up:nth-child(2) { animation-delay: 0.08s; }
.fade-up:nth-child(3) { animation-delay: 0.16s; }
.fade-up:nth-child(4) { animation-delay: 0.24s; }
.fade-up:nth-child(5) { animation-delay: 0.32s; }
.fade-up:nth-child(6) { animation-delay: 0.40s; }

/* ===== Navbar ===== */
.navbar {
    background: rgba(255, 255, 255, 0.85);
    color: var(--text);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(30, 144, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(30, 144, 255, 0.08);
}

.navbar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--navbar-height);
    padding: 0 20px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
}
.nav-toggle:hover { background: rgba(30,144,255,0.08); }

.navbar .logo {
    font-family: 'Cairo', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.5px;
}

.navbar .logo span { color: var(--primary); }
.navbar .logo i { font-size: 22px; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a, .nav-links button {
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    background: none;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.nav-links a:hover, .nav-links button:hover {
    background: rgba(30,144,255,0.08);
    color: var(--primary);
}

.nav-links .btn-city {
    background: rgba(30,144,255,0.08);
    border: 1px solid rgba(30,144,255,0.25);
    color: var(--primary);
    border-radius: 20px;
    padding: 6px 16px;
}

.nav-links .btn-city:hover {
    background: rgba(30,144,255,0.15);
}

.btn-auth {
    background: var(--accent) !important;
    color: #fff !important;
    font-weight: 700 !important;
    border-radius: var(--radius-sm) !important;
}

.btn-auth:hover {
    background: var(--accent-light) !important;
}

.btn-cart-nav {
    position: relative;
    font-size: 18px;
}

.cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(220,38,38,0.3);
}

/* ===== City Popup ===== */
.city-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.city-overlay.active { display: flex; }

.city-popup {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: popIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes popIn {
    from { transform: scale(0.92) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.city-popup h2 {
    font-size: 26px;
    color: var(--primary);
    margin-bottom: 6px;
}

.city-popup p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 15px;
}

.city-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.city-grid button {
    padding: 14px 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    color: var(--text);
    transition: var(--transition);
}

.city-grid button:hover {
    border-color: var(--primary);
    background: #f0f4ff;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ===== Container ===== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px;
}

/* ===== Hero Slider ===== */
.hero-slider {
    position: relative;
    width: 100%;
    height: 420px;
    overflow: hidden;
    border-radius: 0 0 24px 24px;
    margin-bottom: 32px;
    direction: ltr;
}

.hero-slider .slides {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-slider .slide {
    min-width: 100%;
    width: 100%;
    height: 100%;
    position: relative;
    flex-shrink: 0;
}

.hero-slider .slide a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.hero-slider .slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-slider .slide-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 50px 60px;
    background: linear-gradient(transparent 30%, rgba(0,0,0,0.65));
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    color: #fff;
}

.hero-slider .slide-overlay h2 {
    font-size: 30px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    margin-bottom: 4px;
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: var(--transition);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-arrow:hover {
    background: rgba(255,255,255,0.35);
    transform: translateY(-50%) scale(1.08);
}

.slider-arrow.prev { right: 16px; }
.slider-arrow.next { left: 16px; }

.slider-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.slider-dots span {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: var(--transition);
}

.slider-dots span.active {
    background: var(--accent);
    width: 28px;
    border-radius: 5px;
}

/* ===== Section Title ===== */
.section-title {
    font-size: 26px;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.section-title i { color: var(--accent); font-size: 22px; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* ===== Stores Grid ===== */
.stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.store-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: fadeUp 0.5s ease both;
}
.store-card:nth-child(2) { animation-delay: 0.08s; }
.store-card:nth-child(3) { animation-delay: 0.16s; }
.store-card:nth-child(4) { animation-delay: 0.24s; }
.store-card:nth-child(5) { animation-delay: 0.32s; }
.store-card:nth-child(6) { animation-delay: 0.40s; }

.store-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}

.store-card .store-banner {
    height: 56px;
    position: relative;
    overflow: visible;
}

.store-card .store-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.1));
}

.store-card .store-logo {
    width: 68px;
    height: 68px;
    border-radius: 14px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    position: absolute;
    bottom: -34px;
    right: 20px;
    border: 3px solid #fff;
    box-shadow: 0 4px 16px rgba(30, 144, 255, 0.2);
    z-index: 2;
    overflow: hidden;
}

.store-card .store-info {
    padding: 48px 20px 20px;
}

.store-card .store-info h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.store-card .store-info .store-location {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.store-card .store-info .store-location i { font-size: 12px; color: var(--accent); }

.store-card .store-info .btn-visit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    transition: var(--transition);
}

.store-card .store-info .btn-visit:hover { opacity: 0.9; transform: translateY(-1px); }

/* ===== Auth Forms ===== */
.auth-form {
    max-width: 460px;
    margin: 60px auto;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 36px 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.auth-form h1 {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 24px;
    text-align: center;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #334155;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: 'Tajawal', sans-serif;
    transition: var(--transition);
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-submit:hover { background: var(--primary-light); transform: translateY(-1px); }
.btn-submit:active { transform: translateY(0); }

.form-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-footer a { color: var(--primary); font-weight: 700; }

.form-switch {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.form-switch button {
    flex: 1;
    padding: 12px;
    border: none;
    background: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.form-switch button.active {
    background: var(--primary);
    color: #fff;
}

.form-switch button:not(.active):hover { background: #f1f5f9; }

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

/* ===== Store Page ===== */
.store-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    padding: 12px 20px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(30, 144, 255, 0.1);
}

.store-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(30,144,255,0.1));
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    pointer-events: none;
}

.store-header > * { position: relative; z-index: 1; }

.store-header-info { min-width: 0; }

.store-header .store-name {
    font-family: 'Cairo', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
}

.store-header .store-meta {
    margin-top: 4px;
    font-size: 14px;
    opacity: 0.9;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

.store-header .store-meta i { font-size: 14px; }

.store-banner-slider {
    position: relative;
    width: 100%;
    height: 320px;
    overflow: hidden;
    border-radius: var(--radius);
    margin-bottom: 24px;
    direction: ltr;
}

.store-banner-slider .slides {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    width: 100%;
}

.store-banner-slider .slide {
    min-width: 100%;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
}

.store-banner-slider .slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== Categories Slider ===== */
.categories-slider {
    margin: 28px 0;
    overflow: hidden;
}

.categories-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.categories-track::-webkit-scrollbar { display: none; }

.cat-item {
    flex-shrink: 0;
    padding: 10px 22px;
    border-radius: 30px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Tajawal', sans-serif;
    color: #475569;
}

.cat-item:hover, .cat-item.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

/* ===== Search ===== */
.search-bar {
    margin: 20px 0;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 14px 48px 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-card);
    transition: var(--transition);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}

.search-bar .search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
    pointer-events: none;
}

/* ===== Products Grid ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.product-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
    position: relative;
    animation: fadeUp 0.5s ease both;
}
.product-card:nth-child(2) { animation-delay: 0.05s; }
.product-card:nth-child(3) { animation-delay: 0.10s; }
.product-card:nth-child(4) { animation-delay: 0.15s; }
.product-card:nth-child(5) { animation-delay: 0.20s; }
.product-card:nth-child(6) { animation-delay: 0.25s; }
.product-card:nth-child(7) { animation-delay: 0.30s; }
.product-card:nth-child(8) { animation-delay: 0.35s; }

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.08);
    border-color: #d1d9e6;
}

.product-card .product-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-bottom: 1px solid var(--border-light);
    transition: transform 0.4s ease;
}
.product-card:hover .product-img {
    transform: scale(1.06);
}
.product-card .product-img-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    transition: transform 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 40px;
}
.product-card:hover .product-img-placeholder {
    transform: scale(1.04);
}

.product-card .product-body { padding: 14px; }

.product-card .product-body h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.3;
}

.product-card .product-body .price {
    font-size: 17px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 10px;
}

.product-card .product-body .price .old-price {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-right: 6px;
    font-weight: 400;
}

.product-card .discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-block;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.product-card .status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: inline-block;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.product-card .status-badge-available { background: #22a67e; }
.product-card .status-badge-unavailable { background: #64748b; }

.product-card.out-of-stock { filter: grayscale(0.6); opacity: 0.75; }
.product-card.out-of-stock .product-img { filter: grayscale(1); }
.product-card.out-of-stock .btn-add-cart { background: #e2e8f0 !important; color: #94a3b8 !important; cursor: not-allowed; }

.product-card .product-body .offer-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.btn-add-cart {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-add-cart:hover { opacity: 0.9; }

.unavailable-tag {
    text-align: center;
    padding: 10px;
    color: var(--danger);
    font-weight: 600;
    font-size: 14px;
    background: #fef2f2;
    border-radius: var(--radius-sm);
}

/* ===== Offers Section ===== */
.offers-section { margin: 28px 0; }

.offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.offer-card {
    background: rgba(235, 245, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(30, 144, 255, 0.15);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    animation: fadeUp 0.5s ease both;
}
.offer-card:nth-child(2) { animation-delay: 0.08s; }
.offer-card:nth-child(3) { animation-delay: 0.16s; }

.offer-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}

.offer-card .offer-percent {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    font-size: 20px;
    font-weight: 800;
    flex-shrink: 0;
}

.offer-card .offer-info h4 { font-size: 16px; margin-bottom: 2px; }
.offer-card .offer-info p { font-size: 13px; color: var(--text-secondary); }

/* ===== Cart Panel ===== */
.cart-panel {
    position: fixed;
    left: -420px;
    top: 0;
    width: 400px;
    height: 100%;
    background: var(--bg-card);
    box-shadow: -4px 0 30px rgba(0,0,0,0.12);
    z-index: 2000;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cart-panel.open { left: 0; }

.cart-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 1999;
}

.cart-overlay.open { display: block; }

.cart-panel .cart-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-panel .cart-header h3 {
    font-size: 20px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-panel .cart-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    transition: var(--transition);
    border-radius: 6px;
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-panel .cart-close:hover { background: #f1f5f9; color: var(--text); }

.cart-panel .cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

.cart-item:last-child { border-bottom: none; }

.cart-item img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.cart-item .item-info { flex: 1; }

.cart-item .item-info h4 { font-size: 14px; margin-bottom: 2px; }

.cart-item .item-info .item-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.cart-item .item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.cart-item .item-qty button {
    width: 28px; height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.cart-item .item-qty button:hover { border-color: var(--primary); color: var(--primary); }

.cart-item .item-qty span {
    font-weight: 700;
    font-size: 15px;
    min-width: 20px;
    text-align: center;
}

.cart-item .item-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 14px;
    align-self: flex-start;
    padding: 4px;
    opacity: 0.6;
    transition: var(--transition);
}

.cart-item .item-remove:hover { opacity: 1; }

.cart-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-light);
    background: #fafbfc;
}

.cart-footer .cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--primary);
}

.cart-footer .cart-notes { margin-bottom: 12px; }

.cart-footer .cart-notes textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    resize: vertical;
    min-height: 56px;
    transition: var(--transition);
}

.cart-footer .cart-notes textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-whatsapp {
    width: 100%;
    padding: 14px;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-whatsapp:hover { background: #1a8f6b; transform: translateY(-1px); }

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.cart-empty i { font-size: 48px; margin-bottom: 12px; color: #d1d9e6; }

/* ===== Dashboard Layout ===== */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text);
    padding: 0;
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(30, 144, 255, 0.08);
    box-shadow: -4px 0 20px rgba(30, 144, 255, 0.05);
}

.sidebar .sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(30, 144, 255, 0.08);
    text-align: center;
}

.sidebar .sidebar-logo {
    font-family: 'Cairo', sans-serif;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--primary);
}

.sidebar .sidebar-logo span { color: var(--primary); }

.sidebar .sidebar-store-name {
    padding: 8px 20px 4px;
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
    border-bottom: 1px solid rgba(30, 144, 255, 0.08);
    margin-bottom: 8px;
}

.sidebar nav { flex: 1; padding: 4px 0; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    border-right: 3px solid transparent;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(30, 144, 255, 0.1);
    color: var(--primary);
    border-right-color: var(--accent);
}

.sidebar nav a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.main-content {
    flex: 1;
    margin-right: 260px;
    padding: 24px 28px;
    min-height: 100vh;
}

.main-content .top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.main-content .top-bar h1 {
    font-size: 24px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
    animation: fadeUp 0.5s ease both;
}
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.16s; }
.stat-card:nth-child(4) { animation-delay: 0.24s; }

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

.stat-card .stat-icon { font-size: 28px; color: var(--accent); margin-bottom: 8px; }

.stat-card .stat-number {
    font-family: 'Cairo', sans-serif;
    font-size: 30px;
    font-weight: 800;
    color: var(--primary);
}

.stat-card .stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== Tables ===== */
.table-wrap {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 24px;
    overflow-x: auto;
}

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.table-wrap th,
.table-wrap td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.table-wrap th {
    background: #f8fafc;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table-wrap tr:hover td { background: #f1f5fd; }
.table-wrap tbody tr:nth-child(even) td { background: #f8fafc; }
.table-wrap tbody tr:nth-child(even):hover td { background: #f1f5fd; }

.table-wrap td .badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.badge-active, .badge-completed { background: #dcfce7; color: #166534; }
.badge-suspended, .badge-cancelled { background: #fef2f2; color: var(--danger); }
.badge-pending { background: #fef9c3; color: #854d0e; }

/* ===== Action Buttons ===== */
.action-btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.action-btn-edit { background: #dbeafe; color: #1d4ed8; }
.action-btn-delete { background: #fef2f2; color: var(--danger); }
.action-btn-view { background: #f0fdf4; color: #166534; }
.action-btn-suspend { background: #fef9c3; color: #854d0e; }

/* ===== Modals ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 5000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active { display: flex; }

.modal {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: scaleIn 0.3s ease;
}

.modal h2 {
    font-size: 22px;
    color: var(--primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.modal-header h2 { margin-bottom: 0; }

.modal-close {
    background: #f1f5f9;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    transition: var(--transition);
    border-radius: 6px;
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-close:hover { background: #e2e8f0; color: var(--text); }

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions .btn-submit { width: auto; padding: 12px 24px; }

.btn-cancel {
    padding: 12px 24px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    transition: var(--transition);
}

.btn-cancel:hover { background: #e2e8f0; }

/* ===== Profile Page ===== */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.profile-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    animation: fadeUp 0.5s ease both;
}

.profile-card h2 {
    color: var(--primary);
    font-size: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius);
    padding: 16px 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
}

.order-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }

.order-card .order-top {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.order-card .order-id { color: var(--primary); font-weight: 700; }

.order-card .order-store {
    color: var(--text-secondary);
    font-size: 13px;
    margin-right: 8px;
}

.order-card .order-items {
    font-size: 14px;
    color: #475569;
    margin-bottom: 6px;
}

.order-card .order-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.order-card .order-date { color: var(--text-secondary); }
.order-card .order-total { font-weight: 700; color: var(--primary); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; margin-bottom: 12px; color: #d1d9e6; }
.empty-state p { font-size: 18px; }

/* ===== 404 ===== */
.page-404 {
    text-align: center;
    padding: 60px 20px;
    animation: fadeUp 0.5s ease;
}

.page-404 .page-404-card {
    max-width: 500px;
    margin: 40px auto;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 48px 36px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0,0,0,0.06);
}

.page-404 .num {
    font-family: 'Cairo', sans-serif;
    font-size: 100px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.page-404 h2 {
    font-size: 26px;
    margin: 12px 0 6px;
    color: var(--text);
}

.page-404 p { color: var(--text-secondary); margin-bottom: 24px; }

/* ===== Helpers ===== */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    margin-left: 12px;
}

hr.divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 20px 0;
}

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { gap: 12px; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.mt-12 { margin-top: 12px; }
.mb-16 { margin-bottom: 16px; }
.inline-block { display: inline-block; }
.w-auto { width: auto; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    :root { --navbar-height: 56px; }

    .navbar .logo { font-size: 20px; }
    .navbar .logo i { font-size: 18px; }
    .nav-links a, .nav-links button { font-size: 13px; padding: 6px 10px; }

    .hero-slider { height: 240px; }
    .hero-slider .slide-overlay { padding: 20px; }
    .hero-slider .slide-overlay h2 { font-size: 20px; }

    .stores-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

    .auth-form { margin: 30px 16px; padding: 24px; }

    .cart-panel { width: 100%; left: -100%; }
    .cart-panel.open { left: 0; }

    .sidebar {
        width: 240px;
        right: -240px;
        transition: right 0.3s ease;
    }

    .nav-links {
        display: flex;
        position: static;
        width: auto;
        background: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        flex-direction: row;
        padding: 0;
        box-shadow: none;
        z-index: auto;
        border-bottom: none;
        gap: 6px;
    }
    .nav-links.open { display: flex; }
    .nav-links a, .nav-links button { width: auto; justify-content: center; padding: 8px 10px; font-size: 16px; }
    .nav-links .nav-label { display: none; }
    .nav-links .btn-city {
        width: 38px;
        height: 38px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }
    .nav-toggle { display: none !important; }

    .table-wrap table { min-width: 100%; }
    .table-wrap th, .table-wrap td { padding: 10px 12px; font-size: 13px; white-space: nowrap; }

    .sidebar.open { right: 0; }

    .sidebar-toggle {
        display: flex !important;
        background: #fff;
        border: none;
        color: var(--primary);
        font-size: 22px;
        cursor: pointer;
        padding: 8px 12px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }
    .sidebar-toggle:hover { background: #f1f5f9; }

    .main-content {
        margin-right: 0;
        padding: 16px;
    }

    .store-header { padding: 10px 12px; gap: 10px; }
    .store-header-logo { width: 56px !important; height: 56px !important; }
    .store-header .store-name { font-size: 19px; }
    .store-header .store-meta { font-size: 12px; }
    .store-banner-slider { height: 200px; }

    .city-grid { grid-template-columns: 1fr; }

    .slider-arrow { width: 36px; height: 36px; font-size: 14px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .navbar .logo { font-size: 18px; gap: 6px; }
    .nav-links a, .nav-links button { font-size: 15px; padding: 6px 8px; }
    .nav-links { gap: 4px; }
    .nav-links .btn-city { width: 34px; height: 34px; }

    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-card .product-img { aspect-ratio: 1 / 1; }

    .store-card .store-banner { height: 44px; }
    .store-card .store-logo { width: 56px; height: 56px; bottom: -28px; font-size: 22px; border-radius: 12px; }
    .store-card .store-info { padding: 40px 14px 14px; }

    .stats-grid { grid-template-columns: 1fr; }

    .sidebar { width: 220px; }

    .city-popup { padding: 28px 20px; }
}

/* ===== Responsive Table Cards ===== */
@media (max-width: 640px) {
    .table-wrap table,
    .table-wrap thead,
    .table-wrap tbody,
    .table-wrap tr,
    .table-wrap th,
    .table-wrap td {
        display: block;
    }
    .table-wrap thead {
        display: none;
    }
    .table-wrap tbody tr {
        margin-bottom: 16px;
        background: #fff;
        border-radius: var(--radius);
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        padding: 16px;
        border: 1px solid var(--border-light);
    }
    .table-wrap td {
        padding: 10px 0;
        border: none;
        text-align: right;
    }
    .table-wrap td:not(:last-child) {
        border-bottom: 1px solid var(--border-light);
    }
    .table-wrap td::before {
        content: attr(data-label) ": ";
        font-weight: 700;
        color: var(--primary);
        font-size: 13px;
        font-family: 'Cairo', sans-serif;
        display: block;
        margin-bottom: 2px;
    }
    .table-wrap td .action-btn {
        display: flex !important;
        width: 100%;
        justify-content: center;
        margin-bottom: 6px;
    }
    .table-wrap td form {
        display: block !important;
        width: 100%;
        margin-bottom: 6px;
    }
    .table-wrap td form .action-btn {
        margin-bottom: 0;
    }
}

/* ===== Mobile Top-bar & Filters ===== */
@media (max-width: 768px) {
    .main-content .top-bar {
        flex-wrap: wrap;
        gap: 8px;
    }
    .main-content .top-bar h1 {
        font-size: 20px;
    }
}

@media (max-width: 600px) {
    .filter-row {
        flex-direction: column;
    }
    .filter-row select,
    .filter-row input {
        min-width: 100% !important;
    }
    .container { padding: 12px; }
    .section-title { font-size: 22px; }
    .offers-grid { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
    .store-header .store-name { font-size: 17px; }
    .store-header-logo { width: 48px !important; height: 48px !important; }
    .store-banner-slider { height: 160px; }
}

@media (max-width: 380px) {
    .products-grid { grid-template-columns: 1fr; }
    .product-card .product-img { aspect-ratio: 1 / 1; }
    .stats-grid { grid-template-columns: 1fr; }
}
