/* ── Noetic Admin — Tablet-first styles (supplements /assets/styles.css) ── */

:root {
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --nav-item-height: 52px;
}

/* ── Shared reset for admin ──────────────────────────────────────────────── */

.admin-body { display: block; }

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  padding: 0;
  border: 0;
}

/* ============================================================
 * LOGIN SCREEN
 * ============================================================ */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.login-logo {
  display: block;
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 16px;
}

.login-heading {
  font-family: var(--font-head);
  font-size: 1.5rem;
  color: var(--amber-gold);
  text-align: center;
  margin-bottom: 4px;
}

.login-sub {
  font-size: 0.875rem;
  color: var(--cream-dim);
  text-align: center;
  margin-bottom: 28px;
}

.login-form .form-group {
  margin-bottom: 16px;
}

.login-form .form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--cream-dim);
  margin-bottom: 6px;
}

.login-form .input {
  width: 100%;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 14px 16px;
}

.login-form .input:focus {
  outline: none;
  border-color: var(--amber-gold);
  box-shadow: 0 0 0 3px rgba(253, 177, 66, 0.15);
}

.login-error {
  background: rgba(231, 76, 60, 0.12);
  border-left: 3px solid var(--danger);
  color: #ff7b72;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 12px;
}

.btn-full { width: 100%; }

.btn-primary {
  background: var(--amber-gold);
  color: #0b1221;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 24px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--transition), transform 0.1s;
}

.btn-primary:hover { background: #fcc461; }
.btn-primary:active { transform: translateY(1px); }

/* ============================================================
 * APP SHELL — Tablet (default — sidebar always visible)
 * ============================================================ */

.admin-app {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar-backdrop {
  display: none;
}

/* ============================================================
 * SIDEBAR
 * ============================================================ */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 16px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.sidebar-logo {
  display: block;
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 50%;
}

.nav-take-order {
  display: block;
  margin: 12px 12px 4px;
  padding: 12px 16px;
  background: rgba(253, 177, 66, 0.1);
  border: 1px solid rgba(253, 177, 66, 0.25);
  border-radius: var(--radius-md);
  color: var(--amber-gold);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}

.nav-take-order:hover {
  background: rgba(253, 177, 66, 0.18);
  border-color: var(--amber-gold);
  opacity: 1;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}

.nav-section {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--border);
  padding: 14px 20px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: var(--nav-item-height);
  min-height: var(--nav-item-height);
  color: var(--cream-dim);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  text-align: left;
  width: 100%;
  position: relative;
  text-decoration: none;
  opacity: 1;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.nav-link:hover {
  color: var(--cream);
  background: rgba(253, 177, 66, 0.05);
  opacity: 1;
}

.nav-link.active {
  color: var(--amber-gold);
  background: rgba(253, 177, 66, 0.09);
  border-left-color: var(--amber-gold);
  opacity: 1;
}

.nav-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 4px;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cream);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cream-dim);
}

/* ============================================================
 * MAIN CONTENT AREA
 * ============================================================ */

.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

/* ── Topbar ── */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--cream-dim);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.sidebar-toggle:hover {
  background: var(--surface-alt);
  color: var(--cream);
}

.topbar-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--cream);
  flex: 1;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.event-badge {
  display: inline-block;
  padding: 5px 12px;
  background: rgba(253, 177, 66, 0.12);
  border: 1px solid rgba(253, 177, 66, 0.25);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--amber-gold);
}

/* ── Page content ── */

.page-content {
  flex: 1;
  padding: 28px 28px;
  min-width: 0;
}

/* ============================================================
 * PAGE STRUCTURE
 * ============================================================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-family: var(--font-head);
  font-size: 1.5rem;
  color: var(--cream);
  margin: 0;
}

.inventory-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inventory-logo {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
}

.page-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================
 * STAT CARDS — 2-col grid on tablet (primary), 1-col on phone
 * ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--amber-gold);
  line-height: 1;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--cream-dim);
  margin-top: 6px;
}

/* ============================================================
 * BUTTONS (admin-specific variants)
 * ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition), transform 0.1s;
  min-height: 44px;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-secondary {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--cream);
}
.btn-secondary:hover { border-color: var(--amber-gold); color: var(--amber-gold); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--cream-dim);
}
.btn-ghost:hover { border-color: var(--cream-dim); color: var(--cream); }

.btn-danger {
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm {
  padding: 7px 14px;
  font-size: 0.8rem;
  min-height: 36px;
}

/* ============================================================
 * FILTER ROW / SEARCH BAR
 * ============================================================ */

.filter-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-row .input {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 11px 14px;
}

.filter-row .input:focus {
  outline: none;
  border-color: var(--amber-gold);
}

.filter-row .select {
  min-width: 160px;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 11px 14px;
}

