﻿/* Shree Verai Jewellers -- ERP theme: deep green + gold, warm cream surface */

:root {
  --ink: #14231c;
  --ink-soft: #4d5c53;
  --paper: #ffffff;
  --surface: #f7f4ec;
  --line: #e4ded0;

  --sidebar-bg: #0f2a1f;
  --sidebar-bg-2: #0c2018;
  --sidebar-text: #dce7de;
  --sidebar-text-dim: #8fa696;

  --gold: #b6862c;
  --gold-bright: #d9a441;
  --gold-soft: #f4e3bd;
  --active-bg: #e9b65c;
  --active-text: #16261c;

  --green: #2f6b45;
  --amber: #8a5d10;
  --red: #9b2f2a;
  --silver: #8d9298;

  --radius: 10px;
  --radius-sm: 6px;
  --gap: 20px;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  --font-figure: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
}

a { color: var(--gold); }
a:hover { color: var(--gold-bright); }

/* --- shell ---------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex: 0 0 264px;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-text);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.brand {
  padding: 6px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon {
  width: 34px; height: 34px; flex: none;
  border-radius: 8px;
  background: var(--gold-bright);
  color: #16261c;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.15;
  color: #f3ead9;
  display: block;
  font-weight: 600;
}
.brand-sub { font-size: 11px; letter-spacing: 0.08em; color: var(--sidebar-text-dim); }

.nav { flex: 1; }
.nav-group { padding: 6px 12px; }
.nav-title {
  padding: 10px 12px 6px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sidebar-text-dim);
}
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin: 2px 0;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  border-left: none;
}
.nav a:hover { background: rgba(255, 255, 255, 0.07); }
.nav a.active {
  background: var(--active-bg);
  color: var(--active-text);
  font-weight: 600;
}
.nav a .ic { width: 18px; height: 18px; flex: none; opacity: 0.9; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 20px 0;
}
.branch-box {
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  padding-top: 14px;
  font-size: 13px;
  color: var(--sidebar-text-dim);
}
.branch-box strong { display: block; color: #fff; font-size: 15px; font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* --- topbar (navbar) -------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  background: linear-gradient(90deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0;
  color: #f3ead9;
  flex: none;
  white-space: nowrap;
}

.topbar-search {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 8px 16px;
}
.topbar-search input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  width: 100%;
  padding: 0;
}
.topbar-search input::placeholder { color: rgba(255, 255, 255, 0.6); }
.topbar-search input:focus { outline: none; }
.search-ic { opacity: 0.8; }

.topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; flex: none; }

.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); }

.profile-menu { position: relative; }
.profile-btn {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: none; color: #fff; cursor: pointer; padding: 4px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold-bright); color: #16261c;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex: none;
}
.profile-text { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.profile-text strong { font-size: 14px; font-weight: 600; }
.profile-text small { font-size: 12px; color: var(--sidebar-text-dim); }
.chevron { font-size: 12px; color: var(--sidebar-text-dim); }

.profile-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
  min-width: 220px;
  padding: 14px;
  z-index: 60;
}
.profile-dropdown.open { display: block; }
.profile-dropdown-info { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.btn-block { width: 100%; }

.content { padding: 28px; flex: 1; }

/* --- cards and tables ------------------------------------------------------ */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: var(--gap);
}
.card h2 {
  font-family: var(--font-display);
  font-size: 21px;
  margin: 0 0 14px;
}
.card h3 { font-size: 16px; margin: 20px 0 8px; }

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.figure { font-family: var(--font-figure); font-variant-numeric: tabular-nums; }
.figure-lg { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.figure-gold { color: var(--gold); }
.figure-label { font-size: 13px; color: var(--ink-soft); }

/* --- stat cards with icon circle (dashboard) ------------------------------- */
.stat-card { display: flex; align-items: center; gap: 14px; }
.stat-icon {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.stat-icon.i-green { background: #e4efe2; color: #3f7a4d; }
.stat-icon.i-amber { background: #fbead0; color: #b6862c; }
.stat-icon.i-navy  { background: #e2e6ee; color: #33415e; }
.stat-icon.i-gray  { background: #ececec; color: #4d5c53; }
.stat-body a { font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-weight: 600; font-size: 13px; color: var(--ink-soft); background: var(--surface); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #fbf9f2; }
.table-scroll { overflow-x: auto; }

/* --- forms ----------------------------------------------------------------- */
label { display: block; font-size: 14px; margin-bottom: 5px; color: var(--ink-soft); }
input[type="text"], input[type="search"], input[type="number"], input[type="date"],
input[type="password"], input[type="tel"], select, textarea {
  width: 100%;
  padding: 12px 13px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(182, 134, 44, 0.30);
  outline-offset: 1px;
  border-color: var(--gold);
}
.field { margin-bottom: 16px; }
.search-big input { font-size: 20px; padding: 16px 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  font-size: 16px;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #223b2c; color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); }
.btn-gold:hover { background: var(--gold-bright); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-lg { min-height: 60px; font-size: 18px; padding: 16px 28px; }
.btn:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 2px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* --- status --------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.badge::before { content: "\25CF "; }
.badge-in-stock { color: var(--green); border-color: #bcd6c6; background: #f1f7f3; }
.badge-out { color: var(--amber); border-color: #e3d2ad; background: #fbf6ea; }
.badge-sold { color: var(--ink-soft); }
.badge-alert { color: var(--red); border-color: #e0bfbd; background: #fbf1f0; }

.message {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--gold);
  background: #fbf7ee;
  margin-bottom: 16px;
}
.message-error { border-left-color: var(--red); background: #fbf1f0; }
.message-ok { border-left-color: var(--green); background: #f1f7f3; }

.empty { padding: 36px; text-align: center; color: var(--ink-soft); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  min-height: 64px;
}
.tile:hover { border-color: var(--gold); color: var(--ink); }
.tile-icon {
  width: 38px; height: 38px; flex: none; border-radius: 9px;
  background: var(--ink); color: #f3ead9;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.tile-name { font-size: 15px; font-weight: 600; display: block; }
.tile-hint { font-size: 13px; color: var(--ink-soft); }

/* --- dashboard: banner, list-cards ------------------------------------------ */
.banner-card {
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 150px;
  background: linear-gradient(120deg, #0f2a1f, #1c3f2c);
  color: #f3ead9;
  display: flex; align-items: flex-end;
  padding: 20px;
  margin-bottom: var(--gap);
}
.banner-card h3 { font-family: var(--font-display); font-size: 24px; margin: 0; color: #fff; }

.list-card-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.list-card-row:last-child { border-bottom: none; }
.list-card-thumb {
  width: 42px; height: 42px; flex: none; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.list-card-title { font-size: 14px; font-weight: 600; }
.list-card-sub { font-size: 12px; color: var(--ink-soft); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: 13px; }

/* --- billing screen -------------------------------------------------------- */
.bill-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: var(--gap); }
.totals-row { display: flex; justify-content: space-between; padding: 7px 0; }
.totals-row.grand {
  border-top: 2px solid var(--ink);
  margin-top: 10px;
  padding-top: 14px;
  font-size: 22px;
  font-weight: 600;
  color: var(--gold);
}
.scan-stage { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; }
.scan-stage video { width: 100%; height: 100%; display: block; object-fit: cover; }
.scan-frame {
  position: absolute; inset: 22% 10%;
  border: 3px solid var(--gold-bright);
  border-radius: 6px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
}
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  max-width: 400px;
  width: 88vw;
}
dialog::backdrop { background: rgba(15, 42, 31, 0.6); }

/* --- print ----------------------------------------------------------------- */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .content { padding: 0; }
  .card { border: none; padding: 0; margin: 0; }
  @page { size: A4; margin: 12mm; }
}

@media (max-width: 1000px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; padding: 12px 0; }
  .nav { display: flex; flex-wrap: wrap; }
  .nav a { border-radius: var(--radius-sm); padding: 10px 14px; }
  .nav-title { display: none; }
  .grid-2, .grid-3, .grid-4, .bill-layout { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ====== Mobile & tablet navigation drawer ====== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  padding: 0;
  flex: none;
}
.hamburger span { display: block; height: 2px; width: 20px; background: #fff; }

.nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 42, 31, 0.5); z-index: 40; }
.nav-backdrop.open { display: block; }

@media (max-width: 1000px) {
  .hamburger { display: flex; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar-search { display: none; }
  .profile-text { display: none; }
  .chevron { display: none; }

  .shell { flex-direction: row; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    width: 260px; max-width: 82vw;
    padding: 20px 0; flex: none;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 50;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }

  .nav { display: block; }
  .nav-title { display: block; }

  .grid-2, .grid-3, .grid-4, .bill-layout, .tiles { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

@media (max-width: 760px) {
  .topbar h1 { font-size: 17px; }
}

@media (max-width: 640px) {
  .card { padding: 14px; }
  .figure-lg { font-size: 22px; }
  th, td { padding: 8px 6px; }
  .btn-lg { min-height: 52px; font-size: 16px; }
  .stat-card .figure-lg { font-size: 19px; }
}

/* Sales Detail Mobile Table Fix v2 (overrides base.html !important rules) */
@media (max-width: 768px) {
  .grid-2 .card table {
    display: block !important;
    width: 100% !important;
    overflow-x: visible !important;
  }
  .grid-2 .card table tbody {
    display: block !important;
    width: 100% !important;
  }
  .grid-2 .card table tr {
    display: flex !important;
    justify-content: space-between !important;
    align-items: baseline !important;
    padding: 7px 0 !important;
    border-bottom: 1px solid var(--line) !important;
    white-space: normal !important;
  }
  .grid-2 .card table tr:last-child {
    border-bottom: none !important;
  }
  .grid-2 .card table th,
  .grid-2 .card table td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    width: auto !important;
    text-align: left !important;
    white-space: normal !important;
  }
  .grid-2 .card table th {
    color: var(--ink-soft) !important;
    font-weight: 400 !important;
    font-size: 15px !important;
  }
}

/* --- responsive additions --- */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid, .grid-3 { grid-template-columns: 1fr !important; }
  .card > form .field[style*="grid-column"] { grid-column: auto !important; }
  .card > form .field > div[style*="display:flex"],
  .card > form div[style*="display:flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .card > form .actions,
  .actions { flex-wrap: wrap; }
  .card > form button,
  .actions .btn { width: 100%; }
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 640px; }
  dialog { width: 88vw; max-width: 88vw; padding: 12px; }
}


.scan-frame { transition: border-color .15s ease, box-shadow .15s ease; }
.scan-frame.is-sharp {
  border-color: #2ecc71 !important;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45), 0 0 14px rgba(46, 204, 113, 0.8) !important;
}

.barcode-box {
  margin-top: 14px; padding: 14px; border: 1px solid #e5decb; border-radius: 10px;
  background: #fff; text-align: center;
}
.barcode-preview { max-width: 260px; width: 100%; height: auto; image-rendering: pixelated; }
.barcode-actions { margin-top: 10px; }
