:root {
  --primary: #42f59e;
  --secondary: #1a1a1a;
  --accent: #ffffff;
  --success: #10b981;
  --error: #ef4444;
  --font-heading: 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html { overflow-x: hidden; height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--secondary);
  background: var(--accent);
  line-height: 1.5;
  overflow-x: hidden;
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

footer {
  flex-shrink: 0;
}

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; }

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

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

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

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  background: var(--accent);
  z-index: 100;
}
.navbar .logo { height: 28px; }
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: var(--secondary);
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle span::before { position: absolute; top: -7px; }
.nav-toggle span::after { position: absolute; top: 7px; }
.nav-toggle.is-open span { background: transparent; }
.nav-toggle.is-open span::before { transform: translateY(7px) rotate(45deg); background: var(--secondary); }
.nav-toggle.is-open span::after { transform: translateY(-7px) rotate(-45deg); background: var(--secondary); }

.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-weight: 600; }
.nav-links a:hover { color: var(--primary); }
.cart-link { position: relative; }
.cart-badge {
  position: absolute; top: -8px; right: -12px;
  background: var(--secondary); color: var(--primary);
  border-radius: 999px; font-size: 0.7rem; padding: 1px 6px;
}

/* Language switcher */
.lang-switch { display: inline-flex; gap: 2px; margin-left: 0.5rem; }
.lang-btn {
  background: transparent; border: 1px solid #ddd; color: var(--secondary);
  font-weight: 700; font-size: 0.78rem; padding: 0.25rem 0.5rem; cursor: pointer;
  border-radius: 6px; line-height: 1;
}
.lang-btn.active { background: var(--secondary); color: var(--primary); border-color: var(--secondary); }
.lang-btn:hover { border-color: var(--secondary); }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: var(--secondary); }
.btn-dark { background: var(--secondary); color: var(--primary); }
.btn-outline { background: transparent; border: 2px solid var(--secondary); color: var(--secondary); }

