/* Main Stylesheet - Lovable Inspired Theme */

@import url('design-tokens.css');
@import url('components.css');

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

body {
  background-color: var(--bg-cream);
  color: var(--text-charcoal);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-semibold);
  color: var(--text-charcoal);
  line-height: 1.1;
}

.heading-display {
  font-size: var(--fs-60);
  letter-spacing: var(--ls-60);
  font-weight: var(--fw-semibold);
}

.heading-display-alt {
  font-size: var(--fs-60);
  letter-spacing: normal;
  font-weight: var(--fw-medium);
}

.heading-section {
  font-size: var(--fs-48);
  letter-spacing: var(--ls-48);
  font-weight: var(--fw-semibold);
}

.heading-sub {
  font-size: var(--fs-36);
  letter-spacing: var(--ls-36);
  font-weight: var(--fw-semibold);
}

.heading-card {
  font-size: var(--fs-20);
  font-weight: var(--fw-normal);
  line-height: 1.25;
}

.text-large {
  font-size: var(--fs-18);
  color: var(--text-muted);
  line-height: 1.38;
}

.text-muted {
  color: var(--text-muted);
}

.text-center {
  text-align: center;
}

/* Common Layout Containers */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* Hero Section */
.hero {
  padding: var(--space-9) 0 var(--space-8);
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Warm multi-color gradient wash behind hero */
.hero::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(253,203,110,0.12) 0%, rgba(250,177,160,0.1) 40%, rgba(116,185,255,0.06) 80%, rgba(247,244,237,0) 100%);
  z-index: 1;
  pointer-events: none;
  border-radius: 50%;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
}

.hero-title {
  margin-bottom: var(--space-3);
  line-height: 1.05;
}

.hero-subtitle {
  margin-bottom: var(--space-5);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
}

/* Product Section & Grid */
.product-section {
  padding: var(--space-6) 0 var(--space-9);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-passive);
  padding-bottom: var(--space-3);
}

.filter-bar {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.search-bar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  max-width: 400px;
  width: 100%;
}

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

.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-cream);
  border: 1px solid var(--border-passive);
  border-radius: var(--radius-card);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-interactive);
}

.product-card-img-wrapper {
  aspect-ratio: 1;
  width: 100%;
  background-color: var(--color-charcoal-03);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-passive);
  overflow: hidden;
}

.product-card-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-card-img {
  transform: scale(1.05);
}

.product-card-content {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card-category {
  font-size: 12px;
  color: var(--color-muted);
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

.product-card-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-charcoal);
  margin-bottom: var(--space-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 48px;
}

.product-card-price {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-charcoal);
  margin-top: auto;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

/* Product Detail Page */
.product-detail-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-6);
  padding: var(--space-6) 0;
  align-items: start;
}

.product-gallery {
  border: 1px solid var(--border-passive);
  border-radius: var(--radius-card);
  background-color: var(--color-charcoal-03);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.product-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.product-info-title {
  font-size: 32px;
  line-height: 1.2;
}

.product-info-price {
  font-size: 26px;
  font-weight: 600;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-passive);
}

.product-info-desc {
  font-size: 16px;
  color: var(--color-charcoal-82);
  line-height: 1.6;
}

.product-meta-row {
  display: flex;
  gap: var(--space-4);
  font-size: 14px;
  color: var(--color-muted);
}

.quantity-selector {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-passive);
  border-radius: var(--radius-standard);
  width: fit-content;
  background-color: var(--bg-cream);
}

.quantity-btn {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  color: var(--color-charcoal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-input {
  width: 40px;
  text-align: center;
  border: none;
  background: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-charcoal);
  -moz-appearance: textfield;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Forms pages (Login, Register) */
.form-container {
  max-width: 400px;
  margin: var(--space-8) auto;
}

.form-header {
  text-align: center;
  margin-bottom: var(--space-5);
}

.form-footer {
  text-align: center;
  margin-top: var(--space-4);
  font-size: 14px;
  color: var(--color-muted);
}

/* Cart Page */
.cart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-6);
  padding: var(--space-5) 0;
  align-items: start;
}

.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cart-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  background-color: var(--bg-cream);
  border: 1px solid var(--border-passive);
  border-radius: var(--radius-card);
  align-items: center;
}

.cart-item-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  background-color: var(--color-charcoal-03);
  border: 1px solid var(--border-passive);
  border-radius: var(--radius-comfortable);
}

.cart-item-info {
  flex-grow: 1;
}

.cart-item-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 2px;
}

.cart-item-price {
  font-size: 15px;
  font-weight: 600;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.cart-summary {
  background-color: var(--bg-cream);
  border: 1px solid var(--border-passive);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  position: sticky;
  top: 90px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  font-size: 15px;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-passive);
  padding-top: var(--space-3);
  margin-top: var(--space-3);
  font-size: 18px;
  font-weight: 600;
}

/* Order (Checkout) Page */
.order-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-6);
  padding: var(--space-5) 0;
  align-items: start;
}

/* My Page */
.mypage-grid {
  display: grid;
  grid-template-columns: 0.8fr 2.2fr;
  gap: var(--space-6);
  padding: var(--space-5) 0;
  align-items: start;
}

.mypage-tabs {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.mypage-tab-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-muted);
  cursor: pointer;
  border-radius: var(--radius-standard);
  transition: all 0.2s ease;
}

.mypage-tab-btn:hover {
  background-color: var(--color-charcoal-04);
  color: var(--color-charcoal);
}

.mypage-tab-btn.active {
  background-color: var(--color-charcoal);
  color: var(--color-offwhite);
  box-shadow: var(--button-inset-shadow);
}

.order-history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.order-history-card {
  border: 1px solid var(--border-passive);
  border-radius: var(--radius-card);
  padding: var(--space-4);
}

.order-history-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-passive);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-3);
  font-size: 14px;
}

/* Responsive Styles - Breakpoints matching Spec */

/* Large Desktop (> 1280px) */
@media (min-width: 1280px) {
  .container {
    max-width: 1200px;
    margin: 0 auto;
  }
}

/* Desktop & Desktop Small (768px - 1280px) */
@media (max-width: 1280px) {
  .container {
    max-width: 100%;
    padding: 0 var(--space-4);
  }
}

@media (max-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablet & Tablet Small (640px - 768px) */
@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .product-detail-grid,
  .cart-grid,
  .order-grid,
  .mypage-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .footer-container {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Font Scaling: 60px -> 48px */
  .heading-display, .heading-display-alt {
    font-size: var(--fs-48);
    letter-spacing: var(--ls-48);
  }
  
  .heading-section {
    font-size: var(--fs-36);
    letter-spacing: var(--ls-36);
  }

  .nav-links {
    display: none; /* Hamburger menu toggle recommended at <768px */
  }
  
  .hero {
    padding: var(--space-7) 0 var(--space-6);
  }
}

/* Tablet Small (640px - 700px) / Mobile Begin (600px - 640px) */
@media (max-width: 700px) {
  .footer-container {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

/* Mobile & Mobile Small (< 600px) */
@media (max-width: 600px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
  
  .hero {
    padding: var(--space-6) 0 var(--space-5);
  }
  
  /* Font Scaling: 48px -> 36px */
  .heading-display, .heading-display-alt {
    font-size: var(--fs-36);
    letter-spacing: var(--ls-36);
  }
  
  .heading-section {
    font-size: var(--fs-20);
    letter-spacing: normal;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: var(--space-2);
    text-align: center;
  }
  
  /* Spacing Collapsing to 64px at section boundaries */
  .product-section {
    padding: var(--space-5) 0 var(--space-7); /* Roughly 32px to 56px */
  }
}
