/* Stitch AI Design System - Main E-Commerce Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  /* Color Palette - Premium Slate & Indigo */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #0f172a;
  --accent: #10b981;
  --accent-hover: #059669;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --bg-main: #f8fafc;
  --surface: #ffffff;
  --surface-secondary: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #818cf8;
  
  /* Shadows & Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.25);
  
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', var(--font-sans);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--secondary);
  line-height: 1.25;
  font-weight: 700;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

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

/* Utility Containers */
.container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Announcement Bar */
.announcement-bar {
  background: linear-gradient(90deg, #0f172a 0%, #1e1b4b 100%);
  color: #ffffff;
  font-size: 0.875rem;
  padding: 0.625rem 1rem;
  text-align: center;
  font-weight: 500;
  position: relative;
  z-index: 50;
}

/* Header & Glass Navigation */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  transition: background-color 0.3s ease;
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.5rem;
  gap: 2rem;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo span {
  color: var(--primary);
}

.search-bar {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.625rem 1rem 0.625rem 2.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface-secondary);
  outline: none;
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 1.25rem;
  height: 1.25rem;
  pointer-events: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  position: relative;
  transition: background-color 0.2s ease;
}

.nav-btn:hover {
  background-color: var(--surface-secondary);
  color: var(--primary);
}

.badge-count {
  position: absolute;
  top: 0.125rem;
  right: 0.125rem;
  background-color: var(--primary);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Category Navigation Bar */
.cat-nav {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.cat-nav-list {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
  overflow-x: auto;
  padding: 0.75rem 0;
  scrollbar-width: none;
}

.cat-nav-link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.cat-nav-link:hover, .cat-nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-size: 0.9375rem;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

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

.btn-secondary {
  background-color: var(--secondary);
  color: #ffffff;
}

.btn-secondary:hover {
  background-color: #1e293b;
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--surface-secondary);
  border-color: var(--text-light);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.0625rem;
  border-radius: var(--radius-lg);
}

.btn-full {
  width: 100%;
}

/* Cards & Product Grids */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.product-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.product-card-img-wrapper {
  position: relative;
  aspect-ratio: 1 / 1;
  background-color: var(--surface-secondary);
  overflow: hidden;
}

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

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

.product-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 10;
}

.badge-sale { background-color: var(--danger); color: #ffffff; }
.badge-featured { background-color: var(--primary); color: #ffffff; }

.wishlist-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  z-index: 10;
}

.wishlist-btn:hover, .wishlist-btn.active {
  background: #ffffff;
  color: var(--danger);
  transform: scale(1.1);
}

.product-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-category {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.product-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 0.5rem;
  line-clamp: 2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
}

.product-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--secondary);
}

.product-sale-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--danger);
}

.product-old-price {
  font-size: 0.875rem;
  color: var(--text-light);
  text-decoration: line-through;
}

/* Badges System */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}

/* Hero Section */
.hero {
  position: relative;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  color: #ffffff;
  padding: 5rem 0;
  overflow: hidden;
  border-radius: var(--radius-xl);
  margin-top: 1.5rem;
  margin-bottom: 3rem;
}

.hero-content {
  position: relative;
  z-index: 10;
  max-width: 600px;
}

.hero-title {
  font-size: 3.25rem;
  color: #ffffff;
  margin-bottom: 1.25rem;
  line-height: 1.1;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: #94a3b8;
  margin-bottom: 2rem;
}

/* Footer */
.footer {
  background-color: var(--secondary);
  color: #94a3b8;
  padding: 4rem 0 2rem 0;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 3rem;
  margin-bottom: 3rem;
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
}

.footer-heading {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
}

/* Flash Toasts */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--secondary);
  color: #ffffff;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Mobile UI Fit & Screen Width Bounds Fixes */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

@media (max-width: 640px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Table horizontal scroll wrapper for mobile */
  .table-responsive, table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent button and grid text clipping on small phones */
  input, select, textarea, button {
    max-width: 100%;
  }
  
  .hero-slide h1 {
    font-size: 1.75rem !important;
    line-height: 1.2 !important;
  }
}
