/* ============================================================
   PC One Stop Shop — storefront styles
   ============================================================ */
:root {
    /* PC One Stop brand palette — dark navy fills, blue links/accents,
       green reserved strictly for stock/live status indicators */
    --bg: #f4f7f9;
    --surface: #ffffff;
    --ink: #0B1F33;
    --ink-lift: #14344F;        /* navy hover / lift, buttons + hero gradient */
    --ink-soft: #6a7075;
    --line: #e4e8ec;
    --primary: #0f8fbf;         /* blue — links/accent text on light backgrounds */
    --primary-dark: #0b7099;
    --primary-tint: #e7f5fb;
    --mint: #8FD6B4;            /* mint — accent on dark navy surfaces only */
    --brand-blue: #0f8fbf;
    --accent: #E8850C;          /* amber — promo/sale badges, matches marketing site */
    --accent-dark: #C36A00;
    --green: #17935b;           /* stock levels / live status only — not links */
    --green-tint: #e4f6ec;
    --amber: #b7791f;
    --amber-tint: #fdf3e2;
    --red: #c1362f;
    --red-tint: #fdeceb;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(20,30,60,.06), 0 6px 20px rgba(20,30,60,.06);
    --shadow-hover: 0 6px 16px rgba(20,30,60,.12), 0 14px 40px rgba(20,30,60,.10);
    --max: 1240px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: var(--font); color: var(--ink);
    background: var(--bg); line-height: 1.5; font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { line-height: 1.2; margin: 0 0 .5em; color: var(--ink); }
.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--ink-soft); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5em;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: .7em 1.2em; font-size: .95rem; font-weight: 600; cursor: pointer;
    background: var(--ink); color: #fff; transition: .15s; text-decoration: none; line-height: 1;
}
.btn:hover { background: var(--ink-lift); text-decoration: none; }
.btn:disabled, .btn.disabled { background: #c3cad8; cursor: not-allowed; pointer-events: none; }
.btn-accent { background: var(--ink); }
.btn-accent:hover { background: var(--ink-lift); }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--line); }
.btn-ghost:hover { background: var(--primary-tint); }
.btn-block { width: 100%; }
.btn-sm { padding: .5em .85em; font-size: .85rem; }
.btn-lg { padding: .9em 1.6em; font-size: 1.05rem; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar { background: var(--ink); color: #cfd6e6; font-size: .8rem; }
.topbar .container { display: flex; justify-content: space-between; align-items: center; height: 34px; }
.topbar a { color: #fff; }
.topbar-promo { display: inline-flex; align-items: center; gap: 6px; }
.topbar-promo .za-flag { height: 12px; width: 18px; border-radius: 2px; flex: none; display: block; }
.header-main { display: flex; align-items: center; gap: 24px; padding: 14px 0; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.3rem; color: var(--ink); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo .logo-img { height: 56px; width: auto; display: block; }
.logo .logo-mark {
    width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--brand-blue)); color: #fff; font-weight: 800; font-size: 1.1rem;
}
.logo .logo-accent { color: var(--brand-blue); }
.search-form { flex: 1; display: flex; max-width: 620px; }
.search-form input {
    flex: 1; border: 1px solid var(--line); border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding: .7em 1em; font-size: .95rem; outline: none;
}
.search-form input:focus { border-color: var(--primary); }
.search-form button {
    border: none; background: var(--ink); color: #fff; padding: 0 1.2em;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0; cursor: pointer; font-weight: 600;
}
.search-form button:hover { background: var(--ink-lift); }
.header-actions { display: flex; align-items: center; gap: 18px; }
.cart-link { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; position: relative; }
.cart-link:hover { text-decoration: none; color: var(--primary); }
.cart-badge {
    background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700;
    min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px;
}

/* ---------- Category nav ---------- */
.catnav { background: var(--surface); border-bottom: 1px solid var(--line); }
.catnav .container { display: flex; gap: 6px; overflow-x: auto; }
.catnav a {
    padding: 12px 14px; color: var(--ink-soft); font-weight: 600; font-size: .88rem;
    white-space: nowrap; border-bottom: 2px solid transparent;
}
.catnav a:hover, .catnav a.active { color: var(--primary); border-bottom-color: var(--primary); text-decoration: none; }

/* ---------- Layout ---------- */
.page { padding: 24px 0 48px; }
.breadcrumb { font-size: .85rem; color: var(--ink-soft); margin-bottom: 16px; }
.breadcrumb a { color: var(--ink-soft); }
.shop-layout { display: grid; grid-template-columns: 250px 1fr; gap: 26px; }
@media (max-width: 900px) { .shop-layout { grid-template-columns: 1fr; } }

.sidebar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 0; align-self: start; overflow: hidden; }
.sidebar h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); padding: 14px 18px 6px; margin: 0; }

