/* ===================================================
   HG Butik Admin — Mobile-First Premium Design
   iOS / Android native app feel
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─── Design Tokens ─────────────────────────────── */
:root {
  --primary:       #d4527a;
  --primary-dark:  #b03363;
  --primary-light: #f7d0dc;
  --primary-glow:  rgba(212, 82, 122, 0.18);

  --accent:        #7c3aed;
  --accent-light:  rgba(124, 58, 237, 0.12);

  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;

  --bg:            #f2f3f8;
  --surface:       #ffffff;
  --surface-2:     #f8f9fc;
  --border:        rgba(0,0,0,0.07);
  --border-strong: rgba(0,0,0,0.13);

  --text-1:        #0f0f14;
  --text-2:        #4b5563;
  --text-3:        #9ca3af;

  --sidebar-bg:    #0f0f14;
  --sidebar-w:     260px;

  --radius-sm:     0.5rem;
  --radius:        0.875rem;
  --radius-lg:     1.25rem;
  --radius-xl:     1.75rem;
  --radius-full:   9999px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow:        0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08);
  --shadow-primary: 0 8px 24px rgba(212,82,122,0.28);

  --safe-bottom:   env(safe-area-inset-bottom, 0px);
  --safe-top:      env(safe-area-inset-top, 0px);

  --transition:    all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --spring:        all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Reset & Base ──────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

/* ─── Sidebar ───────────────────────────────────── */
.admin-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: var(--sidebar-bg);
  color: white;
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.admin-sidebar::-webkit-scrollbar { display: none; }

.sidebar-header {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.02em;
}

.sidebar-logo i {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: var(--shadow-primary);
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212,82,122,0.15), rgba(212,82,122,0.05));
  opacity: 0;
  border-radius: inherit;
  transition: opacity 0.2s;
}

.nav-item:hover {
  color: white;
  background: rgba(255,255,255,0.07);
}

.nav-item.active {
  color: white;
  background: linear-gradient(135deg, rgba(212,82,122,0.22), rgba(212,82,122,0.10));
  border: 1px solid rgba(212,82,122,0.25);
}

.nav-item.active::before { opacity: 1; }

.nav-item i {
  width: 20px;
  font-size: 1rem;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0.5rem 0;
}

.nav-section-title {
  padding: 0.5rem 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s;
}

/* ─── Main Layout ───────────────────────────────── */
.admin-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ────────────────────────────────────── */
.admin-header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
}

.admin-header h1 {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.025em;
  margin: 0;
}

