/* ==========================================================================
   Nexora Shop — storefront design tokens
   Shares the Royal Blue / Light Blue palette with the admin app so the two
   feel like one brand, laid out for a customer-facing storefront instead.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --color-primary: #1E3A8A;
    --color-primary-dark: #15296B;
    --color-primary-light: #3457C4;
    --color-secondary: #5DA9E9;
    --color-secondary-soft: #E8F2FD;

    --color-bg: #F4F7FC;
    --color-surface: #FFFFFF;
    --color-border: #E4E9F2;
    --color-text: #1F2937;
    --color-text-muted: #6B7280;
    --color-text-inverse: #FFFFFF;

    --color-success: #16A34A;
    --color-success-soft: #E9F9EF;
    --color-warning: #D97706;
    --color-warning-soft: #FDF3E3;
    --color-danger: #DC2626;
    --color-danger-soft: #FCEAEA;

    --font-display: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-card: 0 1px 2px rgba(16, 30, 70, 0.04), 0 4px 16px rgba(16, 30, 70, 0.06);
    --max-width: 1200px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-body); background: var(--color-bg); color: var(--color-text); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .font-display { font-family: var(--font-display); color: var(--color-primary-dark); margin: 0 0 6px; }
a { color: inherit; }
img { max-width: 100%; display: block; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
.text-muted { color: var(--color-text-muted); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-20 { gap: 20px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: .15s; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-light); }
.btn-outline { background: #fff; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-secondary { background: var(--color-secondary-soft); color: var(--color-primary-dark); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Top bar / header ---- */
.topbar-strip { background: var(--color-primary-dark); color: #fff; font-size: 12.5px; padding: 6px 0; }
.site-header { background: #fff; border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 40; }
.site-header .inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--color-primary-dark); text-decoration: none; }
.brand .mark { width: 34px; height: 34px; border-radius: 8px; background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.site-search { flex: 1; max-width: 480px; display: flex; align-items: center; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 999px; padding: 8px 16px; }
.site-search input { border: none; background: transparent; outline: none; flex: 1; font-size: 14px; margin-left: 8px; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.icon-link { position: relative; color: var(--color-text); text-decoration: none; display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; }
.cart-badge { position: absolute; top: -8px; right: -10px; background: var(--color-danger); color: #fff; font-size: 10.5px; border-radius: 999px; min-width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }

.site-nav { background: var(--color-primary); }
.site-nav .inner { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.site-nav .inner::-webkit-scrollbar { display: none; }
.site-nav a { color: #dbe6ff; text-decoration: none; padding: 11px 16px; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.site-nav a:hover, .site-nav a.active { color: #fff; background: rgba(255,255,255,.08); }

/* ---- Hero / banners ---- */
.hero { background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%); color: #fff; padding: 48px 0; margin-bottom: 32px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.hero h1 { color: #fff; font-size: 30px; }
.hero p { color: #dbe6ff; font-size: 15px; max-width: 560px; }

/* ---- Cards / product grid ---- */
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 36px 0 16px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.product-card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: .15s; }
.product-card:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
.product-card .thumb { aspect-ratio: 1; background: var(--color-bg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .body { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; }
.product-card .cat { font-size: 11px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.product-card .name { font-size: 14px; font-weight: 600; margin: 4px 0 6px; line-height: 1.35; flex: 1; }
.product-card .price { font-family: var(--font-display); font-weight: 700; color: var(--color-primary-dark); font-size: 15.5px; }
.product-card .price .old { text-decoration: line-through; color: var(--color-text-muted); font-weight: 400; font-size: 12.5px; margin-left: 6px; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-info { background: var(--color-secondary-soft); color: var(--color-primary-dark); }
.out-of-stock-tag { position: absolute; }

/* ---- Filters sidebar ---- */
.shop-layout { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.filters { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 18px; position: sticky; top: 90px; }
.filters h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted); margin-bottom: 10px; }
.filters a { display: block; padding: 6px 0; font-size: 13.5px; text-decoration: none; color: var(--color-text); }
.filters a.active { color: var(--color-primary); font-weight: 600; }

/* ---- Shared two-column page layouts (product page, cart, checkout,
   account pages) — one grid per page for its own desktop column widths,
   all collapsing to a single column together on smaller screens. Using
   classes here (instead of the inline styles these replace) is what lets
   the media query below override them. ---- */
.pdp-layout { display: grid; grid-template-columns: minmax(280px, 440px) 1fr; gap: 36px; align-items: start; }
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.checkout-layout { display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: start; }
.order-view-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.addresses-layout { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.messages-layout { display: grid; grid-template-columns: 260px 1fr; min-height: 420px; }
.messages-list-col { border-right: 1px solid var(--color-border); max-height: 420px; overflow-y: auto; }

/* ---- Forms ---- */
.card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 22px; box-shadow: var(--shadow-card); }
.form-group { margin-bottom: 16px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--color-text); }
.form-control { width: 100%; padding: 10px 13px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: #fff; }
.form-control:focus { outline: none; border-color: var(--color-primary); }
textarea.form-control { resize: vertical; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; }
.alert-success { background: var(--color-success-soft); color: var(--color-success); }
.alert-error { background: var(--color-danger-soft); color: var(--color-danger); }
.alert-info { background: var(--color-secondary-soft); color: var(--color-primary-dark); }

/* ---- Cart / checkout ---- */
.cart-row { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--color-border); flex-wrap: wrap; }
.cart-row .thumb { width: 64px; height: 64px; border-radius: var(--radius-sm); background: var(--color-bg); overflow: hidden; flex-shrink: 0; }
.cart-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-row-info { flex: 1 1 160px; min-width: 0; }
.cart-row-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.cart-row-total { width: 100px; text-align: right; font-weight: 600; flex-shrink: 0; }
.qty-input { width: 56px; text-align: center; padding: 6px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.finance-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; }
.finance-row.total { font-weight: 700; font-size: 17px; border-top: 1px solid var(--color-border); margin-top: 6px; padding-top: 12px; color: var(--color-primary-dark); }
.payment-option { display: block; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; cursor: pointer; }
.payment-option input { margin-right: 10px; }
.payment-option.selected { border-color: var(--color-primary); background: var(--color-secondary-soft); }

/* ---- Footer ---- */
.site-footer { background: var(--color-primary-dark); color: #cdd9f5; margin-top: 60px; padding: 40px 0 24px; font-size: 13.5px; }
.site-footer h4 { color: #fff; font-size: 14px; margin-bottom: 12px; }
.site-footer a { color: #cdd9f5; text-decoration: none; }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 24px; margin-bottom: 24px; }
.site-footer .bottom { border-top: 1px solid rgba(255,255,255,.12); padding-top: 16px; font-size: 12px; color: #9fb0d8; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--color-border); }
th { color: var(--color-text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.panel-header { margin-bottom: 14px; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--color-text-muted); }
.star-row svg { display: inline-block; vertical-align: middle; }
.avatar-circle { width: 36px; height: 36px; border-radius: 50%; background: var(--color-secondary-soft); color: var(--color-primary-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }

/* ==========================================================================
   Responsive — tablet (≤860px): collapse sidebars and two-column layouts
   ========================================================================== */
@media (max-width: 860px) {
    .shop-layout { grid-template-columns: 1fr; }
    .filters { position: static; }
    .form-row-2 { grid-template-columns: 1fr; }
    .pdp-layout, .cart-layout, .checkout-layout, .order-view-layout,
    .addresses-layout { grid-template-columns: 1fr; }
    .messages-layout { grid-template-columns: 1fr; min-height: 0; }
    .messages-list-col { border-right: none; border-bottom: 1px solid var(--color-border); max-height: 220px; }
}

/* ==========================================================================
   Responsive — phone (≤640px)
   ========================================================================== */
@media (max-width: 640px) {
    .container { padding: 0 14px; }

    /* Header: brand + actions on the top row, search bar wraps to its own
       full-width row underneath rather than disappearing. */
    .site-header .inner { flex-wrap: wrap; row-gap: 10px; padding: 12px 0; }
    .brand { order: 1; font-size: 17px; }
    .brand .mark { width: 30px; height: 30px; }
    .header-actions { order: 2; margin-left: auto; gap: 14px; }
    .site-search { order: 3; flex: 1 1 100%; max-width: none; }
    .header-actions .track-order-link { display: none; } /* also in the footer */
    .icon-link .icon-label { display: none; } /* icon only — "Cart" / "My Account" text hidden to save width */

    .hero { padding: 30px 0; border-radius: 0 0 var(--radius-md) var(--radius-md); }
    .hero h1 { font-size: 22px; }
    .hero p { font-size: 13.5px; }

    .section-title { margin: 24px 0 12px; }
    .section-title h2 { font-size: 17px; }

    /* Two columns of smaller cards reads better than one giant column on a
       phone-width product grid (matches the pattern shoppers expect). */
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .product-card .name { font-size: 13px; }
    .product-card .price { font-size: 14px; }

    .card { padding: 16px; }

    /* Cart / order-item rows: thumbnail + name on one line, qty/total/remove
       control row wraps below it instead of squeezing onto one line. */
    .cart-row-actions { flex: 1 1 100%; justify-content: space-between; margin-top: 8px; }

    /* iOS Safari auto-zooms on any input under 16px — bump these up to stop
       that jump when a shopper taps into a field. */
    .form-control, select, .qty-input { font-size: 16px; }

    .site-footer .cols { grid-template-columns: 1fr 1fr; gap: 20px; }
}

@media (max-width: 420px) {
    .site-footer .cols { grid-template-columns: 1fr; }
    .header-actions { gap: 10px; }
}
