/* =========================================================
   সততা Grocery 3D — Design tokens & component system
   Theme: "Fresh Market" — deep market-green + turmeric accent
   ========================================================= */
:root {
  /* Color tokens */
  --sg-forest-950: #0A1F1A;
  --sg-forest-900: #0F3D2E;
  --sg-forest-800: #16513D;
  --sg-forest-700: #1D6B4F;
  --sg-paper: #FBF8F2;
  --sg-paper-dim: #F2EDE1;
  --sg-turmeric: #F2A93B;
  --sg-turmeric-dark: #D68C1F;
  --sg-tomato: #C1440E;
  --sg-tomato-soft: #FBE4D8;
  --sg-ink: #1B241F;
  --sg-ink-soft: #57645C;
  --sg-line: #E4DDCB;
  --sg-white: #FFFFFF;

  /* Typography */
  --font-display: 'Manrope', 'Hind Siliguri', sans-serif;
  --font-body: 'Hind Siliguri', 'Manrope', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-soft: 0 2px 10px rgba(15, 61, 46, 0.06), 0 1px 2px rgba(15,61,46,.08);
  --shadow-raised: 0 12px 30px rgba(15, 61, 46, 0.14), 0 2px 6px rgba(15,61,46,.08);
  --shadow-deep: 0 24px 60px rgba(10, 31, 26, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--sg-paper);
  color: var(--sg-ink);
  margin: 0;
}

h1, h2, h3, h4, .display-font {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--sg-forest-950);
}

.mono, .num, td.num, .stat-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

a { color: var(--sg-forest-800); text-decoration: none; }
a:hover { color: var(--sg-tomato); }

/* ---------- Buttons ---------- */
.btn-brand {
  background: var(--sg-forest-900);
  color: var(--sg-white) !important;
  border: none;
  border-radius: var(--radius-sm);
  padding: .6rem 1.2rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-brand:hover { background: var(--sg-forest-800); transform: translateY(-1px); box-shadow: var(--shadow-raised); }

.btn-accent {
  background: var(--sg-turmeric);
  color: var(--sg-forest-950) !important;
  border: none;
  border-radius: var(--radius-sm);
  padding: .6rem 1.2rem;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-accent:hover { transform: translateY(-1px); box-shadow: var(--shadow-raised); background: var(--sg-turmeric-dark); }

.btn-outline-brand {
  background: transparent;
  color: var(--sg-forest-900) !important;
  border: 1.5px solid var(--sg-forest-800);
  border-radius: var(--radius-sm);
  padding: .55rem 1.15rem;
  font-weight: 700;
}
.btn-outline-brand:hover { background: var(--sg-forest-900); color: var(--sg-white) !important; }

.btn-danger-soft {
  background: var(--sg-tomato-soft);
  color: var(--sg-tomato) !important;
  border: none; border-radius: var(--radius-sm);
  padding: .5rem 1rem; font-weight: 700;
}
.btn-danger-soft:hover { background: var(--sg-tomato); color: #fff !important; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  width: 264px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sg-forest-950), var(--sg-forest-900) 70%);
  color: #EAF2ED;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-sidebar .brand-row {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.2rem 1.3rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-sidebar .brand-row .brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: #fff; line-height: 1.1; }
.app-sidebar .brand-row .brand-name small { display:block; font-weight: 500; opacity: .65; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }

#sidebarCrate3D { width: 42px; height: 42px; flex-shrink: 0; }

.app-nav { padding: .8rem; flex: 1; }
.app-nav .nav-section-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; opacity: .5; margin: 1rem .6rem .35rem; }
.app-nav a {
  display: flex; align-items: center; gap: .65rem;
  color: #D9E7DF; padding: .55rem .75rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .93rem; margin-bottom: 2px;
}
.app-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-nav a.active { background: var(--sg-turmeric); color: var(--sg-forest-950) !important; box-shadow: var(--shadow-soft); }
.app-nav a svg { flex-shrink: 0; opacity: .9; }

.app-main { flex: 1; min-width: 0; }

.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.6rem; background: var(--sg-white); border-bottom: 1px solid var(--sg-line);
  position: sticky; top: 0; z-index: 20;
}

.app-content { padding: 1.6rem; }

/* ---------- Cards ---------- */
.card-glass {
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.stat-card {
  background: var(--sg-white);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.35rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--sg-line);
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-3px) rotateX(1deg); box-shadow: var(--shadow-raised); }
.stat-card .stat-label { font-size: .78rem; color: var(--sg-ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; color: var(--sg-forest-950); margin-top: .15rem; }
.stat-card .stat-icon {
  position: absolute; right: -10px; top: -10px; width: 64px; height: 64px;
  border-radius: 50%; opacity: .12; background: var(--sg-forest-900);
}

.section-card {
  background: var(--sg-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--sg-line);
  box-shadow: var(--shadow-soft);
  padding: 1.4rem;
}
.section-card h2, .section-card h3 { margin-top: 0; }

/* ---------- Tables ---------- */
.table-fresh { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-fresh thead th {
  text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--sg-ink-soft); padding: .6rem .8rem; border-bottom: 2px solid var(--sg-line);
}
.table-fresh tbody td { padding: .65rem .8rem; border-bottom: 1px solid var(--sg-line); vertical-align: middle; }
.table-fresh tbody tr:hover { background: var(--sg-paper-dim); }

/* ---------- Badges ---------- */
.badge-fresh { background: rgba(29,107,79,.12); color: var(--sg-forest-800); padding: .25rem .6rem; border-radius: 20px; font-weight: 700; font-size: .76rem; }
.badge-warn { background: rgba(242,169,59,.18); color: var(--sg-turmeric-dark); padding: .25rem .6rem; border-radius: 20px; font-weight: 700; font-size: .76rem; }
.badge-danger { background: var(--sg-tomato-soft); color: var(--sg-tomato); padding: .25rem .6rem; border-radius: 20px; font-weight: 700; font-size: .76rem; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: var(--radius-sm); border: 1.5px solid var(--sg-line);
  padding: .55rem .8rem; font-family: var(--font-body);
}
.form-control:focus, .form-select:focus {
  border-color: var(--sg-forest-700); box-shadow: 0 0 0 3px rgba(29,107,79,.15);
}
label { font-weight: 600; color: var(--sg-forest-950); margin-bottom: .3rem; display: inline-block; }

/* ---------- Landing / hero ---------- */
.hero-wrap {
  position: relative; overflow: hidden; background: radial-gradient(ellipse at top, var(--sg-forest-800), var(--sg-forest-950) 65%);
  color: #fff;
  min-height: 92vh;
  display: flex; align-items: center;
}
#hero3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.hero-content { position: relative; z-index: 2; padding: 3rem 5vw; max-width: 720px; }
.hero-eyebrow { font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--sg-turmeric); font-size: .82rem; }
.hero-title { font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1.05; margin: .5rem 0 1rem; color: #fff; }
.hero-sub { font-size: 1.15rem; color: rgba(255,255,255,.82); max-width: 560px; }
.hero-actions { margin-top: 2rem; display: flex; gap: 1rem; flex-wrap: wrap; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.2rem; padding: 4rem 5vw; }
.feature-card { background: var(--sg-white); border: 1px solid var(--sg-line); border-radius: var(--radius-md); padding: 1.4rem; box-shadow: var(--shadow-soft); transition: transform .2s ease; }
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-raised); }
.feature-card .f-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--sg-paper-dim); display: flex; align-items: center; justify-content: center; margin-bottom: .8rem; color: var(--sg-forest-800); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; }
.auth-visual { flex: 1.1; position: relative; background: radial-gradient(ellipse at bottom, var(--sg-forest-800), var(--sg-forest-950)); display: none; }
.auth-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--sg-paper); }
@media (min-width: 900px) { .auth-visual { display: block; } }
.auth-card { width: 100%; max-width: 380px; }