/* ─── Content ───────────────────────────────────── */
.admin-content {
  padding: 1.5rem;
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Cards ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

/* ─── Stat Cards ─────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  border: 1px solid var(--border);
  transition: var(--spring);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-glow);
  transform: translate(25px, -25px);
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-lg);
}

.stat-card p:first-child {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.stat-card p:last-child {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.03em;
}

/* ─── Stat icon box variants ─────────────────────── */
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-icon-red   { background: #fee2e2; color: var(--danger); }
.stat-icon-blue  { background: #dbeafe; color: var(--info); }
.stat-icon-green { background: #d1fae5; color: var(--success); }
.stat-icon-amber { background: #fef3c7; color: var(--warning); }
.stat-icon-purple{ background: #ede9fe; color: var(--accent); }
.stat-icon-pink  { background: var(--primary-light); color: var(--primary); }

/* ─── Buttons ───────────────────────────────────── */
.btn {
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #922c52);
  box-shadow: 0 12px 32px rgba(212,82,122,0.4);
}

.btn-success { background: var(--success); color: white; box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.btn-success:hover { background: #059669; }

.btn-danger  { background: var(--danger); color: white; box-shadow: 0 4px 12px rgba(239,68,68,0.3); }
.btn-danger:hover  { background: #dc2626; }

.btn-secondary { background: #374151; color: white; }
.btn-secondary:hover { background: #1f2937; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--text-2);
}
.btn-outline:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-lg { padding: 0.875rem 1.5rem; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; border-radius: var(--radius-sm); }
.btn-icon { padding: 0.5rem; width: 38px; height: 38px; border-radius: var(--radius); }

/* ─── Mobile toggle button ──────────────────────── */
#mobileSidebarToggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
#mobileSidebarToggle:hover { background: var(--primary-light); color: var(--primary); }

/* ─── Forms ─────────────────────────────────────── */
.form-group { margin-bottom: 1.125rem; }

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text-2);
  font-size: 0.875rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text-1);
  background: var(--surface);
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-textarea { resize: vertical; min-height: 100px; }
.form-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); }

/* ─── Search bar ────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-1);
  transition: var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ─── Tables ─────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.data-table th {
  background: var(--surface-2);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-3);
  border-bottom: 1.5px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-2); }

/* order row highlights */
.data-table tr.order-processing { background: rgba(59,130,246,0.04); }
.data-table tr.order-processing:hover td { background: rgba(59,130,246,0.08); }
.data-table tr.order-pending { background: rgba(245,158,11,0.04); }
.data-table tr.order-pending:hover td { background: rgba(245,158,11,0.08); }
.data-table tr.order-shipped { background: rgba(139,92,246,0.04); }
.data-table tr.order-shipped:hover td { background: rgba(139,92,246,0.08); }
.data-table tr.order-delivered { background: rgba(16,185,129,0.04); }
.data-table tr.order-delivered:hover td { background: rgba(16,185,129,0.08); }
.data-table tr.order-cancelled { background: rgba(239,68,68,0.04); }
.data-table tr.order-cancelled:hover td { background: rgba(239,68,68,0.08); }

/* ─── Badges ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-success  { background: #d1fae5; color: #065f46; }
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-secondary{ background: #f3f4f6; color: var(--text-2); }
.badge-purple   { background: #ede9fe; color: #4c1d95; }

/* ─── Header badge ───────────────────────────────── */
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.625rem;
  border-radius: var(--radius-full);
  background: #e0f2fe;
  color: #075985;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

/* ─── Order Status Chips ─────────────────────────── */
.order-status-summary {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.order-status-summary__loading { color: var(--text-3); font-size: 0.875rem; }

.order-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.875rem;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--spring);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}

.order-status-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.order-status-chip.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.order-status-chip__count { font-weight: 800; }

/* ─── Order Item Cards ───────────────────────────── */
.order-items {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.order-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  transition: var(--transition);
}

.order-item:hover { background: var(--surface); box-shadow: var(--shadow-sm); }

.order-item__img img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}

.order-item__img--empty {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}

.order-item__name {
  font-weight: 700;
  color: var(--text-1);
  text-decoration: none;
  font-size: 0.9375rem;
}

.order-item__meta {
  margin-top: 0.2rem;
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
  color: var(--text-3);
  font-size: 0.8125rem;
}

.order-item__total { font-weight: 900; color: var(--text-1); white-space: nowrap; }

.order-items__footer {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9375rem;
}

.order-items__footerTotal { color: var(--primary); font-weight: 800; }

/* ─── Modal ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s;
  padding: 0;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: 1rem;
  }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-width: 100%;
  width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  animation: slideUpModal 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
  overscroll-behavior: contain;
  padding-bottom: var(--safe-bottom);
}

@media (min-width: 640px) {
  .modal {
    border-radius: var(--radius-xl);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
    box-shadow: var(--shadow-lg);
  }
  .modal-sm  { width: 400px; }
  .modal-md  { width: 600px; }
  .modal-lg  { width: 800px; }
  .modal-xl  { width: 1000px; }
}

/* drag handle for bottom sheet */
.modal::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: #d1d5db;
  border-radius: var(--radius-full);
  margin: 0.75rem auto 0;
}

@media (min-width: 640px) {
  .modal::before { display: none; }
}

.modal-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-title { font-size: 1.125rem; font-weight: 800; color: var(--text-1); }

.modal-close {
  background: var(--surface-2);
  border: none;
  font-size: 1rem;
  color: var(--text-2);
  cursor: pointer;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition: var(--transition);
}
.modal-close:hover { background: #fee2e2; color: var(--danger); }

.modal-body   { padding: 1.25rem 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ─── Toast Notifications ───────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(1rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.625rem;
  align-items: center;
  width: calc(100% - 2rem);
  max-width: 420px;
  pointer-events: none;
}

@media (min-width: 640px) {
  .toast-container {
    bottom: 1.5rem;
    right: 1.5rem;
    left: auto;
    transform: none;
    align-items: flex-end;
  }
}

.toast {
  background: var(--text-1);
  color: white;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: all;
  font-size: 0.9rem;
  font-weight: 500;
}

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

.toast-icon { font-size: 1.125rem; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon   { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon    { color: var(--info); }

/* ─── Loading Spinner ───────────────────────────── */
.spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.7s linear infinite;
  margin: 2rem auto;
}

.spinner-sm { width: 20px; height: 20px; border-width: 2px; }

/* ─── Image Upload ──────────────────────────────── */
.image-upload-container {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.image-upload-container:hover { border-color: var(--primary); background: #fff5f8; }
.image-preview { max-width: 200px; max-height: 200px; margin: 1rem auto; border-radius: var(--radius); object-fit: cover; }

/* ─── Crop / Focal ──────────────────────────────── */
.imgcrop-stage, .imgfocal-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
}
.imgcrop-image, .imgfocal-image {
  display: block;
  max-width: 100%;
  max-height: 65vh;
  border-radius: var(--radius-lg);
}
.imgcrop-rect {
  position: absolute;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
  cursor: move;
  touch-action: none;
}
.imgcrop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 4px;
}
.imgcrop-handle.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.imgcrop-handle.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.imgcrop-handle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.imgcrop-handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.imgcrop-focal, .imgfocal-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  background: rgba(255,255,255,0.95);
  border: 2px solid var(--text-1);
  border-radius: var(--radius-full);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.imgcrop-hint, .imgfocal-hint { margin-top: 0.75rem; color: var(--text-3); font-size: 0.875rem; }

/* ─── Variant table ─────────────────────────────── */
.variant-table { width: 100%; margin-top: 1rem; }
.variant-table th {
  background: var(--surface-2);
  padding: 0.625rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
.variant-table td { padding: 0.625rem; border-bottom: 1px solid var(--border); }
.variant-table input, .variant-table select {
  width: 100%;
  padding: 0.5rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}
.variant-row:hover { background: var(--surface-2); }

/* ─── Code Editor ───────────────────────────────── */
.code-editor {
  width: 100%;
  min-height: 400px;
  font-family: 'Courier New', Consolas, Monaco, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  padding: 1rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: #1e1e1e;
  color: #d4d4d4;
  resize: vertical;
}
.code-editor:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

/* ─── Child rows editor ─────────────────────────── */
.child-rows { display: flex; flex-direction: column; gap: 0.75rem; }
.child-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.child-row .form-input, .child-row .form-select { height: 38px; }
.child-row .btn { height: 38px; }

/* ─── Login ─────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(1200px 600px at 20% 20%, rgba(212,82,122,0.18), transparent 60%),
              radial-gradient(900px 500px at 80% 10%, rgba(59,130,246,0.14), transparent 55%),
              #0b1220;
}
.login-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.login-bg-shape { position: absolute; filter: blur(40px); opacity: 0.55; }
.login-bg-shape-1 { width: 420px; height: 420px; left: -120px; top: -120px; background: rgba(212,82,122,0.55); border-radius: 9999px; }
.login-bg-shape-2 { width: 520px; height: 520px; right: -180px; bottom: -220px; background: rgba(59,130,246,0.45); border-radius: 9999px; }
.login-container { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.login-card {
  width: 100%;
  max-width: 520px;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(229,231,235,0.8);
  border-radius: var(--radius-xl);
  box-shadow: 0 30px 60px rgba(0,0,0,0.25);
  padding: 1.75rem;
  backdrop-filter: blur(10px);
}
.login-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.login-logo {
  width: 54px; height: 54px;
  border-radius: var(--radius-lg);
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(212,82,122,0.18), rgba(59,130,246,0.12));
  border: 1px solid rgba(212,82,122,0.25);
  color: var(--primary);
  font-size: 1.5rem;
}
.login-title { font-size: 1.375rem; font-weight: 800; color: var(--text-1); line-height: 1.2; }
.login-subtitle { margin-top: 0.25rem; color: var(--text-3); font-size: 0.9rem; }
.login-help { margin-top: 0.5rem; color: var(--text-3); font-size: 0.8125rem; line-height: 1.35; }
.login-input-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; align-items: center; }
.login-check { display: flex; align-items: center; gap: 0.6rem; color: var(--text-2); font-size: 0.875rem; user-select: none; margin: 0.25rem 0 1rem; }
.login-actions { display: grid; gap: 0.75rem; }
.login-footer { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1.25rem; }
.login-footer-text { color: var(--text-3); font-size: 0.8125rem; font-weight: 600; }
.login-footer-pill { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.65rem; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 700; background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.login-alert { display: block; padding: 0.75rem 0.9rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.875rem; font-weight: 600; border: 1px solid transparent; }
.login-alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.login-alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.login-alert-error { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.login-brand { margin-top: 1.25rem; color: rgba(255,255,255,0.72); font-size: 0.8125rem; }

/* ─── Bottom Navigation (Mobile) ────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-top: 1px solid var(--border);
  z-index: 950;
  padding: 0.5rem 0;
  padding-bottom: calc(0.5rem + var(--safe-bottom));
}

.mobile-bottom-nav__items {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.375rem 1rem;
  color: var(--text-3);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: var(--spring);
  border-radius: var(--radius-sm);
  -webkit-user-select: none;
  user-select: none;
  min-width: 60px;
  text-align: center;
}

.mobile-nav-item i {
  font-size: 1.25rem;
  transition: var(--spring);
  display: block;
}

.mobile-nav-item:active { transform: scale(0.9); }

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

.mobile-nav-item.active i {
  transform: translateY(-2px) scale(1.1);
}

/* ─── Animations ─────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes slideUpModal {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Utility ────────────────────────────────────── */
.hidden  { display: none !important; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.mt-1 { margin-top: 0.5rem; }  .mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }

/* ─── Responsive — Tablet (≤1024px) ─────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .admin-content { padding: 1.25rem; }
}

/* ─── Responsive — Mobile (≤768px) ──────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 280px; }

  /* Sidebar hides off-canvas */
  .admin-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    box-shadow: none;
  }
  .admin-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,0.3);
  }
  .sidebar-overlay.active { display: block; }

  /* Main takes full width */
  .admin-main { margin-left: 0; }

  /* Header adapts */
  .admin-header { padding: 0.75rem 1rem; }
  .admin-header h1 { font-size: 1.125rem; }

  /* Content padding */
  .admin-content {
    padding: 1rem;
    padding-bottom: calc(80px + var(--safe-bottom));
  }

  /* Show mobile bottom nav */
  .mobile-bottom-nav { display: block; }

  /* Show hamburger */
  #mobileSidebarToggle { display: inline-flex; }

  /* Cards full width */
  .card, .stat-card { border-radius: var(--radius); }

  /* Stat grid */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
  .stat-card p:last-child { font-size: 1.25rem; }

  /* Chart area */
  .chart-area { height: 200px !important; }

  /* Revenue bars min-width */
  .revenue-grid { grid-template-columns: 1fr !important; gap: 0.625rem !important; }

  /* Tables — stack on mobile */
  .table-container { border-radius: var(--radius); font-size: 0.8125rem; }
  .data-table th, .data-table td { padding: 0.625rem 0.75rem; }

  /* Filters */
  .search-bar { gap: 0.5rem; }
  .search-bar .form-select { width: 100% !important; }

  /* Order status chips horizontal scroll */
  .order-status-summary {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
  }
  .order-status-summary::-webkit-scrollbar { display: none; }

  /* Modal on mobile */
  .modal-footer { justify-content: stretch; }
  .modal-footer .btn { flex: 1; }

  /* Toast */
  .toast { font-size: 0.875rem; }

  /* Login */
  .login-card { padding: 1.25rem; border-radius: var(--radius-lg); }
  .login-footer { flex-direction: column; align-items: flex-start; }

  /* Order item grid */
  .order-item { grid-template-columns: 44px 1fr auto; gap: 0.5rem; }
  .order-item__img img, .order-item__img--empty { width: 44px; height: 44px; }
}

/* ─── Responsive — Small phones (≤380px) ────────── */
@media (max-width: 380px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }
  .admin-content { padding: 0.75rem; }
  .stat-card { padding: 1rem; }
  .stat-card p:last-child { font-size: 1.125rem; }
  .admin-header h1 { font-size: 1rem; }
}
