/* ============================================================
   THEME — driven by brand.primary_color and brand.accent_color
   Variables set in base.html <style> at render time.
   ============================================================ */
:root {
    --primary: #0f2942;
    --accent: #10b981;
    --primary-fg: #ffffff;
    --accent-fg: #ffffff;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #0b1623;
    --text-muted: #6b7785;
    --border: #e5e9ef;
    --shadow-sm: 0 1px 2px rgba(15, 41, 66, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 41, 66, 0.08);
    --shadow-lg: 0 12px 30px rgba(15, 41, 66, 0.12);
    --radius: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;
    --primary-soft: color-mix(in srgb, var(--primary) 8%, white);
    --primary-line: color-mix(in srgb, var(--primary) 18%, white);
    --primary-deep: color-mix(in srgb, var(--primary) 80%, black);
    --accent-hover: color-mix(in srgb, var(--accent) 85%, black);
    --accent-soft: color-mix(in srgb, var(--accent) 12%, white);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main.main { flex: 1 0 auto; padding: 2rem 1rem 4rem; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }

a { color: var(--accent); text-decoration: none; transition: opacity .15s; }
a:hover { opacity: 0.85; text-decoration: none; }

img { max-width: 100%; display: block; }

.muted { color: var(--text-muted); }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    background: var(--primary);
    color: var(--primary-fg);
    padding: 0.85rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--primary-fg);
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: auto;
}
.brand-link:hover { opacity: 1; }
.brand-logo { height: 40px; width: auto; border-radius: 6px; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: var(--accent-fg);
    font-weight: 800;
    border-radius: 50%;
    font-size: 0.95rem;
}
.brand-name { letter-spacing: -0.01em; }

.header-nav {
    display: flex;
    gap: 1.8rem;
    align-items: center;
}
.header-nav a {
    color: rgba(255, 255, 255, 0.92);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.4rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color .15s;
}
.header-nav a:hover { border-bottom-color: var(--accent); }
.cart-link { display: inline-flex; align-items: center; gap: 0.4rem; }
.cart-badge {
    background: var(--accent);
    color: var(--accent-fg);
    border-radius: var(--radius-pill);
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.header-switchers {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.switcher {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-pill);
    transition: background .15s;
}
.switcher:hover { background: rgba(255, 255, 255, 0.16); }
.switcher-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    width: 100%;
}
.switcher-icon { font-size: 0.85rem; opacity: 0.85; pointer-events: none; }
.switcher select {
    background: transparent;
    color: var(--primary-fg);
    border: 0;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    padding: 0 0.2rem;
    appearance: none;
}
.switcher select option { color: #222; }

.nav-toggle {
    display: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    padding: 0.3rem;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--primary-fg);
    border-radius: 2px;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--primary-fg);
    padding: 6rem 1.5rem 6.5rem;
    min-height: 70vh;
    text-align: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent) 25%, transparent), transparent 70%);
    top: -200px;
    right: -200px;
    pointer-events: none;
    z-index: 0;
}
/* When a banner image is set, overlay primary-color tint for legibility.
   Overlay strength is brand-configurable via --hero-overlay-opacity (set in base.html). */
.hero.has-banner .hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    opacity: var(--hero-overlay-opacity, 70%);
    z-index: 0;
}
.hero:not(.has-banner) .hero-overlay { display: none; }
.hero-inner {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}
.hero-tagline {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin: 0;
}
.hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
    letter-spacing: -0.02em;
    word-break: break-word;
}
.hero p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.82);
    max-width: 560px;
    margin: 0;
    line-height: 1.6;
}
.hero .btn { margin-top: 0.5rem; }

/* ============================================================
   BUTTONS (pill-shaped)
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.7rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    transition: transform .15s, background .15s, color .15s, box-shadow .15s;
    text-decoration: none;
    line-height: 1;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn.primary {
    background: var(--accent);
    color: var(--accent-fg);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn.primary:hover { background: var(--accent-hover); }

.btn.dark {
    background: var(--primary);
    color: var(--primary-fg);
}
.btn.dark:hover { background: var(--primary-deep); }

.btn.ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn.ghost:hover { background: var(--primary-soft); }

.btn.danger {
    background: transparent;
    color: #c0392b;
    border-color: #f5c6cb;
}
.btn.danger:hover { background: #fdf1f1; }

.btn.sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn.lg { padding: 1.05rem 2rem; font-size: 1rem; }

/* ============================================================
   NOTICES
   ============================================================ */
