/* Old Richmond Cellars wholesale portal — theme matched to oldrichmondcellars.com
   (white surfaces, charcoal ink, gold primary buttons, red-bottle accent, Roboto). */
:root {
  --ink: #282828;          /* primary text / dark UI (matches site #282828) */
  --ink-soft: #505050;     /* secondary text */
  --muted: #8a8a8a;        /* hints / disabled */
  --border: #dcdcdc;       /* hairline borders (site border colour) */
  --bg: #ffffff;           /* page background (site is white) */
  --surface-alt: #f2f2f2;  /* light panels / table headers */
  --gold: #ffc34b;         /* primary action (site button--primary) */
  --gold-dark: #ffa700;    /* primary hover (site button--primary:hover) */
  --bottle: #d9472b;       /* red-orange bottle accent from the logo */
  --bottle-dark: #b8351c;
  --green: #2e7d32;
  --red: #c0392b;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Roboto, Arial, Helvetica, sans-serif; background: var(--bg); color: var(--ink); }
.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }

/* Header — white bar with charcoal text + gold underline, like the live site. */
.site-header { background: #fff; color: var(--ink); border-bottom: 1px solid var(--border); box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.site-header.admin-header { border-bottom: 3px solid var(--gold); }
.header-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.15rem; font-weight: 700; letter-spacing: .02em; }
.brand img { height: 44px; width: 44px; display: block; }
.brand span { font-weight: 400; color: var(--ink-soft); font-size: .9rem; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.site-header nav a {
  display: inline-block; color: var(--ink); text-decoration: none;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; font-size: .84rem; line-height: 1.4; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.site-header nav a:hover { background: var(--gold); border-color: var(--gold-dark); color: var(--ink); text-decoration: none; }
.site-header.admin-header nav a:hover { background: var(--gold); border-color: var(--gold-dark); }

h1, h2, h3 { color: var(--ink); font-weight: 700; }
h1 { letter-spacing: .01em; }

.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; }
.alert-success { background: #e6f4ea; color: var(--green); border: 1px solid #b7dfc1; }
.alert-error { background: #fdeaec; color: var(--red); border: 1px solid #f1b6bd; }
.alert-info { background: #fff7e6; color: #8a5a00; border: 1px solid #ffe2a6; }

table { width: 100%; border-collapse: collapse; background: #fff; }
table th, table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: .92rem; }
table th { background: var(--surface-alt); color: var(--ink); font-weight: 700; }

/* Buttons — gold primary (dark text), light bordered secondary, solid red danger. */
.btn { display: inline-block; background: var(--gold); color: var(--ink); padding: 9px 18px; border: none; border-radius: 4px; cursor: pointer; text-decoration: none; font-size: .92rem; font-weight: 700; line-height: 1.2; }
.btn:hover { background: var(--gold-dark); color: var(--ink); }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-alt); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; border: none; }
.btn-danger:hover { background: #a83227; color: #fff; }
.btn-sm { padding: 5px 11px; font-size: .82rem; }
form.inline { display: inline; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 4px; margin-bottom: 12px; font-size: .95rem; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-dark); box-shadow: 0 0 0 2px rgba(255,195,75,.35); }
label { font-weight: 600; font-size: .88rem; display: block; margin-bottom: 4px; color: var(--ink); }

.card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 20px; margin-bottom: 20px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.product-card img, .product-thumb { width: 100%; height: 150px; object-fit: contain; border-radius: 4px; background: #fff; border: 1px solid var(--border); cursor: zoom-in; }
.product-card h3 { font-size: 1rem; margin: 10px 0 4px; }
.promo-tag {
  position: absolute; top: 6px; left: 6px; background: var(--bottle); color: #fff;
  font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 3px; text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.price { font-weight: 700; color: var(--ink); }
.muted { color: var(--muted); font-size: .85rem; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 180px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: .75rem; font-weight: 600; }
.badge-pending { background: #fff3cd; color: #8a6500; }
.badge-confirmed { background: #d6eaff; color: #0b5394; }
.badge-packed { background: #e3d6ff; color: #4b2d8a; }
.badge-shipped { background: #d0f0e0; color: #146c43; }
.badge-completed { background: #d6f5d6; color: #1a7a1a; }
.badge-cancelled { background: #fde0e0; color: #b00020; }
.badge-quote_requested { background: #ffe9c2; color: #8a5a00; }
.site-footer { text-align: center; padding: 24px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); margin-top: 20px; }

/* Hero — dark charcoal band with gold accent, default when no banner image is set. */
.hero-banner {
  background: linear-gradient(135deg, #282828, #000);
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  margin-bottom: 24px;
  color: #fff;
  overflow: hidden;
  border-bottom: 4px solid var(--gold);
}
.hero-banner-overlay {
  background: rgba(0,0,0,0.45);
  padding: 50px 30px;
  text-align: center;
}
.hero-banner h1 { color: #fff; margin: 0 0 8px; font-size: 2rem; }
.hero-banner p { margin: 0; font-size: 1.1rem; color: #f3f3f3; }

.step-circle {
  width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem;
  margin-bottom: 10px;
}
.faq-item { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { margin: 0 0 6px; }

.lightbox-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  z-index: 1000; align-items: center; justify-content: center; flex-direction: column; cursor: zoom-out;
}
.lightbox-overlay img { max-width: 90vw; max-height: 80vh; border-radius: 6px; object-fit: contain; background: #fff; }
.lightbox-overlay p { color: #fff; margin-top: 14px; font-size: 1rem; }
.lightbox-close { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 2.2rem; cursor: pointer; line-height: 1; }

/* Horizontal-scroll wrapper for wide data tables on small screens. */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Hamburger button — hidden on desktop, shown on mobile. */
.nav-toggle {
  display: none; background: transparent; color: var(--ink); border: 1px solid var(--border);
  border-radius: 4px; font-size: 1.4rem; line-height: 1; padding: 4px 12px; cursor: pointer;
}

/* ---- Mobile / responsive ---- */
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; padding: 10px 14px; }
  .brand { font-size: 1rem; }
  .brand img { height: 38px; width: 38px; }
  .nav-toggle { display: block; margin-left: auto; }
  .site-header nav {
    display: none; flex-basis: 100%; width: 100%; flex-direction: column; align-items: stretch;
    gap: 6px; margin-top: 10px; padding-top: 8px;
  }
  .site-header.nav-open nav { display: flex; }
  .site-header nav a { text-align: center; padding: 11px; font-size: .95rem; }

  .container { padding: 16px 12px 48px; }

  /* Wide tables scroll horizontally instead of breaking the layout. */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  table th, table td { padding: 9px 10px; }

  /* Stack the search/filter rows. */
  .form-row { flex-direction: column; gap: 8px; }
  .form-row > div { min-width: 0; width: 100%; }

  /* Roomier tap targets. */
  .btn { padding: 11px 16px; }
  .btn-sm { padding: 7px 12px; font-size: .85rem; }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=file], select, textarea { font-size: 16px; }

  .hero-banner-overlay { padding: 34px 18px; }
  .hero-banner h1 { font-size: 1.5rem; }
  .hero-banner p { font-size: 1rem; }

  .card { padding: 16px; }
  .grid-3 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .product-card img, .product-thumb { height: 130px; }
}

@media (max-width: 420px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .site-header nav a { font-size: 1rem; }
}

/* ---- Proof of delivery / delivery run ---- */
.badge-delivered { background:#2e7d32; color:#fff; }
.btn-block { display:block; width:100%; text-align:center; margin-top:10px; }
.delivery-list { display:flex; flex-direction:column; gap:12px; }
.delivery-card-head { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.sig-wrap { border:2px dashed var(--border,#dcdcdc); border-radius:8px; background:#fff; }
.sig-canvas { display:block; width:100%; height:200px; touch-action:none; border-radius:8px; }
.pod-proof { display:flex; flex-wrap:wrap; gap:14px; margin-top:12px; }
.pod-thumb { margin:0; width:160px; }
.pod-thumb img { width:100%; height:auto; border:1px solid var(--border,#dcdcdc); border-radius:6px; background:#fff; display:block; }
.pod-thumb figcaption { font-size:.8rem; margin-top:4px; text-align:center; }

/* ---- POD v2: receipt toggle + photo remove ---- */
.receipt-toggle { display:flex; gap:10px; margin-top:6px; }
.receipt-toggle .pill { display:inline-flex; align-items:center; gap:6px; padding:8px 14px; border:1px solid var(--border,#dcdcdc); border-radius:20px; cursor:pointer; font-weight:500; }
.receipt-toggle .pill input { width:auto; margin:0; }
.pod-thumb .linklike { background:none; border:none; color:var(--bottle,#d9472b); cursor:pointer; font-size:.8rem; padding:0 0 0 6px; }

/* ---- Mobile: turn wide data tables into stacked cards (opt-in via .stack-mobile) ----
   Beats sideways scrolling on a phone: each row becomes a card and every value is
   labelled with its column heading (labels are filled in by assets/js/mobile-tables.js). */
@media (max-width: 760px) {
  table.stack-mobile { display: block; overflow-x: visible; white-space: normal; border: 0; }
  /* Browsers auto-insert a <tbody>; leaving it as a table-row-group makes the rows
     shrink-wrap instead of filling the width, so it has to become a block too. */
  table.stack-mobile thead, table.stack-mobile tbody { display: block; width: 100%; }
  table.stack-mobile tr.is-head { display: none; }          /* column headings become per-cell labels */
  table.stack-mobile tr {
    display: block; width: 100%; box-sizing: border-box;   /* fill the width, don't shrink to content */
    background: #fff; border: 1px solid var(--border, #dcdcdc);
    border-radius: 8px; margin-bottom: 10px; padding: 4px 12px;
  }
  table.stack-mobile td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    border: 0; border-bottom: 1px solid #f0eeea; padding: 9px 0; text-align: right;
    white-space: normal;
  }
  table.stack-mobile tr td:last-child { border-bottom: 0; }
  table.stack-mobile td::before {
    content: attr(data-label);
    font-weight: 600; color: #6b6b6b; text-align: left; flex: 0 0 42%;
  }
  /* Cells with no heading (action buttons) get the full width, left aligned. */
  table.stack-mobile td[data-label=""] { justify-content: flex-start; text-align: left; }
  table.stack-mobile td[data-label=""]::before { display: none; }
  table.stack-mobile td:empty { display: none; }
  table.stack-mobile td .btn { margin: 2px 4px 2px 0; }
}
