/* public/css/elevare.css — shared design system */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Inter:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --forest:   #1A2E1E;
  --forest2:  #243829;
  --forest3:  #0F1F12;
  --sage:     #8FAF89;
  --sage-light: #C4D9C1;
  --gold:     #C8A96E;
  --gold2:    #A8893E;
  --ivory:    #F5F0E8;
  --cream:    #FAFAF7;
  --white:    #FFFFFF;
  --text:     #2C3E2F;
  --muted:    #6B7C6E;
  --border:   #E0E8DF;
  --border-gold: rgba(200,169,110,0.3);
  --red:      #C0392B;
  --orange:   #E67E22;
  --green:    #27AE60;
  --blue:     #2980B9;

  --sidebar-w: 240px;
  --header-h:  60px;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow:    0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
}

body {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #F2F5F1;
  line-height: 1.6;
}

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

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--forest);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  text-decoration: none;
}
.sidebar-logo-mark {
  width: 34px; height: 34px; flex-shrink: 0;
}
.sidebar-brand { font-family: 'Cormorant Garamond', serif; font-size: 17px; font-weight: 500; color: var(--ivory); line-height: 1.1; }
.sidebar-sub   { font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin-top: 2px; }

.sidebar-section {
  padding: 14px 0 4px;
}
.sidebar-section-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245,240,232,0.3);
  padding: 0 20px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(245,240,232,0.6);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item:hover {
  color: var(--ivory);
  background: rgba(255,255,255,0.05);
  border-left-color: var(--sage);
}
.nav-item.active {
  color: var(--ivory);
  background: rgba(143,175,137,0.12);
  border-left-color: var(--gold);
  font-weight: 500;
}
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user {
  font-size: 12px;
  color: rgba(245,240,232,0.5);
  margin-bottom: 10px;
  line-height: 1.4;
}
.sidebar-user strong { color: var(--ivory); display: block; font-size: 13px; }
.btn-logout {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: rgba(245,240,232,0.45);
  text-decoration: none; transition: color 0.15s;
}
.btn-logout:hover { color: var(--gold); }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--forest);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-pharm {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
.topbar-pharm strong { color: var(--text); display: block; font-size: 13px; }

.page-body {
  padding: 28px;
  flex: 1;
}

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--forest);
}
.card-body { padding: 22px; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--forest), var(--sage));
}
.stat-card.gold::before { background: linear-gradient(90deg, var(--gold), var(--gold2)); }
.stat-card.sage::before { background: linear-gradient(90deg, var(--sage), var(--sage-light)); }
.stat-icon { color: var(--muted); margin-bottom: 10px; }
.stat-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px;
  font-weight: 500;
  color: var(--forest);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #F0F3EF;
  font-size: 13px;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFCFA; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: capitalize;
}
.badge-pending    { background: #FEF9EC; color: #B7860B; border: 1px solid #F5D97A; }
.badge-confirmed  { background: #EAF0FD; color: #1A56B0; border: 1px solid #A3BFFA; }
.badge-dispatched { background: #EEF2FF; color: #4338CA; border: 1px solid #C7D2FE; }
.badge-delivered  { background: #ECFDF5; color: #065F46; border: 1px solid #6EE7B7; }
.badge-cancelled  { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.badge-approved   { background: #ECFDF5; color: #065F46; border: 1px solid #6EE7B7; }
.badge-pending-approval { background: #FEF9EC; color: #B7860B; border: 1px solid #F5D97A; }
.badge-suspended  { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.badge-active     { background: #ECFDF5; color: #065F46; border: 1px solid #6EE7B7; }
.badge-inactive   { background: #F9FAFB; color: #6B7280; border: 1px solid #D1D5DB; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--forest); color: var(--ivory); }
.btn-primary:hover  { background: var(--forest2); }
.btn-secondary { background: var(--cream); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-gold      { background: var(--gold); color: var(--forest); }
.btn-gold:hover { background: var(--gold2); color: var(--ivory); }
.btn-danger    { background: #FEF2F2; color: var(--red); border: 1px solid #FECACA; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); background: var(--cream); border: 1px solid var(--border); color: var(--muted); cursor: pointer; transition: all 0.15s; }
.btn-icon:hover { background: var(--forest); color: var(--ivory); border-color: var(--forest); }

/* ── FORMS ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(143,175,137,0.15);
  background: #fff;
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,20,12,0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px; font-weight: 500; color: var(--forest);
}
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── ALERTS ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #6EE7B7; }
.alert-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-bar input,
.filter-bar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  background: var(--white);
  color: var(--text);
  outline: none;
}
.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--sage); }
.filter-bar input[type=search] { min-width: 220px; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state svg { margin-bottom: 16px; opacity: 0.35; }
.empty-state h3 { font-size: 16px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.empty-state p  { font-size: 13px; }

/* ── TOAST ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--forest);
  color: var(--ivory);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.25s ease;
  border-left: 3px solid var(--gold);
  max-width: 320px;
}
.toast.error { border-left-color: #FC8181; }
@keyframes slideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: none; } }

/* ── LOADING ── */
.loading { text-align: center; padding: 40px; color: var(--muted); }
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--sage);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PRODUCT GRID ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.product-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.product-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.product-card-img {
  height: 120px;
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.product-form-badge {
  position: absolute;
  top: 10px; right: 10px;
  padding: 2px 8px;
  background: rgba(200,169,110,0.85);
  color: var(--forest);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 100px;
}
.product-card-body { padding: 14px; }
.product-brand { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.product-name  { font-family: 'Cormorant Garamond', serif; font-size: 16px; font-weight: 500; color: var(--forest); margin-bottom: 4px; }
.product-sku   { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; margin-bottom: 8px; }
.product-ratios { display: flex; gap: 8px; margin-bottom: 10px; }
.ratio-pill {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--cream);
  color: var(--text);
  border: 1px solid var(--border);
}
.ratio-pill.thc { background: #FEF9EC; color: #92600A; border-color: #F5D97A; }
.ratio-pill.cbd { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: #FCFCFC;
}
.product-price { font-family: 'Cormorant Garamond', serif; font-size: 18px; font-weight: 500; color: var(--forest); }
.product-price span { font-family: 'Inter', sans-serif; font-size: 10px; color: var(--muted); }

/* ── CART ── */
.cart-sidebar {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 360px;
  background: var(--white);
  box-shadow: -4px 0 30px rgba(0,0,0,0.12);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.cart-sidebar.open { transform: none; }
.cart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}
.cart-title { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 500; color: var(--forest); }
.cart-body { flex: 1; overflow-y: auto; padding: 16px; }
.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #F0F3EF;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.cart-item-sku  { font-size: 11px; color: var(--muted); }
.cart-item-qty  { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qty-btn { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: var(--cream); cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; color: var(--text); transition: all 0.15s; }
.qty-btn:hover { background: var(--forest); color: #fff; border-color: var(--forest); }
.cart-item-price { font-size: 13px; font-weight: 600; color: var(--forest); white-space: nowrap; }
.cart-footer { padding: 16px 22px; border-top: 1px solid var(--border); }
.cart-total-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.cart-total-row.grand { font-size: 15px; font-weight: 600; color: var(--forest); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.cart-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 199; }
.cart-overlay.open { display: block; }
.cart-badge { background: var(--gold); color: var(--forest); font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 100px; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .cart-sidebar { width: 100%; }
}