/* Collapsible categories on mobile only (desktop always shows the list). */
@media (max-width: 900px) {
    .sidebar { margin-bottom: 4px; }
    .cat-toggle { cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; user-select: none; }
    .cat-toggle::after { content: "▾"; font-size: 1rem; transition: transform .18s; }
    .sidebar.cats-open .cat-toggle::after { transform: rotate(180deg); }
    .sidebar .cat-list { display: none; padding-bottom: 6px; }
    .sidebar.cats-open .cat-list { display: block; }
}
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list a { display: flex; justify-content: space-between; padding: 8px 18px; color: var(--ink); font-size: .9rem; }
.cat-list a:hover { background: var(--primary-tint); text-decoration: none; }
.cat-list a.active { background: var(--primary-tint); color: var(--primary); font-weight: 700; }
.cat-list .count { color: var(--ink-soft); font-size: .78rem; }
.cat-list .sub a { padding-left: 32px; font-size: .85rem; color: var(--ink-soft); }

/* ---------- Product grid ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.toolbar h1 { font-size: 1.5rem; margin: 0; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; display: flex; flex-direction: column; transition: .18s; position: relative;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.card .thumb { aspect-ratio: 1/1; background: #fff; display: grid; place-items: center; padding: 14px; border-bottom: 1px solid var(--line); }
.card .thumb img { max-height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.card .brand { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); font-weight: 700; margin-bottom: 3px; }
.card .title { font-size: .9rem; font-weight: 600; color: var(--ink); margin: 0 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.card .title a { color: inherit; }
.card .title a:hover { color: var(--primary); }
.card .price-row { margin-top: auto; }
.card .price { font-size: 1.15rem; font-weight: 800; color: var(--ink); }
.card .rrp { font-size: .8rem; color: var(--ink-soft); text-decoration: line-through; margin-left: 6px; }
.card .save { font-size: .72rem; color: var(--green); font-weight: 700; }
.card .card-foot { margin-top: 10px; display: flex; gap: 8px; align-items: center; }
.card .card-foot .btn { flex: 1; }

/* ---------- Stock badges ---------- */
.stock { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.stock::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stock-in { color: var(--green); background: var(--green-tint); }
.stock-low { color: var(--amber); background: var(--amber-tint); }
.stock-back { color: var(--ink-soft); background: #EEF1F5; }
.stock-out { color: var(--red); background: var(--red-tint); }
.card-badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; gap: 6px; z-index: 2; pointer-events: none; }
.badge-promo { background: var(--mint); color: var(--ink); font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.badge-onpromo { background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.card-promo { outline: 2px solid var(--accent); outline-offset: -2px; }
.pd-promo { display: inline-block; background: var(--accent); color: #fff; font-weight: 700; font-size: .8rem; padding: 4px 10px; border-radius: 6px; margin-bottom: 10px; }

/* ---------- Product detail ---------- */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
@media (max-width: 800px) { .product-detail { grid-template-columns: 1fr; } }
.gallery .main-img { aspect-ratio: 1/1; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: grid; place-items: center; padding: 20px; }
.gallery .main-img img { max-height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.gallery .thumbs { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.gallery .thumbs img { width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; padding: 4px; cursor: pointer; background: #fff; }
.gallery .thumbs img.active { border-color: var(--primary); }
.pd-brand { color: var(--primary); font-weight: 700; text-transform: uppercase; font-size: .8rem; letter-spacing: .04em; }
.pd-title { font-size: 1.6rem; margin: 4px 0 10px; }
.pd-sku { color: var(--ink-soft); font-size: .82rem; margin-bottom: 14px; }
.pd-price { font-size: 2rem; font-weight: 800; }
.pd-rrp { font-size: 1rem; color: var(--ink-soft); text-decoration: line-through; margin-left: 8px; font-weight: 500; }
.pd-vat { font-size: .8rem; color: var(--ink-soft); }
.pd-save { display: inline-block; margin-left: 8px; color: var(--green); font-weight: 700; font-size: .9rem; }
.pd-buy { display: flex; gap: 12px; align-items: center; margin: 20px 0; }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.qty button { border: none; background: #f2f5fb; width: 38px; height: 44px; font-size: 1.2rem; cursor: pointer; color: var(--ink); }
.qty input { width: 48px; height: 44px; border: none; text-align: center; font-size: 1rem; font-weight: 600; }
.pd-meta { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; font-size: .88rem; }
.pd-meta div { display: flex; gap: 8px; padding: 4px 0; }
.pd-meta .lbl { color: var(--ink-soft); min-width: 120px; }
.pd-desc { margin-top: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; }
.pd-desc h2 { font-size: 1.15rem; }
.pd-desc ul { padding-left: 20px; }
.pd-desc img { margin: 10px 0; }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(120deg, var(--ink), var(--ink-lift)); color: #fff; border-radius: 16px; padding: 44px 44px; margin-bottom: 28px; position: relative; overflow: hidden; }
.hero h1 { color: #fff; font-size: 2rem; max-width: 560px; position: relative; z-index: 2; }
.hero p { color: #B9C9D8; max-width: 520px; font-size: 1.05rem; position: relative; z-index: 2; }
.hero .btn { margin-top: 12px; position: relative; z-index: 2; }
.hero .btn-accent { background: #fff; color: var(--ink); }
.hero .btn-accent:hover { background: var(--mint); color: var(--ink); }
.hero .trust-row { position: relative; z-index: 2; }
.hero .trust-row .item { color: #B9C9D8; }
.hero-robot { position: absolute; right: 8px; bottom: -8px; width: 300px; max-width: 40%; pointer-events: none; filter: drop-shadow(0 10px 24px rgba(0,0,0,.25)); z-index: 1; }
@media (max-width: 860px) { .hero-robot { display: none; } }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 32px 0 16px; }
.section-head h2 { font-size: 1.4rem; margin: 0; }

/* Category tiles with real product imagery */
.cat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.cat-tile {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; display: flex; flex-direction: column; transition: .18s; text-decoration: none;
}
.cat-tile:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); text-decoration: none; }
.cat-tile-img {
    aspect-ratio: 16/10; background: #fff; display: grid; place-items: center; padding: 16px;
    border-bottom: 1px solid var(--line); position: relative;
}
.cat-tile-img img { max-height: 100%; max-width: 100%; object-fit: contain; mix-blend-mode: multiply; }
.cat-tile-img .cat-emoji { font-size: 2.4rem; }
.cat-tile-body { padding: 12px 14px; text-align: center; }
.cat-tile-body h3 { font-size: .92rem; margin: 0 0 3px; color: var(--ink); }
.cat-tile:hover .cat-tile-body h3 { color: var(--primary); }
.cat-tile-body .muted { font-size: .78rem; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.pagination a { padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: .9rem; }
.pagination a:hover { border-color: var(--primary); text-decoration: none; }
.pagination a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .dots { padding: 8px 4px; color: var(--ink-soft); }

/* ---------- Cart ---------- */
.cart-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cart-table th { text-align: left; padding: 12px 16px; font-size: .78rem; text-transform: uppercase; color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.cart-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cart-table tr:last-child td { border-bottom: none; }
.cart-prod { display: flex; gap: 12px; align-items: center; }
.cart-prod img { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 4px; flex-shrink: 0; }
.cart-prod .name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
@media (max-width: 640px) {
    .cart-table th, .cart-table td { padding: 10px 8px; }
    .cart-table td:first-child { min-width: 210px; }
    .cart-prod { gap: 8px; }
    .cart-prod img { width: 44px; height: 44px; }
    .cart-prod .name { font-size: .85rem; }
}
.cart-summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; align-self: start; }
.cart-summary .row { display: flex; justify-content: space-between; padding: 7px 0; }
.cart-summary .total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; font-size: 1.3rem; font-weight: 800; }
.cart-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.cart-grid > * { min-width: 0; }
@media (max-width: 850px) { .cart-grid { grid-template-columns: 1fr; } }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid > .field { min-width: 0; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink); }
.field input, .field select, .field textarea {
    border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7em .9em; font-size: .95rem; font-family: inherit; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.panel h2 { font-size: 1.15rem; }

/* ---------- Flash / alerts ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 600; font-size: .9rem; }
.flash-info { background: #EAF0F6; color: var(--ink-lift); }
.flash-success { background: var(--green-tint); color: var(--green); }
.flash-error { background: var(--red-tint); color: var(--red); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 60px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.empty svg { width: 64px; height: 64px; opacity: .4; margin-bottom: 12px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #aab3c8; margin-top: 40px; padding: 40px 0 24px; font-size: .9rem; }
.site-footer a { color: #cdd5e6; }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; }
@media (max-width: 750px) { .footer-cols { grid-template-columns: 1fr 1fr; } }
.site-footer h4 { color: #fff; font-size: .95rem; margin-bottom: 12px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 4px 0; }
.footer-bottom { border-top: 1px solid #2a3550; margin-top: 28px; padding-top: 18px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: .82rem; }

/* ---------- Misc ---------- */
.trust-row { display: flex; gap: 24px; flex-wrap: wrap; margin: 8px 0 0; }
.trust-row .item { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-soft); }
.notice { background: var(--amber-tint); color: var(--amber); padding: 10px 14px; border-radius: 8px; font-size: .85rem; font-weight: 600; }

/* ---------- Mobile top bar fix ---------- */
@media (max-width: 640px) {
    .topbar { font-size: .74rem; }
    .topbar .container {
        flex-direction: column; height: auto; gap: 1px;
        padding-top: 5px; padding-bottom: 5px; text-align: center;
    }
    .topbar .container span { line-height: 1.35; }
}

/* ---------- Mobile header fix (prevent horizontal overflow) ---------- */
body { overflow-x: clip; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
    .header-main { flex-wrap: wrap; gap: 12px; padding: 10px 20px; }
    .logo .logo-img { height: 44px; width: auto; }
    .search-form { order: 3; flex-basis: 100%; max-width: none; }
    .header-actions { margin-left: auto; }
}
