/* ═══════════════════════════════════════════════════════════════
   arabstor — storefront styles

   Extracted from render_store_css() in store/store_helper.php, where ~380
   lines of CSS were echoed inline into every storefront page. As a real file
   the browser caches it once instead of re-downloading it with each page.
   ═══════════════════════════════════════════════════════════════ */

/* The stylesheet had no box-sizing reset, so any element combining
   width: 100% with padding overflowed its container by the padding width.
   It only showed on <a class="btn-store"> — browsers give <button> a
   border-box default of their own, which is why every button looked fine
   while the cart's "متابعة للدفع" link hung outside the summary card. */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --store-primary: #0f172a;
    --store-accent: #3b82f6;
    --store-accent-hover: #2563eb;
    --store-bg: #f8fafc;
    --store-card: rgba(255, 255, 255, 0.9);
    --store-text: #0f172a;
    --store-text-muted: #64748b;
    --store-border: rgba(226, 232, 240, 0.8);
    --store-radius: 20px;
    --store-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --store-shadow-hover: 0 20px 40px -10px rgba(59, 130, 246, 0.15), 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --store-transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
}

body {
    background-color: var(--store-bg);
    background-image: 
        radial-gradient(at 0% 0%, hsla(217,100%,90%,1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, hsla(210,100%,94%,1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(217,100%,92%,1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(210,100%,90%,1) 0px, transparent 50%);
    background-attachment: fixed;
    font-family: "Outfit", "Cairo", sans-serif;
    color: var(--store-text);
    margin: 0;
    padding: 0;
}

/* Navbar Override */
.navbar {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(20px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(150%) !important;
    border-bottom: 1px solid var(--glass-border) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03) !important;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
    transition: var(--store-transition);
}

/* Hero Section */
.store-hero {
    position: relative;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    padding: 7rem 2rem 5rem;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
    overflow: hidden;
    border-radius: 0 0 50px 50px;
    margin-bottom: 4rem;
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.05);
}

.store-hero::before {
    content: "";
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at center, rgba(59,130,246,0.08) 0%, transparent 50%);
    animation: pulse-glow 15s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes pulse-glow {
    0% { transform: scale(0.9) translate(0, 0); }
    100% { transform: scale(1.1) translate(5%, 5%); }
}

.store-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 0.5rem;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15), inset 0 0 0 2px rgba(255,255,255,0.8);
    margin: 0 auto 1.5rem auto;
    position: relative;
    z-index: 1;
    transition: var(--store-transition);
}

.store-logo:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 25px 50px -12px rgba(59,130,246,0.25), inset 0 0 0 2px rgba(255,255,255,1);
}

.store-title {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--store-primary) 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
    position: relative;
    z-index: 1;
    text-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.store-desc {
    font-size: 1.15rem;
    color: var(--store-text-muted);
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.8;
    position: relative;
    z-index: 1;
    font-weight: 500;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 2.5rem;
    padding: 1rem 0 5rem 0;
}

/* Product Card */
.product-card {
    background: var(--store-card);
    backdrop-filter: blur(15px);
    border-radius: var(--store-radius);
    overflow: hidden;
    box-shadow: var(--store-shadow);
    transition: var(--store-transition);
    border: 1px solid var(--glass-border);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--store-shadow-hover);
    border-color: rgba(59,130,246,0.2);
    z-index: 10;
}

.product-image-wrap {
    position: relative;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    overflow: hidden;
    background: #ffffff;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.product-image {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.product-card:hover .product-image {
    transform: scale(1.1);
}

.product-content {
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 100%);
}

.product-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--store-text);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--store-accent);
    margin-top: auto;
    margin-bottom: 1.5rem;
    display: inline-block;
    background: rgba(59,130,246,0.1);
    padding: 0.3rem 1rem;
    border-radius: 12px;
}

/* Buttons */
.btn-store {
    background: linear-gradient(135deg, var(--store-accent) 0%, var(--store-accent-hover) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 1rem 1.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--store-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    box-shadow: 0 4px 15px rgba(59,130,246,0.3);
    position: relative;
    overflow: hidden;
}

.btn-store::before {
    content: "";
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: all 0.5s ease;
}

.btn-store:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59,130,246,0.4);
}

