/* ============================================================
   Bhimas admin dashboard
   ============================================================ */
:root {
  --bg:      #0c0c0b;
  --panel:   #151412;
  --panel-2: #1c1a16;
  --line:    rgba(255, 255, 255, 0.08);
  --line-2:  rgba(200, 162, 77, 0.22);
  --gold:    #c9a24d;
  --gold-soft:#dcc084;
  --text:    #efe9dd;
  --muted:   #8d857a;
  --green:   #4c9c6e;
  --red:     #cf5b50;
  --radius:  6px;
  --ease:    cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 300;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: "Playfair Display", Georgia, serif; font-weight: 500; letter-spacing: -0.4px; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.layout { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

/* ---- sidebar ---- */
.side {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.side .brand { padding: 6px 10px 18px; }
.side .brand img { height: 40px; }
.side .brand span { display: block; font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.side .group { font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 6px; }
.side a.nav {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: #cfc7b8;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.side a.nav:hover { background: var(--panel-2); color: var(--text); }
.side a.nav.active { background: rgba(201, 162, 77, 0.14); color: var(--gold-soft); }
.side .spacer { flex: 1; }

/* ---- main ---- */
.main { padding: 26px clamp(18px, 3vw, 40px) 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.topbar h1 { font-size: 1.7rem; }
.crumbs { font-size: 0.78rem; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: var(--gold); color: #1a1305;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  font-family: "Outfit", sans-serif; font-weight: 500;
  font-size: 0.8rem; letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -12px rgba(201, 162, 77, 0.6); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--gold); box-shadow: none; }
.btn--danger { background: transparent; color: var(--red); border-color: rgba(207, 91, 80, 0.4); }
.btn--danger:hover { background: rgba(207, 91, 80, 0.12); box-shadow: none; }
.btn--sm { padding: 7px 12px; font-size: 0.74rem; }

/* ---- cards & stats ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat .label { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.stat .value { font-family: "Playfair Display", serif; font-size: 2rem; margin-top: 8px; }
.stat .value.gold { color: var(--gold-soft); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; }
.panel h2 { font-size: 1.15rem; margin-bottom: 16px; }
.panel h3 { font-size: 1rem; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-side { display: grid; grid-template-columns: 1.7fr 1fr; gap: 22px; align-items: start; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th {
  text-align: left; padding: 12px 14px;
  font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: rgba(255, 255, 255, 0.02); }
table.data .thumb { width: 46px; height: 46px; border-radius: 5px; background: var(--panel-2) center / cover; }

/* ---- badges ---- */
.badge {
  display: inline-block; padding: 4px 10px;
  border-radius: 999px; font-size: 0.68rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.ok { color: var(--green); border-color: rgba(76, 156, 110, 0.4); }
.badge.warn { color: var(--gold-soft); border-color: var(--line-2); }
.badge.bad { color: var(--red); border-color: rgba(207, 91, 80, 0.4); }

/* ---- forms ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 5px; color: var(--text);
  font-family: inherit; font-size: 0.9rem;
}
.input:focus, select.input:focus, textarea.input:focus { outline: none; border-color: var(--gold); }
textarea.input { min-height: 84px; resize: vertical; }
.row-inline { display: flex; gap: 14px; flex-wrap: wrap; }
.row-inline > * { flex: 1; min-width: 140px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 0.86rem; color: var(--text); }
.check input { width: 16px; height: 16px; accent-color: var(--gold); }
.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.filters .input { max-width: 200px; }

/* ---- toggle switch ---- */
.switch { position: relative; width: 42px; height: 24px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; transition: 0.25s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: var(--muted); border-radius: 50%; transition: 0.25s; }
.switch input:checked + .slider { background: rgba(201, 162, 77, 0.25); border-color: var(--gold); }
.switch input:checked + .slider::before { transform: translateX(18px); background: var(--gold); }

/* ---- login ---- */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell .panel { width: min(100%, 400px); }
.login-shell .brand img { height: 46px; margin-bottom: 20px; }

.flash-stack { position: fixed; top: 20px; right: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 5px; font-size: 0.85rem; max-width: 320px; }
.flash.error { border-left-color: var(--red); }
.flash.success { border-left-color: var(--green); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .side .brand, .side .group, .side .spacer { width: 100%; }
  .side .group { padding-bottom: 2px; }
  .grid-2, .grid-side { grid-template-columns: 1fr; }
}

/* Shared validated forms */
.managed-form p { margin: 0 0 18px; }
.managed-form label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .82rem; }
.managed-form input:not([type=checkbox]):not([type=hidden]), .managed-form select, .managed-form textarea {
  width: 100%; box-sizing: border-box; padding: 12px 14px; border: 1px solid rgba(180,155,100,.3); border-radius: 4px;
  background: rgba(0,0,0,.18); color: inherit; font: inherit;
}
.managed-form select option { background: #20231f; color: #eee; }
.managed-form select[multiple] { min-height: 150px; }
.managed-form textarea { min-height: 90px; max-height: 180px; }
.managed-form input:focus, .managed-form select:focus, .managed-form textarea:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.errorlist { color: #e8988c; margin: 0 0 14px; padding-left: 20px; }
.helptext { display:block; font-size:.8rem; color:var(--muted); margin-top:5px; }
.original-price { font-family: Outfit, sans-serif; font-size: .85rem; color: var(--muted); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Consistent pending and validation states. */
.is-loading { pointer-events: none; position: relative; opacity: .8; }
.is-loading::before { content: ""; display:inline-block; width:13px; height:13px; flex-shrink:0; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; animation:bhimas-spin .65s linear infinite; }
.qty button.is-loading { color:transparent; }
.qty button.is-loading::before { position:absolute; color:var(--gold); left:calc(50% - 7px); top:calc(50% - 7px); }
@keyframes bhimas-spin { to { transform:rotate(360deg); } }
.validation-errors { padding:14px 18px; margin-bottom:18px; color:#eeafa5; background:rgba(207,91,80,.08); border:1px solid rgba(207,91,80,.35); border-radius:6px; }
.validation-errors ul { margin:0; padding-left:18px; }
@media (prefers-reduced-motion: reduce) { .is-loading::before { animation-duration:1.5s; } }

/* Order adjustments and customer conversations. */
.discount-value { color: #f08080; }
.support-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.support-heading h3 { margin-bottom: 0; }
.support-message { padding: 14px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 10px; }
.support-message--staff { border-left: 3px solid var(--gold); background: rgba(192,154,87,.06); }
.support-body { margin-top: 8px; overflow-wrap: anywhere; }

/* Food photo from https://www.bhimaspureveg.com/thali-cropped.jpeg */
.login-shell {
  min-height: 100svh;
  background: linear-gradient(90deg, rgba(12, 10, 7, .08), rgba(12, 10, 7, .18) 45%, rgba(12, 10, 7, .6)), url("../img/signin-thali.679ad684f3d8.jpeg") center / cover no-repeat;
  place-items: center end;
  padding: 24px clamp(24px, 5vw, 80px);
}
.login-shell .panel {
  background: rgba(21, 20, 18, .94);
  border-color: rgba(217, 189, 126, .35);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .35);
  margin-bottom: 0;
}
@media (max-width: 600px) {
  .login-shell { place-items: center; padding-inline: 16px; background-position: 40% center; }
}
