/* ============================================================
   AEQUITAS MARKET — Design System
   Brand: Navy-to-amber gradient, gold accents, coral CTAs
   Typography: Playfair Display (display) + DM Sans (body)
   ============================================================ */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* --- CSS Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- Design Tokens --- */
:root {
  /* Brand Colors */
  --navy-deep: #0a1628;
  --navy: #0f2140;
  --navy-light: #162d54;
  --navy-mid: #1a3a6b;
  
  --amber: #d4a843;
  --amber-light: #e8c66a;
  --amber-glow: #f0d78a;
  --gold: #c9952b;
  --gold-dark: #a67c1e;
  
  --coral: #e85d6c;
  --coral-hover: #d94a5a;
  --coral-light: #ff7a87;
  
  --cream: #faf6ee;
  --cream-dark: #f0e8d8;
  
  /* Neutrals */
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Semantic Colors */
  --success: #22c55e;
  --success-light: #dcfce7;
  --warning: #eab308;
  --warning-light: #fef9c3;
  --error: #ef4444;
  --error-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;
  
  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  
  /* Layout */
  --max-width: 1200px;
  --max-width-narrow: 800px;
  --max-width-form: 560px;
  --sidebar-width: 280px;
  
  /* Borders & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --border-light: 1px solid var(--gray-200);
  --border-gold: 1px solid var(--amber);
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 50px rgba(0, 0, 0, 0.16);
  --shadow-glow: 0 0 20px rgba(212, 168, 67, 0.25);
  --shadow-coral: 0 4px 16px rgba(232, 93, 108, 0.3);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Base Styles --- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--gray-800);
  background: var(--cream);
  min-height: 100vh;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  color: var(--navy);
  font-weight: 600;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }

p { margin-bottom: var(--space-4); }

a {
  color: var(--coral);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--coral-hover); }

/* --- Layout Components --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

.container--form {
  max-width: var(--max-width-form);
}

/* --- Navigation Bar --- */
.navbar {
  background: var(--navy-deep);
  border-bottom: 2px solid var(--amber);
  padding: var(--space-4) 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.navbar__logo-mark {
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 24px solid var(--amber);
  filter: drop-shadow(0 0 6px rgba(212, 168, 67, 0.4));
}

.navbar__logo-text {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
}

.navbar__logo-text span {
  color: var(--amber);
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
}

.navbar__link {
  color: var(--gray-300);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition-fast);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.navbar__link:hover {
  color: var(--amber-light);
}

.navbar__link--active {
  color: var(--amber);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}

.btn--primary {
  background: var(--coral);
  color: var(--white);
  box-shadow: var(--shadow-coral);
}
.btn--primary:hover {
  background: var(--coral-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232, 93, 108, 0.4);
}

.btn--secondary {
  background: var(--navy);
  color: var(--white);
}
.btn--secondary:hover {
  background: var(--navy-light);
  transform: translateY(-1px);
}

.btn--gold {
  background: linear-gradient(135deg, var(--amber), var(--gold));
  color: var(--navy-deep);
  font-weight: 700;
}
.btn--gold:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn--outline {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--gray-300);
}
.btn--outline:hover {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--white);
}

.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

.btn--full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.form-label--required::after {
  content: " *";
  color: var(--coral);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.15);
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--error);
  margin-top: var(--space-1);
}

/* --- Cards --- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

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

.card__image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--gray-100);
}

.card__body {
  padding: var(--space-5);
}

.card__title {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-1);
}

.card__price {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--navy);
}

.card__meta {
  font-size: var(--text-sm);
  color: var(--gray-500);
}

/* --- Product Grid --- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-6);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge--founding {
  background: linear-gradient(135deg, var(--amber), var(--gold));
  color: var(--navy-deep);
}

.badge--active {
  background: var(--success-light);
  color: #166534;
}

.badge--pending {
  background: var(--warning-light);
  color: #854d0e;
}

.badge--sold {
  background: var(--info-light);
  color: #1e40af;
}

.badge--removed {
  background: var(--error-light);
  color: #991b1b;
}

.badge--local-partner {
  background: var(--navy);
  color: var(--amber);
}

/* --- Status Indicators --- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: var(--space-2);
}

.status-dot--active { background: var(--success); }
.status-dot--pending { background: var(--warning); }
.status-dot--error { background: var(--error); }

/* --- Page Header --- */
.page-header {
  background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 50%, var(--navy-mid) 100%);
  padding: var(--space-12) 0;
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(212, 168, 67, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.page-header h1 {
  color: var(--white);
  margin-bottom: var(--space-3);
}

.page-header p {
  color: var(--gray-400);
  font-size: var(--text-lg);
}

/* --- Auth Pages --- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 60%, var(--navy-mid) 100%);
  padding: var(--space-8);
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  top: 10%;
  left: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(212, 168, 67, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-10);
  width: 100%;
  max-width: 460px;
  position: relative;
}

.auth-card__logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-card__title {
  text-align: center;
  margin-bottom: var(--space-2);
}

.auth-card__subtitle {
  text-align: center;
  color: var(--gray-500);
  font-size: var(--text-sm);
  margin-bottom: var(--space-8);
}

.auth-card__divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0;
  color: var(--gray-400);
  font-size: var(--text-sm);
}

.auth-card__divider::before,
.auth-card__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.auth-card__footer {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--gray-500);
}

/* --- Alert Messages --- */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.alert--success {
  background: var(--success-light);
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert--error {
  background: var(--error-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert--warning {
  background: var(--warning-light);
  color: #854d0e;
  border: 1px solid #fde68a;
}

.alert--info {
  background: var(--info-light);
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* --- Dashboard Layout --- */
.dashboard {
  display: flex;
  min-height: calc(100vh - 64px);
}

.dashboard__sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: var(--border-light);
  padding: var(--space-6) 0;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.dashboard__main {
  flex: 1;
  padding: var(--space-8);
  max-width: calc(100% - var(--sidebar-width));
}

.sidebar-nav__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  color: var(--gray-600);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

.sidebar-nav__item:hover {
  background: var(--gray-50);
  color: var(--navy);
}

.sidebar-nav__item--active {
  color: var(--navy);
  background: rgba(212, 168, 67, 0.08);
  border-left-color: var(--amber);
  font-weight: 600;
}

/* --- Table --- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: var(--border-light);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th {
  background: var(--gray-50);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  border-bottom: var(--border-light);
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-light);
  color: var(--gray-700);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: var(--gray-50);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--gray-400);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--gray-600);
  margin-bottom: var(--space-2);
}

.empty-state__text {
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}

/* --- Loading Spinner --- */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

/* --- Footer --- */
.footer {
  background: var(--navy-deep);
  color: var(--gray-400);
  padding: var(--space-12) 0 var(--space-8);
  border-top: 2px solid var(--amber);
}

.footer a {
  color: var(--amber-light);
}

.footer a:hover {
  color: var(--amber);
}

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-gold { color: var(--amber); }
.text-coral { color: var(--coral); }
.text-muted { color: var(--gray-500); }
.text-navy { color: var(--navy); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.hidden { display: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  :root {
    --text-4xl: 1.875rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
  }

  .container { padding: 0 var(--space-4); }

  .navbar__links { display: none; } /* Toggle with JS */

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }

  .dashboard {
    flex-direction: column;
  }

  .dashboard__sidebar {
    width: 100%;
    height: auto;
    position: relative;
    top: 0;
    border-right: none;
    border-bottom: var(--border-light);
  }

  .dashboard__main {
    max-width: 100%;
    padding: var(--space-4);
  }

  .auth-card {
    padding: var(--space-6);
  }
}

@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}