.btn-store:hover::before {
    left: 100%;
}

.btn-store-outline {
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
    color: var(--store-primary);
    border: 2px solid rgba(15, 23, 42, 0.1);
    border-radius: 14px;
    padding: 1rem 1.5rem;
    font-weight: 700;
    transition: var(--store-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-store-outline:hover {
    background: var(--store-primary);
    color: white;
    border-color: var(--store-primary);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
    transform: translateY(-2px);
}

/* Product Detail Layout */
.product-detail-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 3.5rem;
    box-shadow: var(--store-shadow);
    margin-top: 3rem;
    margin-bottom: 5rem;
}

@media (max-width: 900px) {
    .product-detail-layout {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        padding: 2rem;
    }
}

.product-detail-image {
    width: 100%;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: 0 20px 40px -15px rgba(0,0,0,0.15);
    transition: var(--store-transition);
}

.product-detail-image:hover {
    transform: scale(1.02);
}

.qty-selector {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--store-border);
    border-radius: 14px;
    padding: 0.4rem;
    width: fit-content;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.qty-btn {
    background: #f8fafc;
    border: 1px solid transparent;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--store-transition);
    color: var(--store-text);
    font-size: 1.2rem;
}

.qty-btn:hover {
    background: var(--store-accent);
    color: white;
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.qty-input {
    width: 60px;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--store-primary);
}

/* Badges */
.store-badge {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--store-primary);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    z-index: 10;
    border: 1px solid rgba(255,255,255,0.5);
}

.store-badge-free-shipping {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
}

/* .checkout-card / .cart-card / .form-control used to live here and were
   defined a second time inside store/checkout.php's own <style>. Same
   specificity, so the later inline block silently won for every property it
   repeated while background/border/backdrop-filter leaked through from here —
   two half-definitions producing one card. .cart-card was never referenced by
   any markup at all. The surviving rules now live only in store/checkout.php. */

/* ── Navbar row ──────────────────────────────────────────────
   store/index.php, cart.php, checkout.php and product.php each repeated the
   same inline flex row:

       max-width:1200px; margin:0 auto; width:100%;
       display:flex; justify-content:space-between; align-items:center;

   with no horizontal padding at all, while every content block underneath
   uses `padding: 0 1.5rem`. So the header never lined up with the page, and
   on any viewport under 1200px the brand and the cart button sat flush
   against the screen edge.

   Worse on phones: cart/checkout/product put three items in that row (back
   link + page title + account chip) with nothing allowed to shrink, so it
   overflowed — and since .navbar is position:sticky, that overflow scrolled
   the entire document sideways. */
.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--store-text);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: var(--store-transition);
}

.nav-link:hover {
    color: var(--store-accent);
}

/* Store name in the storefront header — the one item allowed to shrink,
   because a long store name should never push the cart button off screen.
   The ellipsis lives on the inner span, not here: text-overflow has no
   effect on a flex container, so putting it on .nav-brand would clip the
   name mid-letter with no "…". */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--store-primary);
    text-decoration: none;
    min-width: 0;
}

.nav-brand-name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.nav-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--store-primary);
    white-space: nowrap;
}

.nav-cart {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--store-primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background: rgba(59, 130, 246, 0.05);
    white-space: nowrap;
    flex-shrink: 0;
    transition: var(--store-transition);
}

.nav-cart:hover {
    background: rgba(59, 130, 246, 0.12);
}

/* Stays on the physical right: in RTL that is the outer corner of the
   cart icon, which is where a count badge belongs. */
.nav-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    border-radius: 50%;
    border: 2px solid #fff;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (max-width: 760px) {
    .navbar-inner {
        padding: 0 1rem;
        gap: 0.5rem;
    }
    /* The page title is repeated as a heading in the body, so drop it here
       rather than let three items fight over 375px */
    .nav-title {
        display: none;
    }
    .nav-link,
    .nav-cart {
        font-size: 1rem;
    }
    .nav-brand {
        font-size: 1.1rem;
    }
    .nav-cart {
        padding: 0.5rem 0.8rem;
    }
    .nav-cart-label,
    .nav-link-label {
        display: none;
    }
}