/* Hero */
.hero {
  background: linear-gradient(135deg, #f8fff9 0%, #e6fff2 100%);
  padding: 5rem 1.5rem;
  text-align: center;
}
.hero h1 { font-size: 3rem; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; color: #555; max-width: 600px; margin: 0 auto 2rem; }

/* Sections */
.section { padding: 4rem 1.5rem; }
.section h2 { font-size: 2rem; margin-bottom: 2rem; text-align: center; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.card {
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
  background: var(--accent);
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.card img { width: 100%; height: 200px; object-fit: cover; background: #f4f4f4; }
.card-body { padding: 1rem; }
.card-price { font-weight: 700; color: var(--secondary); margin-top: 0.5rem; }

.cta-banner {
  background: var(--secondary);
  color: var(--accent);
  border-radius: 16px;
  padding: 3rem;
  text-align: center;
}
.cta-banner h2 { color: var(--accent); }

footer {
  background: var(--secondary);
  color: #ccc;
  padding: 3rem 1.5rem 1.5rem;
  margin-top: 3rem;
}
footer a:hover { color: var(--primary); }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.footer-bottom { border-top: 1px solid #333; padding-top: 1rem; font-size: 0.85rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid #ddd; border-radius: 8px; font-family: inherit;
}

/* Builder */
.builder-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 900px) { .builder-layout { grid-template-columns: 1fr; } }

.receipt-preview-wrap {
  perspective: 1000px;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 2rem; background: #f4f4f4; border-radius: 12px; min-height: 500px;
}
.receipt-paper {
  background: #fdfdf8;
  width: 260px;
  padding: 1.5rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25), 0 2px 6px rgba(0,0,0,0.15);
  transform: rotateX(6deg) rotateY(-4deg);
  transition: transform 0.3s ease, height 0.3s ease;
  border-radius: 2px;
  position: relative;
}
.receipt-paper::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -6px; height: 12px;
  background: repeating-linear-gradient(-45deg, #fdfdf8 0 6px, transparent 6px 12px);
}
.receipt-paper .store-name { text-align: center; font-weight: 700; margin-bottom: 0.5rem; text-transform: uppercase; }
.receipt-paper .divider { border-top: 1px dashed #999; margin: 0.5rem 0; }
.receipt-paper .line-item { display: flex; justify-content: space-between; }
.receipt-paper .total-line { display: flex; justify-content: space-between; font-weight: 700; margin-top: 0.5rem; }
.receipt-paper .message { text-align: center; margin-top: 1rem; font-style: italic; }
.receipt-paper .date { text-align: center; color: #777; margin-top: 0.5rem; font-size: 0.75rem; }

/* Cart */
.cart-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td { text-align: left; padding: 0.75rem; border-bottom: 1px solid #eee; }
.cart-summary { max-width: 320px; margin-left: auto; padding: 1.5rem; border: 1px solid #eee; border-radius: 12px; }

.product-detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

.item-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.item-row input { padding: 0.6rem 0.75rem; border: 1px solid #ddd; border-radius: 8px; font-family: inherit; }
.item-row .item-name { flex: 2; min-width: 0; }
.item-row .item-price { flex: 1; min-width: 0; }

/* ============ Mobile ============ */
@media (max-width: 900px) {
  .product-detail-layout { grid-template-columns: 1fr; gap: 1.5rem; }
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }

  .nav-links {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--accent);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 1.25rem 1rem;
    border-bottom: 1px solid #eee;
    box-shadow: 0 12px 24px rgba(0,0,0,0.06);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.18s ease, opacity 0.18s ease;
  }
  .nav-links.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .nav-links a {
    width: 100%;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f2f2f2;
  }
  .nav-links a:last-child { border-bottom: none; }
}

@media (max-width: 700px) {
  .hero { padding: 3rem 1.25rem; }
  .hero h1 { font-size: 1.9rem; }
  .hero p { font-size: 1.05rem; }
  .hero .btn { display: block; width: 100%; margin: 0.5rem 0 0 !important; }

  .section { padding: 2.5rem 1.25rem; }
  .section h2 { font-size: 1.5rem; }

  .cta-banner { padding: 2rem 1.25rem; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
  .card img { height: 140px; }

  .builder-layout { gap: 1.25rem; }
  .receipt-preview-wrap { padding: 1.25rem 0.75rem; min-height: auto; }
  .receipt-paper {
    width: 100%;
    max-width: 300px;
    transform: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  }
  .item-row { flex-direction: column; gap: 0.4rem; }

  .cart-summary { max-width: 100%; }

  #add-to-cart-btn { width: 100%; }
}

@media (max-width: 480px) {
  .navbar .logo { height: 24px; }
  .footer-links { gap: 1rem; }
}

/* --- New product type previews --- */
.music-card, .soundwave-card, .gps-card {
  background: #111827;
  color: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 360px;
  text-align: center;
}
.music-card-art { width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #1f2937; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.music-card-art img { width: 100%; height: 100%; object-fit: cover; }
.music-card-art-placeholder { font-size: 3rem; color: var(--primary); }
.music-card-title { font-weight: 700; font-size: 1.1rem; }
.music-card-artist { color: #9ca3af; margin-bottom: 0.75rem; }
.music-card-progress { height: 4px; background: #374151; border-radius: 2px; margin: 0.5rem 0; }
.music-card-progress span { display: block; width: 35%; height: 100%; background: var(--primary); border-radius: 2px; }
.music-card-time { display: flex; justify-content: space-between; font-size: 0.75rem; color: #9ca3af; }
.music-card-controls { display: flex; justify-content: center; align-items: center; gap: 1.25rem; margin: 0.75rem 0; }
.music-card-names, .music-card-date { color: #d1d5db; font-size: 0.9rem; }
.music-card-code { margin-top: 1rem; width: 100%; border-radius: 8px; }

.soundwave-svg { color: var(--primary); }
.soundwave-manual-text { font-size: 1.1rem; font-style: italic; padding: 2rem 0; }
.soundwave-caption { margin-top: 0.75rem; font-weight: 600; }
.soundwave-date { color: #9ca3af; font-size: 0.85rem; }

/* --- Magnetic hover effect --- */
.magnetic {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

/* --- Add-on toggle card (magnets etc.) --- */
.addon-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  margin: 1.25rem 0;
  border: 2px solid var(--primary);
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fff9 0%, #e6fff2 100%);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(66, 245, 158, 0.18);
}
.addon-card:hover { box-shadow: 0 8px 22px rgba(66, 245, 158, 0.28); }
.addon-card .addon-checkbox { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--primary); cursor: pointer; }
.addon-card .addon-label { display: flex; flex-direction: column; margin: 0; cursor: pointer; }
.addon-card .addon-title { font-weight: 700; }
.addon-card .addon-desc { font-weight: 400; font-size: 0.85rem; color: #4b5563; }

.gps-pin { color: var(--primary); margin-bottom: 0.5rem; }
.gps-coords { font-family: "JetBrains Mono", monospace; font-size: 1.1rem; font-weight: 700; }
.gps-names, .gps-date, .gps-caption { color: #d1d5db; margin-top: 0.35rem; font-size: 0.9rem; }
