/* =====================================================================
   Dehydrated Fruit Store — shared styles (storefront + admin)
   Warm, natural palette. Mobile-first, responsive.
   ===================================================================== */

:root {
  --bg:        #fbf7f0;
  --surface:   #ffffff;
  --ink:       #2e2a26;
  --muted:     #7d756c;
  --line:      #e9e1d6;
  --brand:     #c4622d;   /* dried-apricot orange */
  --brand-dark:#a44d20;
  --accent:    #6f8f4f;   /* leaf green */
  --danger:    #b3401f;
  --ok:        #3f7d3f;
  --shadow:    0 6px 24px rgba(70, 50, 30, 0.10);
  --radius:    14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--brand-dark); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 10px; padding: 11px 18px;
  font-size: 15px; font-weight: 600; background: var(--brand); color: #fff;
  transition: background .15s ease, transform .05s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: #cbc2b6; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f3ece2; }
.btn.green { background: var(--accent); }
.btn.green:hover { background: #5d7a40; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn.danger:hover { background: #fbeee9; }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(251,247,240,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 22px; margin: 0; letter-spacing: .2px; }
.brand .tag { color: var(--muted); font-size: 13px; }
.cart-btn {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 14px; font-weight: 600; color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.cart-btn .count {
  position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px;
  padding: 0 5px; border-radius: 10px; background: var(--brand); color: #fff;
  font-size: 12px; line-height: 20px; text-align: center; font-weight: 700;
}

/* ---------- hero ---------- */
.hero { padding: 40px 0 8px; text-align: center; }
.hero h2 { font-size: 30px; margin: 0 0 6px; }
.hero p { color: var(--muted); margin: 0; }

/* ---------- product grid ---------- */
.grid {
  display: grid; gap: 22px; padding: 28px 0 60px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.card .photo {
  aspect-ratio: 4 / 3; background: #f0e8db center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: #b9ad9c;
  font-size: 13px;
}
.card .body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 18px; }
.card .desc { color: var(--muted); font-size: 14px; margin: 0; flex: 1; }
.card .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-size: 19px; font-weight: 700; }
.stock {
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px;
}
.stock.in    { background: #eaf3e2; color: var(--ok); }
.stock.low   { background: #fdf0dd; color: #a4710f; }
.stock.out   { background: #f7e6e1; color: var(--danger); }

.qty {
  display: flex; align-items: center; border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden;
}
.qty button { background: #f3ece2; border: 0; width: 34px; height: 36px; font-size: 18px; color: var(--ink); }
.qty button:disabled { color: #c7bdb0; cursor: not-allowed; }
.qty span { min-width: 34px; text-align: center; font-weight: 600; }

/* ---------- cart drawer ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(40,30,20,.45);
  opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 40;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 400px; max-width: 92vw;
  background: var(--bg); box-shadow: -8px 0 30px rgba(50,30,10,.18);
  transform: translateX(100%); transition: transform .25s ease; z-index: 50;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.drawer header h3 { margin: 0; font-size: 19px; }
.x { background: none; border: 0; font-size: 24px; color: var(--muted); line-height: 1; }
.drawer .items { flex: 1; overflow-y: auto; padding: 8px 20px; }
.line {
  display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.line .thumb { width: 56px; height: 56px; border-radius: 8px; background: #efe7da center/cover; flex: none; }
.line .info { flex: 1; min-width: 0; }
.line .info h4 { margin: 0 0 2px; font-size: 15px; }
.line .info small { color: var(--muted); }
.line .remove { background: none; border: 0; color: var(--danger); font-size: 13px; padding: 2px 0; }
.drawer footer { padding: 18px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.totals { font-size: 14px; color: var(--muted); }
.totals .grand { display: flex; justify-content: space-between; color: var(--ink); font-size: 18px; font-weight: 700; margin-top: 6px; }
.totals .lineitem { display: flex; justify-content: space-between; }
.empty-cart { text-align: center; color: var(--muted); padding: 50px 20px; }

/* ---------- forms / modal ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: var(--surface); color: var(--ink);
}
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--brand);
}
.modal {
  position: fixed; inset: 0; z-index: 60; display: none;
  align-items: flex-start; justify-content: center; padding: 30px 16px; overflow-y: auto;
  background: rgba(40,30,20,.5);
}
.modal.open { display: flex; }
.modal .panel {
  background: var(--bg); border-radius: var(--radius); width: 480px; max-width: 100%;
  box-shadow: var(--shadow); padding: 24px;
}
.modal .panel h3 { margin: 0 0 16px; }

.note { font-size: 13px; padding: 10px 14px; border-radius: 10px; margin: 10px 0; }
.note.err { background: #f8e5df; color: var(--danger); }
.note.ok  { background: #e7f1de; color: var(--ok); }
.note.info{ background: #fdf3e3; color: #8a6515; }

.center-msg { text-align: center; color: var(--muted); padding: 70px 20px; }
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer.site-footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: 13px; text-align: center; }
