/* ============================================================================
   Unified Admin — admin.css
   Modern, responsive, mobile-first design system with CSS custom properties,
   smooth touch interactions (48dp targets), and instant theme re-tinting.
============================================================================ */

:root {
  --primary: #5B7B6E;
  --primary-dark: #45604f;
  --primary-light: #7f9c8f;
  --accent: #C1682B;
  --accent-dark: #995222;
  --accent-light: #d98a52;
  --bg: #0B0F19;
  --surface: #151D2E;
  --surface-raised: #1E293B;
  --border: #26354D;
  --text: #F8FAFC;
  --text-muted: #94A3B8;
  --danger: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --touch-target: 48px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  touch-action: pan-y;
  user-select: none;
  overflow-x: hidden;
}

/* ==========================================================================
   UNLOCK SCREEN
========================================================================== */
.unlock-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #1E293B 0%, #0B0F19 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.unlock-screen[hidden] {
  display: none !important;
}

.unlock-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.unlock-logo {
  font-size: 56px;
  margin-bottom: 12px;
}

.unlock-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.unlock-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.pin-dots {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.15);
}

.pin-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 16px;
  min-height: 18px;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  margin-bottom: 24px;
}

.pin-key {
  height: 68px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.pin-key:active {
  background: var(--primary);
  transform: scale(0.92);
}

.pin-key-ghost {
  background: transparent;
  border-color: transparent;
  font-size: 22px;
}

.pin-key-ghost:active {
  background: var(--surface-raised);
}

.unlock-switch-store {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 8px;
}

.unlock-switch-store:hover {
  color: var(--text);
  background: var(--surface);
}

/* ==========================================================================
   APP SHELL
========================================================================== */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app[hidden] {
  display: none !important;
}

/* Simulated Data Banner */
.simulated-banner {
  background: linear-gradient(90deg, #92400E, #B45309);
  color: #FEF3C7;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.02em;
}

.simulated-dismiss {
  background: transparent;
  border: none;
  color: #FEF3C7;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
}

/* Top App Bar */
.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.store-switcher {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.store-switcher:active {
  transform: scale(0.97);
}

.store-switcher-emoji {
  font-size: 18px;
}

.store-switcher-caret {
  color: var(--text-muted);
  font-size: 12px;
}

.store-dropdown {
  position: absolute;
  top: 64px;
  left: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  width: 260px;
  z-index: 100;
  overflow: hidden;
}

.store-dropdown[hidden] {
  display: none !important;
}

.store-dropdown-item {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.15s ease;
}

.store-dropdown-item:hover, .store-dropdown-item.active {
  background: var(--surface-raised);
}

.store-dropdown-add {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: none;
  color: var(--primary-light);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  padding-left: 16px;
}

.store-dropdown-add:hover {
  background: var(--surface-raised);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}

/* ==========================================================================
   LAYOUT: DESKTOP vs MOBILE
========================================================================== */
.layout {
  display: flex;
  flex: 1;
}

.sidebar {
  display: none;
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  flex-direction: column;
  gap: 6px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 20px;
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s ease;
}

.sidebar-link:hover {
  color: var(--text);
  background: var(--surface-raised);
}

.sidebar-link.active {
  color: #fff;
  background: var(--primary);
  font-weight: 600;
}

.content {
  flex: 1;
  padding: 20px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: 90px;
}

@media (min-width: 900px) {
  .sidebar {
    display: flex;
  }
  .bottom-nav {
    display: none !important;
  }
  .content {
    padding-bottom: 40px;
  }
}

/* ==========================================================================
   VIEWS & COMPONENTS
========================================================================== */
.view[hidden] {
  display: none !important;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.view-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.chip-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-weight: 600;
  font-size: 15px;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 13px;
}

.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-paid { background: #065F46; color: #A7F3D0; }
.badge-pending { background: #92400E; color: #FDE68A; }
.badge-fulfilled { background: #1E40AF; color: #BFDBFE; }
.badge-shipped { background: #4C1D95; color: #DDD6FE; }

.tab-row {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.tab-active {
  color: var(--primary-light);
  border-bottom-color: var(--primary);
}

.tab-panel[hidden] {
  display: none !important;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION & SLIDE-UP SHEET
========================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  height: 100%;
}

.bottom-nav-item .icon {
  font-size: 20px;
}

.bottom-nav-item .label {
  font-size: 11px;
  font-weight: 500;
}

.bottom-nav-item.active {
  color: var(--primary-light);
}

.bottom-nav-item.active .icon {
  transform: scale(1.1);
}

/* Slide-Up Sheet */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
  backdrop-filter: blur(2px);
}

.sheet-overlay[hidden] {
  display: none !important;
}

.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 16px 20px 32px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sheet[hidden] {
  display: none !important;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 12px;
}

.sheet-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.sheet-cancel {
  margin-top: 8px;
  padding: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   MODAL & TOAST
========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 110;
  backdrop-filter: blur(2px);
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  z-index: 120;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.modal[hidden] {
  display: none !important;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  z-index: 200;
  pointer-events: none;
}

.toast[hidden] {
  display: none !important;
}
