/* Hannaford Hardware Admin — amber/dark theme matching main site */

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

:root {
  --amber:      #F59E0B;
  --amber-dark: #D97706;
  --amber-light:#FEF3C7;
  --dark:       #111827;
  --dark-hover: #1F2937;
  --gray-50:    #F9FAFB;
  --gray-100:   #F3F4F6;
  --gray-200:   #E5E7EB;
  --gray-400:   #9CA3AF;
  --gray-500:   #6B7280;
  --gray-700:   #374151;
  --gray-900:   #111827;
  --white:      #FFFFFF;
  --green:      #22C55E;
  --red:        #EF4444;
  --sidebar-w:  260px;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  color: var(--gray-900);
  background: var(--gray-50);
}

/* ── Auth pages (login / forgot / reset) ────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  background-image: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(245,158,11,0.25) 0%, transparent 70%),
                    url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23F59E0B' fill-opacity='0.03'%3E%3Cpath d='M0 0h40v40H0V0zm20 20h20v20H20V20zM0 20h20v20H0V20z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: 1rem;
  padding: 2.5rem 2rem;
  box-shadow: 0 25px 50px rgba(0,0,0,0.4);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.auth-logo-mark {
  width: 44px; height: 44px;
  background: var(--amber);
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--dark);
  letter-spacing: -0.05em;
  flex-shrink: 0;
}

.auth-logo-text {
  line-height: 1.3;
}
.auth-logo-text .brand { font-size: 1.15rem; font-weight: 900; color: var(--dark); letter-spacing: -0.01em; }
.auth-logo-text .brand .amber { color: var(--amber); }
.auth-logo-text .sub   { font-size: 0.72rem; font-weight: 500; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.08em; }

.auth-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 0.4rem;
  text-align: center;
}
.auth-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  text-align: center;
  margin: 0 0 1.75rem;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.5rem 1.25rem 1.25rem;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.logo-mark {
  width: 38px; height: 38px;
  background: var(--amber);
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 900;
  color: var(--dark);
  letter-spacing: -0.05em;
  flex-shrink: 0;
}

.logo-text { line-height: 1.25; }
.logo-text .name { font-size: 0.85rem; font-weight: 900; letter-spacing: -0.01em; }
.logo-text .label { font-size: 0.6rem; font-weight: 500; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.1em; }

.nav-section {
  padding: 1rem 0.75rem 0.5rem;
}
.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 0.5rem 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  text-decoration: none;
  color: var(--gray-400);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 0.15rem;
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active { background: rgba(245,158,11,0.15); color: var(--amber); }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-footer .nav-item { color: var(--gray-500); }

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

.topbar {
  height: 60px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
  flex: 1;
}
.topbar-user {
  font-size: 0.8rem;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.user-avatar {
  width: 32px; height: 32px;
  background: var(--amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--white);
}

.content {
  padding: 1.75rem;
  flex: 1;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 48px; height: 48px;
  background: var(--amber-light);
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { color: var(--amber-dark); }
.stat-number {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  font-weight: 500;
  margin-top: 0.2rem;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-amber {
  background: var(--amber);
  color: var(--dark);
}
.btn-amber:hover { background: var(--amber-dark); }
.btn-dark {
  background: var(--dark);
  color: var(--white);
}
.btn-dark:hover { background: var(--dark-hover); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
}
.btn-outline:hover { background: var(--gray-100); }
.btn-red {
  background: #FEF2F2;
  color: var(--red);
  border: 1px solid #FECACA;
}
.btn-red:hover { background: #FEE2E2; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; width: 100%; justify-content: center; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}
label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}
label .optional {
  font-weight: 400;
  color: var(--gray-400);
  font-size: 0.75rem;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--dark);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
textarea { resize: vertical; min-height: 90px; }

input[type="datetime-local"],
input[type="date"],
input[type="time"] {
  color-scheme: light;
  cursor: pointer;
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24' stroke='%23F59E0B'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E");
  background-size: 16px 16px;
  background-repeat: no-repeat;
  background-position: center;
  width: 18px;
  height: 18px;
  opacity: 0.85;
  cursor: pointer;
  border-radius: 3px;
  padding: 1px;
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background-color: rgba(245,158,11,0.12);
}
.form-hint {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 0.3rem;
}
.form-error {
  font-size: 0.78rem;
  color: var(--red);
  margin-top: 0.3rem;
}

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
}
.toggle-input { display: none; }
.toggle-track {
  width: 44px; height: 24px;
  background: var(--gray-200);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-thumb {
  width: 18px; height: 18px;
  background: var(--white);
  border-radius: 50%;
  position: absolute;
  top: 3px; left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-input:checked + .toggle-track { background: var(--amber); }
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); }
.toggle-label { font-size: 0.875rem; font-weight: 500; color: var(--gray-700); }

/* Image upload */
.upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: 0.6rem;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--gray-50);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--amber);
  background: var(--amber-light);
}
.upload-zone input[type="file"] { display: none; }
.upload-preview {
  margin-top: 0.75rem;
  max-width: 180px;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.upload-preview img { width: 100%; display: block; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
thead th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }
.product-thumb {
  width: 48px; height: 48px;
  object-fit: cover;
  border-radius: 0.4rem;
  border: 1px solid var(--gray-200);
  background: var(--gray-100);
}
.td-actions { display: flex; gap: 0.4rem; align-items: center; justify-content: center; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-amber  { background: var(--amber-light); color: var(--amber-dark); }
.badge-green  { background: #DCFCE7; color: #16A34A; }
.badge-gray   { background: var(--gray-100); color: var(--gray-500); }
.badge-red    { background: #FEF2F2; color: var(--red); }

/* ── Flash alerts ───────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}
.alert-success { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.alert-error   { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-info    { background: var(--amber-light); color: #92400E; border: 1px solid #FDE68A; }

/* ── Page heading ───────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--dark);
  margin: 0;
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin: 0.2rem 0 0;
}

/* ── Confirm modal ──────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--white);
  border-radius: 0.75rem;
  padding: 1.75rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0,0,0,0.35);
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 0.6rem; color: var(--dark); }
.modal-body  { font-size: 0.875rem; color: var(--gray-500); margin: 0 0 1.25rem; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }

/* ── Password requirements ──────────────────────────────────────────────── */
.pw-requirements {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-top: 0.4rem;
}
.pw-req-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
  color: var(--gray-500);
}
.pw-req-item:last-child { margin-bottom: 0; }
.pw-req-item.met { color: #16A34A; }
.pw-req-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── WhatsApp highlight ─────────────────────────────────────────────────── */
.wa-setting {
  border: 1.5px solid #BBF7D0;
  background: #F0FDF4;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.wa-setting label { color: #15803D; }
.wa-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #16A34A;
  margin-bottom: 0.6rem;
}
.wa-input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid #86EFAC;
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--white);
}
.wa-prefix {
  padding: 0.6rem 0.85rem;
  background: #DCFCE7;
  color: #15803D;
  font-weight: 600;
  font-size: 0.875rem;
  border-right: 1.5px solid #86EFAC;
  white-space: nowrap;
}
.wa-input-wrap input {
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding-left: 1.25rem;
}
.wa-input-wrap input:focus {
  box-shadow: none;
  border-color: transparent;
}

/* ── Divider ────────────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 1.5rem 0;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-500);
}
.empty-state svg { margin: 0 auto 1rem; opacity: 0.35; }
.empty-state p { margin: 0.25rem 0 1rem; }

/* ── Variant truncation ─────────────────────────────────────────────────── */
.td-variant {
  max-width: 140px;
}
.td-variant-inner {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Page two-column grid ───────────────────────────────────────────────── */
.page-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.25rem;
  align-items: start;
}

/* ── x-cloak ────────────────────────────────────────────────────────────── */
[x-cloak] { display: none !important; }

/* ── Sidebar close button (mobile only) ─────────────────────────────────── */
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin-right: 0.6rem;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: 0.4rem;
}
.sidebar-close-btn:hover { background: rgba(255,255,255,0.1); color: var(--white); }

/* ── Hamburger button (mobile only) ─────────────────────────────────────── */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin-right: 0.25rem;
  background: none;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  cursor: pointer;
  border-radius: 0.4rem;
}
.hamburger-btn:hover { background: var(--gray-100); }

/* ── Sidebar overlay (mobile) ───────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}

/* ── Mobile responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
  }
  .sidebar-close-btn { display: flex; }
  .sidebar-overlay { display: block; }

  .main { margin-left: 0; }
  .topbar { padding: 0 1rem; gap: 0.5rem; }
  .hamburger-btn { display: flex; }
  .content { padding: 1rem; }

  .form-row   { grid-template-columns: 1fr; gap: 0; }
  .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-grid  { grid-template-columns: 1fr; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .topbar-user span { display: none; }

  /* Stack product edit / settings two-column layout */
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns: 1fr 320px"] {
    display: flex !important;
    flex-direction: column !important;
  }
}
