/* Harduent Admin — shared styles, aligned with storefront design system. */

:root {
  --bg: #FAFAF7;
  --bg-warm: #F5F3EE;
  --bg-card: #FFFFFF;
  --bg-hover: #F0EDE6;
  --text: #1A1A18;
  --text-secondary: #8C8C84;
  --text-tertiary: #B5B5AD;
  --border: #E8E6E0;
  --border-strong: #D5D3CC;
  --blue: #3B82F6;
  --blue-light: #EFF6FF;
  --blue-hover: #2563EB;
  --green: #16A34A;
  --green-light: #F0FDF4;
  --red: #DC2626;
  --red-light: #FEF2F2;
  --orange: #F97316;
  --orange-light: #FFF7ED;
  --purple: #8B5CF6;
  --font-display: 'Sora', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── LOGIN ── */
body.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: 24px;
  padding: 48px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}
.brand-block { text-align: center; margin-bottom: 32px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: var(--text); color: var(--bg);
  border-radius: 16px;
  font-family: var(--font-display); font-weight: 700; font-size: 22px;
  margin-bottom: 16px;
}
.brand-mark-img {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  object-fit: contain;
}
h1.login-title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.5px;
}
.login-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.form-group { margin-bottom: 16px; }
label.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
input.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: var(--font-body); font-size: 14px;
  color: var(--text); background: var(--bg);
  outline: none;
  transition: all 0.2s;
}
input.form-input:focus { border-color: var(--text); background: white; }
.btn-primary-block {
  width: 100%;
  padding: 16px;
  background: var(--text); color: var(--bg);
  border: none;
  border-radius: 100px;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}
.btn-primary-block:hover { background: #333; }
.btn-primary-block:disabled { opacity: 0.5; cursor: not-allowed; }
.error-msg {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  display: none;
}
.error-msg.show { display: block; }
.footer-note { margin-top: 24px; text-align: center; font-size: 12px; color: var(--text-secondary); }

/* ── DASHBOARD LAYOUT ── */
body.dashboard { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex; flex-direction: column; gap: 4px;
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-brand .mark {
  width: 32px; height: 32px;
  background: var(--text); color: var(--bg);
  border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
}
.sidebar-brand .label { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.sidebar-brand .label small {
  display: block; font-size: 10px; color: var(--text-secondary);
  font-weight: 500; letter-spacing: 1px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--text); color: white; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-section {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-tertiary);
  padding: 16px 12px 6px;
}
.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-footer .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-warm);
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
}
.sidebar-footer .who { flex: 1; min-width: 0; }
.sidebar-footer .who strong {
  display: block; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-footer .who span { font-size: 11px; color: var(--text-secondary); }
.sidebar-footer .logout {
  color: var(--text-secondary);
  background: none; border: none; cursor: pointer; padding: 4px;
}

main {
  margin-left: 240px;
  flex: 1;
  padding: 32px 40px;
  max-width: 100%;
}
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px;
}
.page-title { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.header-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  border-radius: 100px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  text-decoration: none; cursor: pointer; border: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: #333; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.stat-card .label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.stat-card .value {
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
  letter-spacing: -0.5px;
}
.stat-card .delta { font-size: 12px; color: var(--green); margin-top: 4px; }
.stat-card .delta.warn { color: var(--orange); }

/* Filters */
.filters {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 240px;
  padding: 10px 16px 10px 40px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-body); font-size: 13px;
  background: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23B5B5AD' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
  outline: none;
}
.search-input:focus { border-color: var(--text); background-color: white; }
.select {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-body); font-size: 13px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  outline: none;
  max-width: 200px;
}
.select:focus { border-color: var(--text); background: white; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--bg-warm);
  border-radius: 100px;
  font-size: 11px; font-weight: 500;
  margin: 2px;
}

/* Table */
.table-wrap {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead { background: var(--bg-warm); }
thead th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--bg); }

.product-cell { display: flex; align-items: center; gap: 12px; min-width: 280px; }
.product-img {
  width: 44px; height: 44px;
  border-radius: 8px;
  background: var(--bg-warm);
  object-fit: contain;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.product-img-placeholder {
  width: 44px; height: 44px;
  border-radius: 8px;
  background: var(--bg-warm);
  display: grid; place-items: center;
  color: var(--text-tertiary);
  font-size: 18px;
  flex-shrink: 0;
}
.product-info { min-width: 0; }
.product-info .title {
  font-size: 13px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 380px;
}
.product-info .sku {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
  margin-top: 2px;
}
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
}
.badge-green { background: var(--green-light); color: var(--green); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: var(--bg-warm); color: var(--text-secondary); }
.has-data .yes { color: var(--green); }
.has-data .no { color: var(--text-tertiary); }
.actions-cell { text-align: right; }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-warm);
  border: none;
  display: inline-grid; place-items: center;
  cursor: pointer;
  margin-left: 4px;
  transition: all 0.15s;
  color: var(--text);
}
.icon-btn:hover { background: var(--text); color: white; }

.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-warm);
}
.pagination .info { font-size: 12px; color: var(--text-secondary); }
.pagination .controls { display: flex; gap: 4px; }
.pagination button {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.pagination button:hover:not(:disabled) { border-color: var(--text); }
.pagination button.current { background: var(--text); color: white; border-color: var(--text); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: white;
  border-radius: 24px;
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.close-btn {
  background: none; border: none;
  font-size: 24px; color: var(--text-secondary);
  cursor: pointer; padding: 4px;
}
.modal-body { padding: 24px 32px; }
.modal-section { margin-bottom: 24px; }
.modal-section h3 {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.field { margin-bottom: 12px; }
.field label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 4px;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body); font-size: 13px;
  background: var(--bg);
  outline: none;
  color: var(--text);
  transition: all 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--text);
  background: white;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Specs JSON form */
.specs-grid { display: flex; flex-direction: column; gap: 8px; }
.spec-row {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 8px;
  align-items: center;
}
.spec-row input {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body); font-size: 13px;
  background: var(--bg);
  outline: none;
}
.spec-row input:focus { border-color: var(--text); background: white; }
.spec-row .key-input { font-weight: 600; }
.spec-row .delete-spec {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--red-light);
  color: var(--red);
  border: none;
  cursor: pointer;
  font-size: 16px;
}
.add-spec-btn {
  margin-top: 8px;
  padding: 8px 14px;
  border: 1.5px dashed var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.add-spec-btn:hover { border-color: var(--text); color: var(--text); }

/* Categories chips */
.category-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  min-height: 48px;
}
.category-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: var(--text); color: white;
  border-radius: 100px;
  font-size: 12px; font-weight: 500;
}
.category-chip .remove { cursor: pointer; opacity: 0.7; padding: 0 4px; }
.category-chip .remove:hover { opacity: 1; }

.modal-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-warm);
}
.modal-footer .danger {
  color: var(--red);
  background: none; border: none;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
}

/* Loading & empty states */
.loading {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--text);
  color: white;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
  z-index: 200;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
