/* DropBearExpress styles. Plain CSS, no build step. */

:root {
    --bg: #faf7f2;
    --surface: #ffffff;
    --ink: #1f2a24;
    --muted: #66716a;
    --green: #1f5c3f;
    --green-dark: #164530;
    --gold: #e0a526;
    --border: #e4ddd0;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--green); }
img { max-width: 100%; display: block; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.2rem; margin: 0 0 .5rem; }
.lead { color: var(--muted); margin: 0 0 1.25rem; }
.empty { color: var(--muted); }

/* Buttons */
.btn {
    display: inline-block;
    padding: .5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--green);
    background: var(--green);
    color: #fff;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}
.btn:hover { background: var(--green-dark); }
.btn-ghost { background: transparent; color: var(--green); }
.btn-ghost:hover { background: #eef4f0; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #2b2100; font-weight: 600; padding: .7rem 1.5rem; }
.btn-primary:hover { background: #cf961c; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Header: search left, title centre, account right */
.site-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.search { display: flex; gap: .5rem; max-width: 360px; }
.search input {
    flex: 1;
    min-width: 0;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
}
.search button {
    padding: .5rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    font: inherit;
    cursor: pointer;
}
.brand {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: .02em;
    color: var(--green);
    text-decoration: none;
    text-align: center;
}
.account { display: flex; gap: .5rem; justify-content: flex-end; }

/* Page layout */
.page { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; }
.page.has-sidebar {
    max-width: 1280px;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 1.5rem;
}

/* Sidebar */
.sidebar h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: .35rem .5rem; border-radius: 6px; color: var(--ink); text-decoration: none; }
.sidebar a:hover { background: #eef4f0; }
.sidebar a.current { background: var(--green); color: #fff; }
.sidebar .sub { margin: .1rem 0 .4rem 1rem; }
.sidebar .sub a { font-size: .95rem; color: var(--muted); }
.sidebar .sub a.current { color: #fff; }

/* Product grid and cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .6rem;
}
.card:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.card-link { color: inherit; text-decoration: none; display: block; }
.card-img, .gallery-main {
    aspect-ratio: 1 / 1;
    background: #eef4f0;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-img img, .gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.ph { font-size: 3rem; font-weight: 700; color: var(--green); opacity: .5; }
.card-title {
    font-size: .95rem;
    font-weight: 500;
    margin: .5rem 0 .25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.9em;
}
.price { font-weight: 700; margin: 0; }
.meta { font-size: .8rem; color: var(--muted); margin: .25rem 0 0; }
.meta.store { margin-top: 0; }

/* Pagination and breadcrumb */
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin: 1.5rem 0; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }
.breadcrumb a { color: var(--muted); }

/* Item page */
.product { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2rem; }
.thumbs { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.thumbs button {
    width: 64px; height: 64px; padding: 0;
    border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: none; cursor: pointer;
}
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.buybox label { display: block; font-size: .85rem; color: var(--muted); margin-top: 1rem; }
.buybox select { padding: .5rem; font: inherit; border: 1px solid var(--border); border-radius: var(--radius); min-width: 12rem; }
.price-large { font-size: 1.8rem; margin: .5rem 0; }
.price-large small { font-size: .9rem; font-weight: 400; color: var(--muted); }
.stock { font-weight: 600; margin: 1rem 0 .5rem; }
.stock.in { color: var(--green); }
.stock.out { color: #a33; }
.note { font-size: .85rem; color: var(--muted); }
.facts { list-style: none; padding: 0; margin: 1.25rem 0 0; border-top: 1px solid var(--border); }
.facts li { padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .95rem; }
.detail { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.specs { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1.5rem; margin: 0; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; }
.review { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.review p { margin: 0; }

.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 2rem 1rem; }

/* Tablet and phone */
@media (max-width: 800px) {
    .product { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .site-header {
        grid-template-columns: 1fr auto;
        grid-template-areas: "brand account" "search search";
    }
    .brand { grid-area: brand; text-align: left; }
    .account { grid-area: account; }
    .search { grid-area: search; max-width: none; }

    .page.has-sidebar { grid-template-columns: 1fr; }
    /* Categories become a scrolling row of chips */
    .sidebar h2 { display: none; }
    .sidebar > ul { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; }
    .sidebar > ul > li { flex: none; }
    .sidebar a { border: 1px solid var(--border); background: var(--surface); white-space: nowrap; }
    .sidebar .sub { display: none; }
}

@media (max-width: 560px) {
    .grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
}

/* ---- Accounts, cart and checkout ---- */

.account { flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; margin: 0; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* Messages */
.notice {
    margin: 0 0 1rem;
    padding: .7rem 1rem;
    border-radius: var(--radius);
    background: #eef4f0;
    border: 1px solid #cfe0d5;
}
.notice.success { background: #e7f5ec; border-color: #b9dfc6; }
.notice.error { background: #fbeaea; border-color: #edc0c0; color: #7a1f1f; }
.problem { color: #a33; font-weight: 600; }
.form-errors {
    margin: 0 0 1rem;
    padding: .7rem 1rem .7rem 2rem;
    background: #fbeaea;
    border: 1px solid #edc0c0;
    border-radius: var(--radius);
    color: #7a1f1f;
}

/* Forms */
.form-page { max-width: 420px; margin: 0 auto; }
.form label { display: block; margin: .9rem 0 .25rem; font-size: .9rem; font-weight: 600; }
.form label small { font-weight: 400; color: var(--muted); }
.form input[type=text], .form input[type=email], .form input[type=password],
.form input[type=tel], .form select {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    background: var(--surface);
}
.form input:focus, .form select:focus, .search input:focus {
    outline: 2px solid var(--gold);
    outline-offset: 1px;
}
.form .btn { margin-top: 1.25rem; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.btn-block { display: block; text-align: center; width: 100%; }

/* Item page add-to-cart */
.add-form .qty-input {
    width: 5rem;
    padding: .5rem;
    font: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.add-form label { margin-top: 1rem; }

/* Cart, checkout and order pages */
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2rem; align-items: start; }
.cart-store { margin-bottom: 1.5rem; }
.cart-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); }
.cart-table th, .cart-table td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.cart-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cart-table input[type=number] { width: 4.5rem; padding: .35rem; font: inherit; border: 1px solid var(--border); border-radius: 6px; }
.cart-table tr.has-problem { background: #fdf3f3; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--green); text-decoration: underline; cursor: pointer; }
.shipping-line { margin: .5rem 0 0; }
.summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.summary h2 { margin-bottom: .75rem; }
.summary dl { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem; margin: 0 0 1rem; }
.summary dd { margin: 0; text-align: right; }
.summary .total { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--border); padding-top: .4rem; }
.summary-store { font-size: .95rem; margin: .75rem 0 .25rem; }
.summary-lines { list-style: none; margin: 0 0 .5rem; padding: 0; font-size: .9rem; }
.summary-lines li { display: flex; justify-content: space-between; gap: 1rem; padding: .15rem 0; }
address { font-style: normal; line-height: 1.6; }

@media (max-width: 800px) {
    .cart-layout { grid-template-columns: 1fr; }
    .cart-table { font-size: .9rem; }
    .cart-table th, .cart-table td { padding: .5rem; }
}

/* ---- Seller portal and admin ---- */

.form-page.wide { max-width: 720px; }
.form textarea {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    background: var(--surface);
    resize: vertical;
}
.form input[type=number], .form input[type=file] {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    background: var(--surface);
}
.form input[type=file] { padding: .4rem; }
.form textarea:focus, .form input[type=number]:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.form .row.three { grid-template-columns: repeat(3, 1fr); }
.form label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin-top: 1rem; }
.form label.check input { width: auto; }

.sell-nav, .subtabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.sell-nav a, .subtabs a {
    padding: .5rem .9rem;
    text-decoration: none;
    color: var(--muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}
.sell-nav a:hover, .subtabs a:hover { color: var(--ink); }
.sell-nav a.current, .subtabs a.current { color: var(--green); border-bottom-color: var(--gold); font-weight: 600; }
.subtabs { margin-top: .5rem; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.page-head h1, .page-head h2 { margin: 0; }

.badge {
    display: inline-block;
    padding: .1rem .55rem;
    border-radius: 999px;
    font-size: .8rem;
    background: #eee;
    color: #444;
}
.badge-active, .badge-shipped, .badge-delivered { background: #e0f2e6; color: #1c5a35; }
.badge-pending, .badge-draft { background: #fdf0d2; color: #7a5300; }
.badge-hidden, .badge-suspended, .badge-cancelled { background: #f3dcdc; color: #7a1f1f; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin: 1rem 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: inherit; }
a.stat:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.stat-number { display: block; font-size: 1.8rem; font-weight: 700; color: var(--green); }
.stat-label { color: var(--muted); font-size: .9rem; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.order-card .cart-layout { margin-top: .5rem; }
.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1.5rem; align-items: start; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.photo { margin: 0; text-align: center; font-size: .85rem; }
.photo img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; }
.photo figcaption { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-top: .25rem; }
.link-button.danger { color: #a33; }

.variants input[type=text], .variants input[type=number] {
    width: 100%; min-width: 4rem; padding: .35rem; font: inherit; border: 1px solid var(--border); border-radius: 6px;
}
.variants td { padding: .35rem; }
.variants .new-row { background: #faf7f2; }

.thumb-cell { width: 56px; }
.thumb-cell img, .thumb-ph { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
.thumb-ph { display: flex; align-items: center; justify-content: center; background: #eef4f0; color: var(--green); font-weight: 700; }

.checklist { padding-left: 1.2rem; }
.checklist li { margin: .3rem 0; }

@media (max-width: 900px) {
    .edit-layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .form .row.three { grid-template-columns: 1fr; }
}

/* ---- Sign in extras ---- */
.or-divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0 1rem; color: var(--muted); font-size: .85rem; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.btn-google { background: #fff; color: #1f1f1f; border-color: #c9c9c9; text-align: center; }
.btn-google:hover { background: #f4f4f4; }
.form .note { margin-top: 1rem; }

/* ---- Installable app ---- */
[hidden] { display: none !important; }
/* When launched from the home screen there is no browser bar, so leave room for the phone's notch and gesture bar */
@media (display-mode: standalone) {
    body { padding-bottom: env(safe-area-inset-bottom); }
    .site-header { padding-top: calc(.75rem + env(safe-area-inset-top)); }
}
