/* =====================================================
   Planner Haven - Modern Etsy-Style Design System
   Uses the 10 Color Palettes from Python generators
   ===================================================== */

:root {
  /* Default (Warm Neutral) */
  --primary: #C5B3A6;
  --secondary: #E5DFDA;
  --accent: #9E8B7E;
  --text: #4A413B;
  --bg: #FAF9F8;
  --white: #FFFFFF;
  --dark: #1a1a1a;
  --gray-100: #f7f7f7;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-500: #737373;
  --gray-700: #404040;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --transition: 0.25s ease;
}

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

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

img { max-width: 100%; height: auto; display: block; }

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 1.25rem; }

/* ---- Header ---- */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 1.5rem;
}
.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo span { color: var(--accent); }

.nav-main { display: flex; gap: 1.75rem; align-items: center; }
.nav-main a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nav-main a:hover, .nav-main a.active { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 1rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: var(--white);
}
.btn-primary:hover { background: var(--text); color: var(--white); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
}
.btn-outline:hover { background: var(--accent); color: var(--white); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; }

.cart-badge {
  position: relative;
}
.cart-count {
  position: absolute;
  top: -6px; right: -8px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--bg) 50%, var(--primary) 100%);
  padding: 5rem 0 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.15;
  top: -100px; right: -80px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
}
.hero p {
  font-size: 1.15rem;
  color: var(--gray-700);
  max-width: 560px;
  margin: 0 auto 2rem;
}
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ---- Palette Swatches ---- */
.palette-bar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1.5rem 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}
.palette-swatch {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--white);
  box-shadow: 0 0 0 1px var(--gray-300);
  cursor: pointer;
  transition: transform 0.2s;
}
.palette-swatch:hover, .palette-swatch.active { transform: scale(1.2); box-shadow: 0 0 0 2px var(--accent); }

/* ---- Product Grid ---- */
.section { padding: 3.5rem 0; }
.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  text-align: center;
  margin-bottom: 0.5rem;
}
.section-sub {
  text-align: center;
  color: var(--gray-500);
  margin-bottom: 2.5rem;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.75rem;
}
.product-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
}
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}
.product-card .cover {
  aspect-ratio: 2/3;
  object-fit: cover;
  width: 100%;
  background: var(--secondary);
}
.product-card .body { padding: 1.15rem; }
.product-card .cat {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.product-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
  line-height: 1.35;
}
.product-card .price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.product-card .price .compare {
  font-size: 0.85rem;
  color: var(--gray-500);
  text-decoration: line-through;
  font-weight: 400;
  margin-left: 0.4rem;
}
.badge {
  position: absolute;
  top: 12px; left: 12px;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
}

/* ---- Filters ---- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
  justify-content: center;
}
.filter-chip {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--gray-300);
  background: var(--white);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  color: var(--gray-700);
}
.filter-chip:hover, .filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ---- Product Detail ---- */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  padding: 3rem 0;
}
@media (max-width: 900px) {
  .product-detail { grid-template-columns: 1fr; }
}
.gallery { position: sticky; top: 90px; }
.gallery .main-img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--secondary);
}
.thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  overflow-x: auto;
}
.thumbs img {
  width: 72px; height: 108px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.7;
}
.thumbs img.active, .thumbs img:hover { border-color: var(--accent); opacity: 1; }

.product-info h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.product-info .price-lg {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 1rem 0;
}
.variation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.6rem;
  margin: 1.25rem 0;
}
.var-swatch {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.var-swatch.active { border-color: var(--text); }
.var-swatch img { width: 100%; height: 100%; object-fit: cover; }
.var-label {
  font-size: 0.75rem;
  text-align: center;
  margin-top: 0.25rem;
  color: var(--gray-500);
}

/* ---- Blog ---- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}
.blog-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s;
}
.blog-card:hover { transform: translateY(-4px); }
.blog-card img { aspect-ratio: 16/10; object-fit: cover; width: 100%; }
.blog-card .body { padding: 1.5rem; }
.blog-card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.blog-card .meta { font-size: 0.8rem; color: var(--gray-500); margin-bottom: 0.75rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--gray-700);
}
.form-control {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(158,139,126,0.15);
}
textarea.form-control { min-height: 120px; resize: vertical; }
.alert {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info { background: #e0f2fe; color: #075985; }

/* ---- Auth ---- */
.auth-box {
  max-width: 420px;
  margin: 3rem auto;
  background: var(--white);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.auth-box h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 1.75rem;
}

/* ---- Cart / Checkout ---- */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
.cart-table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); }
.cart-summary {
  background: var(--white);
  padding: 1.75rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cart-summary .row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.cart-summary .total {
  font-size: 1.25rem;
  font-weight: 700;
  border-top: 1px solid var(--gray-200);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

/* ---- Admin ---- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px;
  background: var(--dark);
  color: white;
  padding: 1.5rem 0;
  flex-shrink: 0;
}
.admin-sidebar .logo { color: white; padding: 0 1.25rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 1rem; }
.admin-sidebar a {
  display: block;
  padding: 0.7rem 1.25rem;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  transition: var(--transition);
}
.admin-sidebar a:hover, .admin-sidebar a.active {
  background: rgba(255,255,255,0.08);
  color: white;
}
.admin-content { flex: 1; padding: 2rem; background: var(--gray-100); overflow-x: auto; }
.admin-content h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.table-responsive { overflow-x: auto; background: white; border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 0.85rem 1rem; text-align: left; border-bottom: 1px solid var(--gray-200); font-size: 0.9rem; }
table.data th { background: var(--gray-100); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
table.data tr:hover td { background: var(--gray-50, #fafafa); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-card .label { font-size: 0.8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; margin-top: 0.35rem; }

/* ---- Footer ---- */
.site-footer {
  background: var(--text);
  color: rgba(255,255,255,0.8);
  padding: 3.5rem 0 2rem;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav-main { display: none; }
}
.site-footer h4 {
  color: white;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}
.site-footer a { color: rgba(255,255,255,0.65); font-size: 0.9rem; display: block; margin-bottom: 0.4rem; }
.site-footer a:hover { color: white; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* ---- Utilities ---- */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* SEO / Schema friendly */
.breadcrumb { font-size: 0.85rem; color: var(--gray-500); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--gray-500); }
.breadcrumb span { margin: 0 0.4rem; }

/* Loading */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--secondary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
