/* =============================================================
   E-Commerce Shop — Storefront styles
   Starter stylesheet. Replace with your design system / build.
   ============================================================= */

:root {
    /* These older names still style the account/auth pages. They now point at
       the brand palette in theme.css instead of carrying their own hexes, so
       those pages follow the colours chosen in Admin → Site Settings too.
       (var() resolves when used, so load order between the two files doesn't
       matter; the second value is the fallback if theme.css is missing.) */
    --color-primary: var(--brand-navy, #002B7F);
    --color-text: var(--brand-body, #1a1a1a);
    --color-muted: var(--brand-gray, #666);
    --color-bg: #ffffff;
    --radius: 8px;
    --max-width: 1240px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    /* Real family comes from theme.css (--font-sans); this is the fallback
       for the brief moment before it loads. */
    font-family: "Plus Jakarta Sans", "Anek Bangla", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--brand-border, #eee);
    padding: 1rem 0;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-primary);
    text-decoration: none;
}

.site-header nav a {
    margin-left: 1.25rem;
    color: var(--color-text);
    text-decoration: none;
}

/* Hero */
.hero {
    padding: 3rem 0;
    text-align: center;
}

/* Product grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.product-card {
    border: 1px solid var(--brand-border, #eee);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .2s;
}

.product-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.product-card h3 {
    font-size: 1rem;
    margin: .75rem;
}

.product-card .price {
    display: block;
    margin: 0 .75rem .75rem;
    color: var(--color-primary);
    font-weight: 600;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--brand-border, #eee);
    padding: 2rem 0;
    margin-top: 3rem;
    color: var(--color-muted);
}

/* Error page */
.error-page {
    text-align: center;
    padding: 4rem 0;
}

.error-page h1 {
    font-size: 4rem;
    margin: 0;
}

/* ---- Legacy buttons (auth / order-success use .btn--*) ----
   The bare .btn base now comes from Bootstrap; only the BEM colour
   modifiers live here so they don't override Bootstrap's --bs-btn-bg. */
.btn--primary {
    background: var(--color-primary);
    color: #fff;
}

.btn--ghost {
    background: transparent;
    border-color: var(--brand-border-strong, #ddd);
}

.btn--block {
    width: 100%;
}

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

/* ---- Auth pages (login / register) ---- */
.auth-page {
    max-width: 420px;
    margin: 2.5rem auto;
}

.auth-page h1 {
    text-align: center;
}

.auth-form label {
    display: block;
    margin-bottom: 1rem;
    font-size: .92rem;
}

.auth-form input {
    display: block;
    width: 100%;
    margin-top: .35rem;
    padding: .6rem .7rem;
    border: 1px solid var(--brand-border-strong, #ddd);
    border-radius: 8px;
    font: inherit;
}

.auth-alt {
    text-align: center;
    margin-top: 1rem;
    color: var(--color-muted);
}

/* "Forgot password?" — right-aligned under the password field */
.auth-forgot {
    text-align: right;
    margin: -.5rem 0 1rem;
    font-size: .92rem;
}

.form-errors {
    background: var(--c-danger-bg, #fee2e2);
    color: var(--c-danger-d, #991b1b);
    border-radius: 8px;
    padding: .75rem 1rem .75rem 2rem;
    margin-bottom: 1rem;
    font-size: .9rem;
}

/* ---- Account area ---- */
.account {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.account__nav {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.account__nav a {
    padding: .55rem .75rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text);
}

.account__nav a.active,
.account__nav a:hover {
    background: var(--brand-surface, #f1f5f9);
}

.account__card {
    border: 1px solid var(--brand-border, #eee);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.account__card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-list {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}

.order-list th,
.order-list td {
    text-align: left;
    padding: .6rem .5rem;
    border-bottom: 1px solid var(--brand-border, #eee);
}

.status {
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .78rem;
    background: var(--brand-border-strong, #e2e8f0);
}

.status--delivered {
    background: var(--c-success-bg, #dcfce7);
    color: var(--c-success-d, #166534);
}

.status--pending {
    background: var(--c-warning-bg, #fef3c7);
    color: var(--c-warning-d, #92400e);
}

.status--cancelled,
.status--refunded {
    background: var(--c-danger-bg, #fee2e2);
    color: var(--c-danger-d, #991b1b);
}

.inline-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
}

.inline-check input {
    width: auto;
}

/* ---- Header search ---- */
.header-search {
    margin: 0 1rem;
    flex: 1;
    max-width: 320px;
}

.header-search input {
    width: 100%;
    padding: .45rem .7rem;
    border: 1px solid var(--brand-border-strong, #ddd);
    border-radius: 8px;
    font: inherit;
}

/* ---- Catalogue filter bar ---- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    background: var(--brand-surface, #f8fafc);
    border: 1px solid var(--brand-border, #eee);
    border-radius: var(--radius);
    padding: .75rem;
    margin-bottom: 1.5rem;
}

.filter-bar input,
.filter-bar select {
    padding: .45rem .6rem;
    border: 1px solid var(--brand-border-strong, #ddd);
    border-radius: 8px;
    font: inherit;
}

.filter-bar input[type=text] {
    flex: 1;
    min-width: 160px;
}

.filter-bar input[type=number] {
    width: 90px;
}

/* ---- Cart summary / coupon / totals ---- */
.cart-summary {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.coupon-form {
    display: flex;
    gap: .5rem;
}

.coupon-form input {
    padding: .5rem .7rem;
    border: 1px solid var(--brand-border-strong, #ddd);
    border-radius: 8px;
    font: inherit;
}

.coupon-msg {
    color: var(--color-primary);
    font-size: .9rem;
}

.totals {
    border-collapse: collapse;
    min-width: 240px;
}

.totals td {
    padding: .35rem .5rem;
}

.totals td:last-child {
    text-align: right;
    font-weight: 600;
}

.totals .discount td {
    color: var(--c-success-d, #166534);
}

.totals .grand td {
    border-top: 2px solid var(--brand-border, #eee);
    font-size: 1.15rem;
}

.checkout__totals {
    border-top: 1px solid var(--brand-border, #eee);
    margin-top: 1rem;
    padding-top: .75rem;
}

.checkout__totals p {
    display: flex;
    justify-content: space-between;
    margin: .3rem 0;
}

.checkout__totals .discount {
    color: var(--c-success-d, #166534);
}

.link-danger {
    color: var(--brand-danger, #dc2626);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

/* ---- Product detail: gallery + variants ---- */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.product-detail__main {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--brand-border, #eee);
    aspect-ratio: 1/1;
    object-fit: cover;
}

.product-thumbs {
    display: flex;
    gap: .5rem;
    margin-top: .75rem;
    flex-wrap: wrap;
}

.product-thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
}

.product-thumb.is-active {
    border-color: var(--color-primary);
}

.product-detail__info h1 {
    margin-top: 0;
}

.product-detail .price {
    font-size: 1.5rem;
    color: var(--color-primary);
    font-weight: 600;
}

.price--old {
    color: var(--color-muted);
    font-size: 1rem;
    margin-left: .5rem;
    font-weight: 400;
}

.variant-label {
    display: block;
    margin: 1rem 0 .5rem;
    font-size: .9rem;
}

.variant-label select {
    display: block;
    width: 100%;
    max-width: 300px;
    margin-top: .35rem;
    padding: .55rem .7rem;
    border: 1px solid var(--brand-border-strong, #ddd);
    border-radius: 8px;
    font: inherit;
}

.add-to-cart {
    margin: 1rem 0;
}

.add-to-cart input[type=number] {
    width: 70px;
    padding: .5rem;
    border: 1px solid var(--brand-border-strong, #ddd);
    border-radius: 8px;
    margin-right: .5rem;
}

.add-to-cart button {
    padding: .6rem 1.4rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}

.add-to-cart button:disabled {
    background: var(--c-border-mid, #cbd5e1);
    cursor: not-allowed;
}

.stock.in {
    color: var(--c-success-d, #166534);
}

.stock.out {
    color: var(--brand-danger, #dc2626);
}

@media (max-width: 640px) {
    .product-detail {
        grid-template-columns: 1fr;
    }
}

/* ---- Load more ---- */
.load-more-wrap {
    text-align: center;
    margin: 2rem 0;
}

#loadMore:disabled {
    opacity: .7;
    cursor: default;
}

@media (max-width: 640px) {
    .account {
        grid-template-columns: 1fr;
    }
}