/* ============================================================
   Niche Website Design System — Based on TressTreasureCo.com
   Font: DM Sans (primary), Roboto (fallback)
   Colors: Configurable via CSS custom properties per site
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Roboto:wght@400;500;700&display=swap');

:root {
  --font-primary: 'DM Sans', sans-serif;
  --font-secondary: 'Roboto', sans-serif;
  --color-dark: #1d1e20;
  --color-gray: #727586;
  --color-gray-border: #dadce0;
  --color-gray-light: #f2f3f6;
  --color-light: #fff;
  --color-success: #00b090;
  --color-danger: #fc5185;
  --content-width: 1224px;
  --block-padding: 64px 24px;
}

*, *:before, *:after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; }
body {
  height: 100%;
  font-family: var(--font-primary);
  color: var(--color-dark);
  background: var(--color-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}
button { font-family: var(--font-primary); cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* === PROMO BAR === */
.promo-bar {
  background: var(--color-dark);
  color: var(--color-light);
  text-align: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* === HEADER === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-light);
  border-bottom: 1px solid var(--color-gray-border);
  padding: 0 24px;
}
.header-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.3px;
  text-decoration: none;
}
.logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
nav { display: flex; align-items: center; gap: 32px; }
nav a {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-dark);
  transition: color 0.2s;
  position: relative;
}
nav a:hover, nav a.active {
  color: var(--primary-color);
}
nav a.active:after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-color);
  border-radius: 1px;
}
.header-actions { display: flex; align-items: center; gap: 16px; }
.btn-cart {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1.5px solid var(--color-gray-border);
  border-radius: 8px;
  background: var(--color-light);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.2s;
}
.btn-cart:hover { border-color: var(--primary-color); }
.cart-count {
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* === HERO === */
.hero {
  position: relative;
  width: 100%;
  min-height: 480px;
  display: flex;
  align-items: center;
  background: var(--hero-bg, linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%));
  overflow: hidden;
}
.hero-content {
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;
  padding: 80px 24px;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}
.hero-text { flex: 1; }
.hero-text h1 {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-light);
  margin-bottom: 16px;
}
.hero-text p {
  font-size: 20px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 32px;
  max-width: 480px;
}
.hero-image {
  flex: 1;
  display: flex;
  justify-content: center;
}
.hero-image img {
  max-height: 360px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--color-light);
  color: var(--primary-color);
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* === SECTION TITLES === */
.section-title {
  text-align: center;
  padding: 64px 24px 40px;
  max-width: var(--content-width);
  margin: 0 auto;
}
.section-title h2 {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: 12px;
}
.section-title p {
  font-size: 18px;
  color: var(--color-gray);
}

/* === PRODUCT GRID === */
.products-section {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px 64px;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}
.product-card {
  background: var(--color-light);
  border: 1px solid var(--color-gray-border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  position: relative;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
}
.product-image {
  position: relative;
  width: 100%;
  padding-top: 100%;
  background: var(--color-gray-light);
  overflow: hidden;
}
.product-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.product-card:hover .product-image img {
  transform: scale(1.05);
}
.product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
}
.badge-best { background: var(--primary-color); color: white; }
.badge-new { background: var(--color-dark); color: white; }
.badge-natural { background: #00b090; color: white; }
.badge-premium { background: #6366F1; color: white; }
.badge-popular { background: #f59e0b; color: white; }
.badge-essential { background: #ef4444; color: white; }
.badge-gourmet { background: #8B4513; color: white; }
.badge-organic { background: #15803d; color: white; }

.product-info {
  padding: 16px;
}
.product-info h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-dark);
  margin-bottom: 6px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-info p {
  font-size: 13px;
  color: var(--color-gray);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
}
.btn-add-to-cart {
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}
.btn-add-to-cart:hover {
  background: var(--primary-dark);
}

/* === SORT BAR === */
.sort-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-gray-border);
}
.sort-bar label {
  font-size: 14px;
  color: var(--color-gray);
}
.sort-bar select {
  padding: 8px 12px;
  border: 1px solid var(--color-gray-border);
  border-radius: 8px;
  font-family: var(--font-primary);
  font-size: 14px;
  background: var(--color-light);
  cursor: pointer;
}
.result-count {
  font-size: 14px;
  color: var(--color-gray);
}

/* === PAGINATION === */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  padding: 24px 0;
}
.pagination button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-gray-border);
  border-radius: 8px;
  background: var(--color-light);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.pagination button:hover:not(:disabled) {
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.pagination button.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* === FOOTER === */
.site-footer {
  background: var(--color-dark);
  color: var(--color-gray-light);
  padding: 64px 24px 32px;
  margin-top: 80px;
}
.footer-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
}
.footer-brand h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-light);
  margin-bottom: 12px;
}
.footer-brand p {
  font-size: 14px;
  color: var(--color-gray);
  line-height: 1.7;
  max-width: 320px;
}
.footer-col h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 20px;
}
.footer-col a {
  display: block;
  font-size: 14px;
  color: var(--color-gray);
  margin-bottom: 10px;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--color-light); }