/* ---------- POS ---------- */
.pos-shell { display: grid; grid-template-columns: 1fr 380px; gap: 1.2rem; align-items: start; }
@media (max-width: 992px) { .pos-shell { grid-template-columns: 1fr; } }
.pos-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; max-height: 70vh; overflow-y: auto; padding-right: 4px; }
.pos-product-card {
  background: var(--sg-white); border: 1px solid var(--sg-line); border-radius: var(--radius-md);
  padding: .8rem; cursor: pointer; text-align: center; transition: transform .15s ease, box-shadow .15s ease;
  perspective: 600px;
}
.pos-product-card:hover { transform: translateY(-3px) rotateY(3deg); box-shadow: var(--shadow-raised); border-color: var(--sg-forest-700); }
.pos-product-card .p-name { font-weight: 700; font-size: .87rem; color: var(--sg-forest-950); }
.pos-product-card .p-price { font-family: var(--font-mono); color: var(--sg-turmeric-dark); font-weight: 800; }
.pos-product-card .p-stock { font-size: .72rem; color: var(--sg-ink-soft); }
.pos-product-card.out-of-stock { opacity: .45; cursor: not-allowed; }

.category-pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.cat-pill {
  border: 1.5px solid var(--sg-line); background: var(--sg-paper-dim); color: var(--sg-forest-950);
  padding: .4rem .95rem; border-radius: 20px; font-weight: 700; font-size: .85rem; cursor: pointer;
  transition: all .15s ease;
}
.cat-pill:hover { border-color: var(--sg-forest-700); }
.cat-pill.active { background: var(--sg-forest-900); color: #fff; border-color: var(--sg-forest-900); box-shadow: var(--shadow-soft); }

.cart-panel { background: var(--sg-forest-950); color: #EAF2ED; border-radius: var(--radius-lg); padding: 1.2rem; position: sticky; top: 1rem; box-shadow: var(--shadow-deep); }
.cart-items { max-height: 40vh; overflow-y: auto; margin: .8rem 0; }
.cart-line { display: flex; justify-content: space-between; align-items: center; padding: .55rem 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.cart-line .cl-name { font-weight: 700; font-size: .88rem; }
.cart-line .cl-controls { display: flex; align-items: center; gap: .4rem; }
.cart-line .cl-controls button { width: 26px; height: 26px; border-radius: 6px; border: none; background: rgba(255,255,255,.1); color: #fff; font-weight: 800; }
.cart-line .cl-controls input { width: 46px; text-align: center; background: rgba(255,255,255,.08); border: none; color: #fff; border-radius: 6px; padding: 3px; }
.cart-total-row { display: flex; justify-content: space-between; padding: .3rem 0; font-size: .95rem; }
.cart-total-row.grand { font-size: 1.35rem; font-weight: 800; color: var(--sg-turmeric); border-top: 1px dashed rgba(255,255,255,.2); margin-top: .5rem; padding-top: .7rem; }

/* Utility */
.text-muted-soft { color: var(--sg-ink-soft); }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--sg-ink-soft); }
.pill-lang a { color: rgba(255,255,255,.75); font-weight: 700; padding: .3rem .6rem; border-radius: 20px; }
.pill-lang a.active { background: var(--sg-turmeric); color: var(--sg-forest-950) !important; }