.notice {
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    border: 1px solid transparent;
}
.notice.warning { background: #fff8e6; color: #8a6d3b; border-color: #ffe9a8; }
.notice.success { background: var(--accent-soft); color: var(--primary-deep); border-color: color-mix(in srgb, var(--accent) 35%, white); }
.notice.error { background: #fdecea; color: #a94442; border-color: #f5c6cb; }

/* ============================================================
   PAGE TITLES
   ============================================================ */
.page-title {
    font-size: 1.9rem;
    font-weight: 800;
    margin: 0 0 0.4rem;
    letter-spacing: -0.02em;
    color: var(--text);
}
.page-subtitle { color: var(--text-muted); margin: 0 0 2rem; }

/* ============================================================
   PRODUCT GRID & CARDS
   ============================================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.4rem;
    margin-top: 1rem;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: transform .2s, box-shadow .2s, border-color .2s;
    box-shadow: var(--shadow-sm);
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-line);
    text-decoration: none;
}
.product-card-image {
    aspect-ratio: 4 / 3;
    background: var(--primary-soft);
    overflow: hidden;
}
.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.product-card:hover .product-card-image img { transform: scale(1.04); }
.product-card-body { padding: 1rem 1.1rem 1.2rem; }
.product-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text);
}
.product-card .price {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    margin: 0;
}
.product-card .price.muted { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }

/* ============================================================
   PDP
   ============================================================ */
.pdp {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
    margin-top: 1rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}
.pdp-image {
    background: var(--primary-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 1;
}
.pdp-image img { width: 100%; height: 100%; object-fit: cover; }
.pdp-info h1 {
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 800;
    margin: 0 0 1rem;
    letter-spacing: -0.02em;
    color: var(--text);
}
.pdp-info .price.big {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 1.5rem;
}
.pdp-info .description {
    line-height: 1.7;
    color: var(--text-muted);
    margin: 1rem 0 2rem;
    font-size: 1rem;
}
@media (max-width: 800px) { .pdp { grid-template-columns: 1fr; gap: 1.5rem; padding: 1.2rem; } }

/* ============================================================
   CART
   ============================================================ */
.cart-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}
@media (max-width: 900px) { .cart-layout { grid-template-columns: 1fr; } }
.cart-items, .checkout-form {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.cart-item:last-of-type { border-bottom: 0; }
.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
}
.cart-item-noimage {
    width: 80px;
    height: 80px;
    background: var(--primary-soft);
    border-radius: var(--radius);
}
.cart-item-body { min-width: 0; }
.remove-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s, border-color .15s;
}
.remove-btn:hover {
    background: #fdecea;
    color: #c0392b;
    border-color: #f5c6cb;
}
.cart-item .item-name { font-weight: 600; color: var(--text); margin-bottom: 0.3rem; }
.cart-item .original-price {
    text-decoration: line-through;
    color: var(--text-muted);
    margin-right: 0.5rem;
    font-size: 0.9rem;
}
.cart-item .final-price { font-weight: 700; color: var(--primary); }
.cart-item .discount-pill {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--primary-deep);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: 0.4rem;
}
.cart-item .qty {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
}
.cart-item .qty button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font-size: 1rem;
    color: var(--text);
}
.cart-item .qty button:hover { border-color: var(--primary); }
.cart-item .qty [data-qty] { min-width: 22px; text-align: center; font-weight: 600; }
.cart-totals {
    padding-top: 1.2rem;
    border-top: 2px solid var(--primary);
    margin-top: 1.2rem;
}
.cart-totals .row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    color: var(--text-muted);
}
.cart-totals .row.total {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    padding-top: 0.8rem;
}

/* ============================================================
   PAYMENT BUTTONS (stacked, brand-styled)
   ============================================================ */
.pay-section { margin-top: 1.5rem; }
.pay-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    font-weight: 600;
}
.pay-buttons { display: flex; flex-direction: column; gap: 0.6rem; }
.pay-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.95rem 1.2rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
}
.pay-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.pay-btn:active { transform: translateY(0); }
.pay-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.pay-paypal { background: #FFC439; color: #003087; border-color: #f0b32a; }
.pay-paypal:hover { background: #ffb70c; }
.pay-paypal .pp-text {
    font-style: italic;
    font-weight: 900;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.pay-card { background: #1a1a1a; color: #fff; }
.pay-card:hover { background: #000; }

.pay-test {
    background: transparent;
    color: var(--text-muted);
    border: 1px dashed var(--border);
}
.pay-test:hover { background: var(--primary-soft); border-color: var(--primary-line); color: var(--text); }

/* ============================================================
   FORMS
   ============================================================ */
.checkout-form h2 {
    font-size: 1.25rem;
    margin: 0 0 1.2rem;
    color: var(--text);
}
.form-row { margin-bottom: 1rem; }
.form-row label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    color: var(--text);
    font-weight: 500;
}
.form-row input,
.form-row textarea,
.form-row select {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.form-row.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 500px) { .form-row.split { grid-template-columns: 1fr; } }

/* ============================================================
   ORDER TRACKING
   ============================================================ */
.order-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--primary-soft);
    color: var(--primary-deep);
    text-transform: capitalize;
}
.status-badge.status-paid,
.status-badge.status-preparing,
.status-badge.status-shipped,
.status-badge.status-delivered { background: var(--accent-soft); color: var(--primary-deep); }
.status-badge.status-cancelled,
.status-badge.status-refunded { background: #fdecea; color: #a94442; }
.status-badge.status-pending_payment { background: #fff8e6; color: #8a6d3b; }
.order-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.order-table th {
    text-align: left;
    padding: 0.7rem 0.6rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.order-table td {
    padding: 0.8rem 0.6rem;
    border-bottom: 1px solid var(--border);
}
.order-table tfoot td { font-weight: 700; padding-top: 1rem; }
.order-table .num { text-align: right; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--primary);
    color: rgba(255, 255, 255, 0.78);
    padding: 0.9rem 0;
    margin-top: auto;
    flex-shrink: 0;
}
.site-footer:has(.footer-grid) { padding: 3.5rem 0 1.5rem; }
.site-footer .brand-link { color: var(--primary-fg); margin-right: 0; }
.site-footer .muted { color: rgba(255, 255, 255, 0.55); }

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-brand { min-width: min(100%, 280px); }

.footer-col h4 {
    color: var(--primary-fg);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 1rem;
    font-weight: 700;
}
.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.footer-col ul a {
    color: rgba(255, 255, 255, 0.78);
    transition: color .15s;
    font-size: 0.9rem;
}
.footer-col ul a:hover { color: var(--accent); }

.footer-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 1rem 0;
    max-width: 28ch;
}

.footer-contact li {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.78);
}
.footer-icon {
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
    opacity: 0.8;
}

.footer-socials {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
}
.footer-socials a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    transition: background .15s, color .15s, transform .15s;
}
.footer-socials a:hover {
    background: var(--accent);
    color: var(--accent-fg);
    transform: translateY(-2px);
}

.footer-cta-col p { font-size: 0.9rem; margin: 0 0 1rem; }
.footer-cta-col .btn { width: 100%; }

.footer-bottom {
    padding-top: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
}
.site-footer:has(.footer-grid) .footer-bottom { padding-top: 1.5rem; }
.footer-bottom p { margin: 0; }

.payment-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
}
.payment-badges img {
    height: 22px;
    width: auto;
    border-radius: 3px;
}

/* ============================================================
   LANDING PAGE — no <main>, hero grows to fill body so footer hugs it
   ============================================================ */
body.landing .hero { flex: 1 1 auto; }

/* ============================================================
   RESPONSIVE — mobile nav
   ============================================================ */
@media (max-width: 850px) {
    .header-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary);
        flex-direction: column;
        gap: 0;
        padding: 0.6rem 1.25rem 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        max-height: 0;
        overflow: hidden;
        transition: max-height .25s;
    }
    .header-nav.open { max-height: 300px; }
    .header-nav a { padding: 0.8rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
    .header-nav a:last-child { border-bottom: 0; }
    .nav-toggle { display: inline-flex; }
}