/* ============================================================
 * DATA TABLES
 * ============================================================ */

.data-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead {
  background: var(--surface-alt);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--cream-dim);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  color: var(--cream);
  vertical-align: middle;
}

.data-table tr:hover td { background: rgba(253, 177, 66, 0.03); }
.data-table tr.row-clickable { cursor: pointer; }

/* ============================================================
 * STATUS BADGES
 * ============================================================ */

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status-received  { background: rgba(52, 152, 219, 0.15); color: var(--info); }
.status-fulfilled { background: rgba(62, 207, 142, 0.15); color: var(--success); }
.status-cancelled { background: rgba(231, 76, 60, 0.15);  color: var(--danger); }
.status-pending   { background: rgba(245, 166, 35, 0.15); color: var(--warning); }

/* ============================================================
 * INVENTORY INDICATORS
 * ============================================================ */

.stock-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.stock-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stock-ok   .stock-dot { background: var(--success); }
.stock-low  .stock-dot { background: var(--warning); }
.stock-zero .stock-dot { background: var(--danger); }

.inventory-row.low-stock td:nth-child(3) { color: var(--danger); }

/* ============================================================
 * PANELS (dashboard sections)
 * ============================================================ */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.panel h3 {
  font-family: var(--font-head);
  font-size: 1rem;
  color: var(--cream);
  margin-bottom: 16px;
}

/* ============================================================
 * GHL QUEUE
 * ============================================================ */

.queue-counts {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.queue-count-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  min-width: 110px;
}

.queue-count-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--cream-dim);
  margin-bottom: 6px;
}

.queue-count-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-head);
  color: var(--cream);
  line-height: 1;
}

/* ============================================================
 * MODAL
 * ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 18, 0.75);
  z-index: 500;
  display: none;
  backdrop-filter: blur(2px);
}

.modal-backdrop.open { display: block; }

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.97);
  z-index: 501;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: min(560px, calc(100vw - 32px));
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
  opacity: 0;
}

.modal.open {
  display: block;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.modal-title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cream);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ── Form elements inside modals and pages ── */

.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--cream-dim);
  margin-bottom: 6px;
}

/* ── Option button groups (Receive Stock modal grind/caff/organic selectors) ── */

.opt-btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.opt-btn {
  flex: 1 1 auto;
  min-width: 72px;
  padding: 8px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--cream-dim);
  font-size: 0.85rem;
  font-family: var(--font-body, 'Manrope', sans-serif);
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.opt-btn:hover {
  border-color: var(--amber-gold);
  color: var(--cream);
}

.opt-btn.selected {
  background: rgba(253, 177, 66, 0.15);
  border-color: var(--amber-gold);
  color: var(--amber-gold);
  font-weight: 600;
}

.input, .select, .textarea {
  width: 100%;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px 14px;
  transition: border-color var(--transition);
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--amber-gold);
  box-shadow: 0 0 0 3px rgba(253, 177, 66, 0.1);
}

.input::placeholder { color: var(--border); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.form-row.full { grid-template-columns: 1fr; }

/* ============================================================
 * TOAST NOTIFICATIONS
 * ============================================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  width: calc(100vw - 48px);
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.9rem;
  color: var(--cream);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: toastIn 0.2s ease;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
 * LOADING / EMPTY STATES
 * ============================================================ */

.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  color: var(--cream-dim);
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--cream-dim);
}

.empty-state-icon  { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state-title { font-weight: 600; font-size: 1rem; margin-bottom: 4px; color: var(--cream); }
.empty-state-desc  { font-size: 0.875rem; }

/* ============================================================
 * MINI CHART (revenue sparkline)
 * ============================================================ */

.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 56px;
  margin-top: 12px;
}

.mini-bar {
  flex: 1;
  background: rgba(253, 177, 66, 0.2);
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  transition: background var(--transition);
}

.mini-bar:hover { background: var(--amber-gold); }

/* ============================================================
 * LARGE TABLET (≥ 1024px) — 4-col stat grid, wider sidebar
 * ============================================================ */

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .page-content {
    padding: 32px 36px;
  }
}

/* ============================================================
 * MOBILE (< 768px) — sidebar becomes off-canvas drawer
 * ============================================================ */

@media (max-width: 767px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-width));
    top: 0;
    bottom: 0;
    height: 100%;
    transition: left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 300;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 18, 0.6);
    z-index: 299;
    backdrop-filter: blur(1px);
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .page-content {
    padding: 20px 16px;
  }

  .topbar {
    padding: 0 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal {
    align-items: flex-end;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 85vh;
    width: 100%;
  }

  .modal.open {
    transform: none;
  }

  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
  }
}

/* ============================================================
 * VERY SMALL PHONES (< 480px)
 * ============================================================ */

@media (max-width: 479px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 28px 20px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
