/* ─── Dashboard — Cidrä Brand Hub ─── */

:root {
  --bg: #f8f5f0;
  --bg-warm: #f0ebe3;
  --bg-card: #faf8f5;
  --fg: #1a1714;
  --fg-muted: #6b5f53;
  --fg-light: #9a8d82;
  --accent: #c4956a;
  --accent-light: #dbb896;
  --accent-dark: #a07448;
  --border: rgba(196, 149, 106, 0.2);
  --border-strong: rgba(196, 149, 106, 0.4);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Outfit', system-ui, sans-serif;
  --shadow-sm: 0 1px 3px rgba(26,23,20,0.06), 0 1px 2px rgba(26,23,20,0.04);
  --shadow-md: 0 4px 16px rgba(26,23,20,0.08), 0 2px 6px rgba(26,23,20,0.04);
  --shadow-lg: 0 16px 48px rgba(26,23,20,0.12), 0 6px 16px rgba(26,23,20,0.06);
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ─── TOP NAV ─── */
.dash-nav {
  background: var(--fg);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.dash-nav-brand {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--bg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.dash-nav-brand span {
  color: var(--accent);
}

.dash-nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.dash-nav-label {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(248, 245, 240, 0.5);
}

.dash-nav-link {
  font-size: 0.85rem;
  color: rgba(248, 245, 240, 0.65);
  text-decoration: none;
  transition: color 0.2s;
}
.dash-nav-link:hover { color: var(--bg); }

/* ─── MAIN LAYOUT ─── */
.dash-main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

/* ─── PAGE HEADER ─── */
.dash-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.dash-header-text {}

.dash-header-pre {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 10px;
}

.dash-header h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  color: var(--fg);
}

.btn-add {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-add:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-add:active { transform: translateY(0); }

/* ─── STATS ROW ─── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

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

.stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-light);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 400;
  color: var(--fg);
  line-height: 1;
}

.stat-card.stat-low .stat-value { color: #b5820a; }
.stat-card.stat-out .stat-value { color: #9a4a3a; }

/* ─── FILTER BAR ─── */
.dash-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 16px;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 80px 40px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  opacity: 0.4;
}

.empty-state h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--fg);
  margin-bottom: 10px;
}

.empty-state p {
  font-size: 0.95rem;
  color: var(--fg-muted);
  margin-bottom: 28px;
}

/* ─── PRODUCT GRID ─── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s, transform 0.25s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.product-image {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--bg-warm);
  display: block;
}

.product-image-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--bg-warm) 0%, #e8e0d5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image-placeholder svg {
  opacity: 0.25;
}

.product-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--fg);
  margin-bottom: 8px;
  line-height: 1.2;
}

.product-desc {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
  /* Clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.product-price {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--fg);
}

.inventory-badge {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
}

.badge-in-stock {
  background: rgba(86, 149, 96, 0.12);
  color: #3d7a4b;
  border: 1px solid rgba(86, 149, 96, 0.25);
}

.badge-low {
  background: rgba(181, 130, 10, 0.1);
  color: #8a6200;
  border: 1px solid rgba(181, 130, 10, 0.25);
}

.badge-out {
  background: rgba(154, 74, 58, 0.1);
  color: #8a3a2a;
  border: 1px solid rgba(154, 74, 58, 0.2);
}

.product-actions {
  display: flex;
  gap: 6px;
  padding: 0 16px 16px;
  border-top: none;
}

.btn-edit, .btn-delete {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-edit {
  background: transparent;
  color: var(--fg-muted);
}
.btn-edit:hover {
  background: var(--bg-warm);
  border-color: var(--accent-light);
  color: var(--fg);
}

.btn-delete {
  background: transparent;
  color: var(--fg-light);
}
.btn-delete:hover {
  background: rgba(154, 74, 58, 0.08);
  border-color: rgba(154, 74, 58, 0.3);
  color: #8a3a2a;
}

/* ─── MODAL ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 23, 20, 0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in 0.2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 28px 32px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.7rem;
  color: var(--fg);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--fg-light);
  line-height: 1;
  padding: 4px;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--fg); }

.modal-body {
  padding: 24px 32px 32px;
}

/* ─── FORM ─── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  background: var(--bg-warm);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--fg);
  font-weight: 300;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 149, 106, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--fg-light);
  margin-top: 5px;
}

.img-preview {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  display: none;
  border: 1px solid var(--border);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-primary {
  flex: 1;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 24px;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 13px 24px;
  font-family: var(--sans);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--bg-warm); color: var(--fg); }

/* ─── TOAST ─── */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--fg);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.25s ease;
  max-width: 320px;
}

.toast.toast-error {
  background: #6b2020;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .dash-nav { padding: 0 20px; }
  .dash-main { padding: 32px 20px 60px; }
  .dash-header { flex-direction: column; align-items: flex-start; gap: 20px; }
  .product-grid { grid-template-columns: 1fr; }
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .modal { border-radius: 12px; }
  .modal-header, .modal-body { padding-left: 20px; padding-right: 20px; }
}
