/*
  ==================================================================
  Variables
  ==================================================================
*/
:root {
  /* Color Palette */
  --color-background: #f5f7fb;
  --color-surface: #ffffff;
  --color-surface-alt: #f0f3f9;

  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-border-subtle: #e5e7eb;
  --color-border-strong: #cbd5f5;

  --color-primary: #1d4ed8; /* professional blue */
  --color-primary-soft: #e0ebff;
  --color-primary-strong: #1e3a8a;

  --color-success: #059669;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-info: #0ea5e9;

  --color-neutral-50: #f9fafb;
  --color-neutral-100: #f3f4f6;
  --color-neutral-200: #e5e7eb;
  --color-neutral-300: #d1d5db;
  --color-neutral-400: #9ca3af;
  --color-neutral-500: #6b7280;
  --color-neutral-600: #4b5563;
  --color-neutral-700: #374151;
  --color-neutral-800: #1f2933;
  --color-neutral-900: #111827;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-base: 1rem;    /* 16px */
  --text-lg: 1.125rem;  /* 18px */
  --text-xl: 1.25rem;   /* 20px */
  --text-2xl: 1.5rem;   /* 24px */
  --text-3xl: 1.875rem; /* 30px */
  --text-4xl: 2.25rem;  /* 36px */

  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* Spacing (0 – 96px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radius */
  --radius-sm: 0.25rem;  /* 4px */
  --radius-md: 0.5rem;   /* 8px */
  --radius-lg: 0.75rem;  /* 12px */
  --radius-xl: 1rem;     /* 16px */
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-normal: 180ms ease-out;
  --transition-slow: 250ms ease-out;
}

/*
  ==================================================================
  Reset / Normalize
  ==================================================================
*/
*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
}

h1, h2, h3, h4, h5, h6,
p, figure, blockquote,
dl, dd {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
  margin: 0;
}

img,
picture,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

textarea {
  resize: vertical;
}

:focus {
  outline: none;
}

/*
  ==================================================================
  Base Styles
  ==================================================================
*/
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  background-color: var(--color-background);
  color: var(--color-text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main {
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--color-text);
}

h1 { font-size: var(--text-4xl); margin-bottom: var(--space-4); }
h2 { font-size: var(--text-3xl); margin-bottom: var(--space-3); }
h3 { font-size: var(--text-2xl); margin-bottom: var(--space-3); }
h4 { font-size: var(--text-xl);  margin-bottom: var(--space-2); }
h5 { font-size: var(--text-lg);  margin-bottom: var(--space-2); }
h6 { font-size: var(--text-base); margin-bottom: var(--space-1); text-transform: uppercase; letter-spacing: 0.04em; }

p {
  margin-bottom: var(--space-3);
  line-height: var(--leading-relaxed);
  }

p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: 600;
}

small {
  font-size: var(--text-xs);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-normal);
}

a:hover {
  color: var(--color-primary-strong);
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  margin: var(--space-6) 0;
}

code, pre {
  font-family: var(--font-mono);
}

/*
  ==================================================================
  Accessibility & Motion
  ==================================================================
*/
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/*
  ==================================================================
  Layout Utilities
  ==================================================================
*/
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}

/* Flex utilities */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-column { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* Grid utilities */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-gap-4 { gap: var(--space-4); }
.grid-gap-6 { gap: var(--space-6); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Alignment helpers */
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Width helpers for marketplace layout (filters/listing/summary) */
.w-full { width: 100%; }
.w-1-3 { width: 33.333%; }
.w-2-3 { width: 66.666%; }

@media (max-width: 1024px) {
  .w-1-3, .w-2-3 {
    width: 100%;
  }
}

/* Spacing utilities (limited, for cleanliness) */
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.p-4 { padding: var(--space-4); }

/*
  ==================================================================
  Components
  ==================================================================
*/
/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem; /* 10px 20px */
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  background-color: var(--color-primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
  transition:
    background-color var(--transition-normal),
    border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    transform var(--transition-fast);
}

.btn:hover {
  background-color: var(--color-primary-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn[disabled],
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  transform: none;
}

.btn--secondary {
  background-color: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-border-subtle);
  box-shadow: none;
}

.btn--secondary:hover {
  background-color: var(--color-primary-soft);
  border-color: var(--color-border-strong);
}

.btn--ghost {
  background-color: transparent;
  color: var(--color-text);
  border-color: transparent;
  box-shadow: none;
}

.btn--ghost:hover {
  background-color: var(--color-neutral-100);
}

.btn--danger {
  background-color: var(--color-danger);
}

.btn--danger:hover {
  background-color: #b91c1c;
}

/* Inputs & Form Controls */
.input,
select,
textarea {
  width: 100%;
  padding: 0.625rem 0.75rem; /* 10px 12px */
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background-color: var(--color-surface);
  font-size: var(--text-sm);
  line-height: 1.4;
  transition:
    border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    background-color var(--transition-normal);
}

.input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
}

.input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary-soft);
  outline: 2px solid var(--color-primary-soft);
  outline-offset: 1px;
}

.input[disabled],
select[disabled],
textarea[disabled] {
  background-color: var(--color-neutral-100);
  cursor: not-allowed;
}

/* Basic label for form clarity */
.label {
  display: inline-flex;
  align-items: center;
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}

.label span {
  margin-left: var(--space-1);
  font-weight: 400;
  color: var(--color-text-muted);
}

/* Cards (product tiles, seller profiles, info blocks) */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  transition:
    box-shadow var(--transition-normal),
    transform var(--transition-fast),
    border-color var(--transition-normal);
}

.card--interactive {
  cursor: pointer;
}

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

.card-header {
  margin-bottom: var(--space-3);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.card-footer {
  margin-top: var(--space-4);
}

/* Badges (for verified, status, category chips) */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  background-color: var(--color-neutral-100);
  color: var(--color-neutral-700);
}

.badge--primary {
  background-color: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

.badge--success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.badge--danger {
  background-color: rgba(248, 113, 113, 0.12);
  color: var(--color-danger);
}

/*
  ==================================================================
  Marketplace-specific Base Helpers
  ==================================================================
*/
/* Product imagery framing */
.product-image {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background-color: var(--color-neutral-100);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Rating (stars) container */
.rating {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Subtle info strip (e.g., trust & benefits bar) */
.info-strip {
  background: linear-gradient(90deg, #e0ebff, #f5f7fb);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
}

/* Tables (for order management) */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}

.table thead {
  background-color: var(--color-surface-alt);
}

.table th,
.table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border-subtle);
}

.table th {
  font-weight: 500;
  color: var(--color-text-muted);
}

.table tbody tr:hover {
  background-color: var(--color-neutral-50);
}

/* Status pills for orders */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
}

.status-pill--success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.status-pill--warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.status-pill--danger {
  background-color: rgba(248, 113, 113, 0.12);
  color: var(--color-danger);
}

/*
  ==================================================================
  End of base.css
  ==================================================================
*/