.footer-bottom {
  max-width: var(--content-width);
  margin: 48px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 13px;
  color: var(--color-gray);
  text-align: center;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29,30,32,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-content {
  background: var(--color-light);
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 40px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-gray-light);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: var(--color-gray-border); }
.modal-image img {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
}
.modal-details h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.modal-details .modal-subtitle {
  font-size: 16px;
  color: var(--color-gray);
  margin-bottom: 20px;
}
.modal-details .modal-price {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 24px;
}
.modal-details .modal-desc {
  font-size: 15px;
  color: var(--color-dark);
  line-height: 1.7;
  margin-bottom: 24px;
}
.qty-selector {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
}
.qty-selector button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-gray-border);
  background: var(--color-light);
  font-size: 18px;
  font-weight: 600;
}
.qty-selector button:first-child { border-radius: 8px 0 0 8px; }
.qty-selector button:last-child { border-radius: 0 8px 8px 0; }
.qty-selector input {
  width: 60px;
  height: 44px;
  text-align: center;
  border: 1px solid var(--color-gray-border);
  border-left: none;
  border-right: none;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
}
.btn-buy-now {
  width: 100%;
  padding: 16px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  transition: background 0.2s;
}
.btn-buy-now:hover { background: var(--primary-dark); }

/* === CATEGORY PAGE === */
.category-header {
  background: var(--secondary-color);
  padding: 48px 24px;
  text-align: center;
}
.category-header h1 {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
}
.category-header p {
  font-size: 18px;
  color: var(--color-gray);
}

/* === ABOUT PAGE === */
.about-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 64px 24px;
}
.about-section h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--primary-dark);
}
.about-section p {
  font-size: 17px;
  line-height: 1.8;
  color: var(--color-dark);
  margin-bottom: 20px;
}

/* === RESPONSIVE === */
@media (max-width: 920px) {
  .hero-content { flex-direction: column; text-align: center; padding: 48px 24px; }
  .hero-text h1 { font-size: 32px; }
  .hero-text p { font-size: 16px; margin: 0 auto 24px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .modal-content { grid-template-columns: 1fr; padding: 24px; }
  nav { display: none; }
  .header-inner { height: 60px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hero-text h1 { font-size: 26px; }
  .section-title h2 { font-size: 26px; }
  .footer-inner { grid-template-columns: 1fr; }
}

/* === CART SIDEBAR === */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: var(--color-light);
  z-index: 300;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}
.cart-sidebar.open { right: 0; }
.cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 299;
  display: none;
}
.cart-backdrop.open { display: block; }
.cart-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-gray-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cart-header h3 { font-size: 18px; font-weight: 700; }
.cart-items { flex: 1; overflow-y: auto; padding: 16px 24px; }
.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-gray-border);
}
.cart-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.cart-item-info { flex: 1; }
.cart-item-info h4 { font-size: 13px; font-weight: 600; }
.cart-item-info p { font-size: 12px; color: var(--color-gray); }
.cart-item-price { font-size: 14px; font-weight: 700; color: var(--primary-color); }
.cart-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--color-gray-border);
}
.cart-total { display: flex; justify-content: space-between; margin-bottom: 16px; font-size: 18px; font-weight: 700; }
.btn-checkout {
  width: 100%;
  padding: 14px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
}
.btn-checkout:hover { background: var(--primary-dark); }
.empty-cart {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-gray);
  font-size: 16px;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-dark);
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 400;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }
