/*
 * SellitZA stylesheet.
 *
 * This replaces roughly 215 lines of CSS that were previously pasted inline into
 * every one of the page files.
 */

:root {
    --green: #2e9e4f;
    --green-dark: #24803f;
    --red: #d64541;
    --ink: #1c1f23;
    --muted: #6b7280;
    --line: #e5e7eb;
    --surface: #ffffff;
    --bg: #f6f7f9;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.55;
}

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

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Header ----------------------------------------------------------------- */
.site-header {
    display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
    padding: .85rem 1.5rem; background: var(--surface);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}

.brand { font-size: 1.6rem; font-weight: 800; text-decoration: none; letter-spacing: .5px; }
.brand-s { color: var(--green); }
.brand-e { color: #e8b400; }
.brand-l, .brand-l2 { color: #111; }
.brand-i { color: var(--red); }
.brand-t { color: #fff; background: #111; padding: 0 .18em; border-radius: 3px; }
.brand-z { color: #1d4ed8; }
.brand-a { color: var(--green); }

.site-nav { display: flex; gap: 1rem; flex-wrap: wrap; flex: 1 1 auto; }
.site-nav a { text-decoration: none; color: var(--muted); font-size: .93rem; }
.site-nav a:hover { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: .6rem; }
.cart-count {
    background: var(--ink); color: #fff; border-radius: 999px;
    padding: 0 .45rem; font-size: .78rem; margin-left: .25rem;
}

.account-menu { position: relative; }
.account-toggle { background: none; border: 0; font: inherit; cursor: pointer; padding: .5rem; }
.account-dropdown {
    display: none; position: absolute; right: 0; top: 100%; min-width: 190px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: .35rem;
}
.account-menu.is-open .account-dropdown { display: block; }
.account-dropdown a { display: block; padding: .5rem .65rem; text-decoration: none; border-radius: 6px; }
.account-dropdown a:hover { background: var(--bg); }

/* Buttons ---------------------------------------------------------------- */
.btn {
    display: inline-block; padding: .55rem 1rem; border: 1px solid transparent;
    border-radius: var(--radius); font: inherit; font-weight: 600; cursor: pointer;
    text-decoration: none; text-align: center;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--red); color: #fff; }

/* Layout ----------------------------------------------------------------- */
.site-main { max-width: 1200px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
.page-heading { font-size: 1.75rem; margin: 0 0 1.25rem; }
.section-heading { font-size: 1.2rem; margin: 2rem 0 1rem; }
.empty-state { color: var(--muted); padding: 2rem 0; }

.flash-list { margin-bottom: 1rem; }
.flash {
    background: #fef7e0; border: 1px solid #f6d98a; color: #7a5b00;
    padding: .7rem 1rem; border-radius: var(--radius); margin: 0 0 .5rem;
}
.notice {
    background: #fff8e1; border: 1px solid #f0d68a; padding: .8rem 1rem;
    border-radius: var(--radius); margin-bottom: 1.5rem;
}

/* Hero and categories ----------------------------------------------------- */
.hero { text-align: center; padding: 2rem 0 1rem; }
.hero h1 { font-size: 1.9rem; margin: 0 0 1.25rem; }
.search-form { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.search-form input {
    min-width: min(420px, 80vw); padding: .65rem .9rem;
    border: 1px solid var(--line); border-radius: var(--radius); font: inherit;
}

.category-grid {
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.category-tile {
    position: relative; display: grid; place-items: center; overflow: hidden;
    min-height: 130px; padding: 1rem; text-decoration: none; text-align: center;
    color: #fff; font-weight: 700; font-size: 1.05rem;
    border-radius: var(--radius); box-shadow: var(--shadow);
    background: linear-gradient(135deg, #4b5563, #1f2937);
}
.category-tile span { position: relative; z-index: 1; }
.category-tile:hover { filter: brightness(1.1); }

.category-electronics     { background: linear-gradient(135deg, #2563eb, #1e3a8a); }
.category-clothing        { background: linear-gradient(135deg, #db2777, #831843); }
.category-health-beauty   { background: linear-gradient(135deg, #f59e0b, #b45309); }
.category-jewelry         { background: linear-gradient(135deg, #7c3aed, #4c1d95); }
.category-toys-games      { background: linear-gradient(135deg, #10b981, #065f46); }
.category-automotive      { background: linear-gradient(135deg, #ef4444, #7f1d1d); }
.category-daily-essentials{ background: linear-gradient(135deg, #0891b2, #164e63); }

/* Products ---------------------------------------------------------------- */
.product-grid {
    display: grid; gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.product-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem; display: flex;
    flex-direction: column; gap: .5rem; box-shadow: var(--shadow);
}
.product-card img { height: 190px; object-fit: contain; }
.product-title { font-size: 1rem; margin: 0; }
.product-price { margin: 0; font-weight: 700; color: var(--red); }
.price-was { text-decoration: line-through; color: var(--muted); font-weight: 400; margin-right: .4rem; }
.product-description { font-size: .88rem; color: var(--muted); margin: 0; flex: 1 1 auto; }
.product-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.product-actions .btn { flex: 1 1 auto; }

/* Tables ------------------------------------------------------------------ */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.data-table th, .data-table td {
    padding: .7rem .8rem; border-bottom: 1px solid var(--line);
    text-align: left; font-size: .9rem; white-space: nowrap;
}
.data-table th { background: var(--bg); font-weight: 600; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }

.cart-summary {
    display: flex; align-items: center; gap: .75rem;
    justify-content: flex-end; flex-wrap: wrap; margin-top: 1.25rem;
}
.cart-total { font-size: 1.1rem; margin: 0 auto 0 0; }

/* Forms ------------------------------------------------------------------- */
.auth-card, .form-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.75rem; max-width: 520px; margin: 1rem auto; box-shadow: var(--shadow);
}
.stacked-form { display: flex; flex-direction: column; gap: .4rem; }
.stacked-form label { font-weight: 600; font-size: .9rem; margin-top: .6rem; }
.stacked-form input, .stacked-form select, .stacked-form textarea {
    padding: .6rem .75rem; border: 1px solid var(--line);
    border-radius: var(--radius); font: inherit; width: 100%;
}
.stacked-form small { color: var(--muted); font-size: .8rem; }
.stacked-form button { margin-top: 1rem; }
.stacked-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin-top: 1rem; }
.field-row { display: grid; gap: .75rem; grid-template-columns: 1fr 1fr; }
.auth-alt { text-align: center; margin-top: 1rem; font-size: .9rem; color: var(--muted); }
.avatar { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; margin: 0 auto 1rem; }

.checkout-layout { display: grid; gap: 1.5rem; grid-template-columns: 2fr 1fr; align-items: start; }
.checkout-form {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.5rem;
}
.order-summary {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.25rem;
}
.order-summary ul { list-style: none; padding: 0; margin: 0 0 1rem; }
.order-summary li {
    display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0;
    border-bottom: 1px solid var(--line); font-size: .9rem;
}

/* Confirmation, FAQ, messages ---------------------------------------------- */
.confirmation {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.75rem; max-width: 640px;
}
.summary-list { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1.25rem; }
.summary-list dt { font-weight: 600; color: var(--muted); }
.summary-list dd { margin: 0; }
.summary-items { list-style: none; padding: 0; }
.summary-items li {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .9rem;
}

.faq-list details {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: .6rem;
}
.faq-list summary { cursor: pointer; font-weight: 600; }

.stat-row {
    display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 1.5rem;
}
.stat {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem; text-align: center;
}
.stat-value { display: block; font-size: 1.7rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: .85rem; }

.thread-list { list-style: none; padding: 0; display: grid; gap: .75rem; }
.thread-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem;
}
.thread-meta { margin: 0 0 .35rem; font-size: .9rem; }
.thread-body { margin: 0; }
.thread-date { margin: .35rem 0 0; color: var(--muted); font-size: .8rem; }

.dialog {
    border: 0; border-radius: var(--radius); padding: 1.5rem;
    width: min(520px, 92vw); box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
.dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog-close-form { display: flex; justify-content: flex-end; }
.dialog-close { background: none; border: 0; font-size: 1.5rem; cursor: pointer; line-height: 1; }
.message-thread {
    max-height: 260px; overflow-y: auto; display: flex;
    flex-direction: column; gap: .5rem; margin-bottom: 1rem;
}
.message { padding: .55rem .8rem; border-radius: var(--radius); max-width: 80%; font-size: .9rem; }
.message-mine { background: #dff0d8; align-self: flex-end; }
.message-theirs { background: #f1f2f4; align-self: flex-start; }
.message-form { display: flex; flex-direction: column; gap: .6rem; }
.message-form textarea {
    padding: .6rem .75rem; border: 1px solid var(--line);
    border-radius: var(--radius); font: inherit; min-height: 84px;
}

/* Footer ------------------------------------------------------------------- */
.site-footer {
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 2rem 1.5rem 1rem; margin-top: 3rem;
}
.footer-grid {
    max-width: 1200px; margin: 0 auto; display: grid; gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.footer-grid h4 { margin: 0 0 .5rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid a { text-decoration: none; color: var(--muted); font-size: .9rem; }
.footer-note { text-align: center; color: var(--muted); font-size: .82rem; margin-top: 1.5rem; }

/* Responsive --------------------------------------------------------------- */
@media (max-width: 860px) {
    .checkout-layout { grid-template-columns: 1fr; }
    .site-nav { order: 3; width: 100%; }
}

@media (max-width: 560px) {
    .field-row { grid-template-columns: 1fr; }
    .site-header { padding: .75rem 1rem; }
    .hero h1 { font-size: 1.45rem; }
}
