/* Enhanced design system for CollectaCars */
:root {
  --accent: #0066cc;
  --accent-dark: #004d99;
  --text: #1a1a1a;
  --muted: #64748b;
  --bg: #f0f7ff;
  --card: #ffffff;
  --border: #cce4ff;
  --shadow-sm: 0 1px 3px rgba(0,102,204,0.1);
  --shadow: 0 4px 6px -1px rgba(0,102,204,0.1),0 2px 4px -2px rgba(0,102,204,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,102,204,0.15),0 4px 6px -4px rgba(0,102,204,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

/* Base styles & reset */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

/* Layout & containers */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Navigation */
.nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.95);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  justify-content: space-between;
  height: 72px;
}
.brand {
 /* font-family: 'Sora', sans-serif !important;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin: 0;*/
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}
.brand:hover { transform: scale(1.02); }
.logo {
  width: 42px;
  height: 42px;
  transition: transform 0.2s;
}
.brand:hover .logo { transform: rotate(-5deg); }

/* Search & inputs */
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 480px;
}
.search-wrap input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  font-size: 0.95rem;
  transition: all 0.2s;
}
.search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  background: white;
  box-shadow: 0 0 0 4px rgba(255,58,65,0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 0;
  background: var(--accent);
  color: white;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn.primary { background: var(--accent); }
.btn:disabled { opacity: 0.6; pointer-events: none; }

.cart-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.cart-btn:hover { background: var(--bg); transform: translateY(-1px); }
.badge {
  background: var(--accent);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.badge.pulse {
  animation: pulse 0.6s cubic-bezier(0.4, 0, 0.6, 1);
}

/* Hero section */
.hero {
  display: flex;
  align-items: center;
  gap: 4rem;
  background: linear-gradient(135deg, #ffffff 5%, #5ba3eb 100%);
  padding: 4rem 2rem;
  border-radius: var(--radius);
  margin: 2rem 0;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,102,204,0.1) 0%, transparent 100%);
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero h2 {
  font-size: 2.5rem;
  line-height: 1.2;
  margin: 0 0 1rem;
  background: linear-gradient(135deg, var(--text) 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
}
.hero img {
  width: 300px;
  height: auto;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
  animation: float 6s ease-in-out infinite;
}

/* Controls & filters */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2rem 0;
  padding: 1rem;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.filters {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.filters label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.filters select {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text);
  font-size: 0.95rem;
}
.summary { font-size: 0.95rem; color: var(--muted); }

/* Product grid */
.products-grid {
  display: grid;
  gap: 1.5rem;
  margin: 2rem 0;
}

/* 2 per row on small screens */
@media (max-width: 599px) {
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 3 per row on tablets */
@media (min-width: 600px) and (max-width: 991px) {
  .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 4 per row on small desktops */
@media (min-width: 992px) and (max-width: 1199px) {
  .products-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* 5 per row on large screens */
@media (min-width: 1200px) {
  .products-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: all 0.3s;
  border: 1px solid var(--border);
  position: relative;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: var(--bg);
  border-radius: var(--radius-sm);
  transition: transform 0.3s;
}
.card:hover img { transform: scale(1.05); }
.card h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  column-gap: 0.75rem;
}
.card-footer strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.sold-out-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #94a3b8;
  color: white;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  margin-left: 0.25rem;
}

@media (max-width: 389px) {

  .muted {
    font-size: 0.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .card-footer {
    row-gap: 0.3rem;
    column-gap: 0;
  }

  .card-footer strong {
    font-size: 0.85rem;
  }

  .sold-out-badge {
    align-self: flex-start;
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
  }
}

@media (max-width: 369px) {

  .card-footer {
    row-gap: 0.3rem;
    column-gap: 0;
  }

  .card-footer strong {
    font-size: 0.75rem;
  }

  .sold-out-badge {
    align-self: flex-start;
    font-size: 0.7rem;
    padding: 0.35rem 0.7rem;
  }
}

@media (max-width: 372px) {

.card h4 {
    font-size: 0.8rem;
  }
  
}

.view-all-wrapper {
  text-align: center;
  margin: 2rem 0 3rem;
}

.view-all-btn {
  font-size: 1rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  display: inline-block;
}

/* Cart drawer */
.cart-drawer {
  position: fixed;
  right: 0;
  top: 0;
  height: 100%;
  width: 400px;
  background: var(--card);
  box-shadow: -8px 0 32px rgba(0,0,0,0.12);
  transform: translateX(110%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  z-index: 1000;
}
.cart-drawer.open { transform: translateX(0); }
.cart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.cart-head h3 { margin: 0; font-size: 1.25rem; }
.cart-items {
  flex: 1;
  overflow: auto;
  margin: 1rem -1.5rem;
  padding: 0 1.5rem;
}
.cart-item {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  animation: slideIn 0.3s ease-out;
}
.cart-item img {
  width: 72px;
  height: 56px;
  object-fit: contain;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
/* Nicer qty input in cart */
.cart-item .qty {
  width: 56px;
  padding: 0.25rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  text-align: center;
}

.cart-item .qty::-webkit-outer-spin-button,
.cart-item .qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-item .qty {
  -moz-appearance: textfield;
}
.cart-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.totals {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}
.empty { text-align: center; padding: 2rem; color: var(--muted); }


.cart-close {
  background: transparent;
  border: 0;
  font-size: 1.3rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.cart-close:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.16);
  transform: rotate(90deg);
}

/* Nicer remove button inside cart */
.cart-item .remove {
  background: transparent;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  color: var(--accent-dark);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cart-item .remove:hover {
  background: var(--bg);
  color: var(--accent);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  backdrop-filter: blur(4px);
  z-index: 1000;
}
.modal[aria-hidden="false"],
.modal.show {
  opacity: 1;
  pointer-events: auto;
}
.modal-content {
  background: var(--card);
  padding: 1.25rem;
  border-radius: var(--radius);
  width: min(520px, 92%);
  max-width: 96%;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
}
.modal.show .modal-content { transform: translateY(0); }
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: 0;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.5rem;
  transition: all 0.2s;
}
.modal-close:hover { color: var(--text); transform: rotate(90deg); }
.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

/* Forms */
input:not([type="checkbox"]):not([type="radio"]),
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 0.25rem;
  font-size: 0.95rem;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0,102,204,0.1);
}
label { display: block; margin-bottom: 1rem; }

/* Animations */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Footer */
.site-footer {
  padding: 4rem 0;
  text-align: center;
  color: var(--muted);
  background: white;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

.ig-link {
  color: #e4405f;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.ig-icon {
  width: 13px;
  height: 13px;
}

/* Responsive */
@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    text-align: center;
    padding: 3rem 1.5rem;
    gap: 2rem;
  }
  .hero h2 { font-size: 2rem; }
  .hero img { width: 200px; }
  .nav-inner { height: auto; padding: 1rem 0; }
  .filters { flex-wrap: wrap; }
  .cart-drawer { width: 100%; }
}

/* Skeletons */
.skeleton-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: pulse 1.2s ease-in-out infinite;
}

.skeleton-img,
.skeleton-line {
  background: linear-gradient(90deg, #eef6ff 25%, #e2f0ff 50%, #eef6ff 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: var(--radius-sm);
}

.skeleton-img {
  width: 100%;
  height: 180px;
}

.skeleton-line {
  height: 14px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* =========================
   Toast / popup notifications
   ========================= */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(320px, 90vw);
}

.toast {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: #0f172a;
  color: #e5e7eb;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.45);
  font-size: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  opacity: 0;
  transform: translateY(10px);
  animation: toast-in 0.25s ease-out forwards;
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.toast-icon-svg {
  width: 16px;
  height: 16px;
}

.toast--success {
  border-color: rgba(22, 163, 74, 0.8);
}

.toast--success .toast-icon {
  color: #22c55e;
}

.toast--error {
  border-color: rgba(220, 38, 38, 0.9);
}

.toast--error .toast-icon {
  color: #f97373;
}

.toast--info {
  border-color: rgba(37, 99, 235, 0.8);
}

.toast--info .toast-icon {
  color: #60a5fa;
}

.toast-icon {
  font-size: 1rem;
  line-height: 1;
  margin-top: 1px;
}

.toast-close {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 0 0 0.5rem;
}

.toast-close:hover {
  color: #e5e7eb;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .toast-container {
    bottom: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    max-width: 100%;
  }
}

/* Checkout Modal Form */
#checkoutForm {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Improve form layout on wider screens and keep it compact */
#checkoutForm label { font-weight: 600; display: block; }
#checkoutForm input, #checkoutForm textarea { box-sizing: border-box; }

@media (min-width: 900px) {
  /* Single-column stacked layout on desktop to ensure full-width inputs */
  #checkoutForm {
    display: block;
    max-width: 680px;
    margin: 0 auto;
    gap: 0.5rem;
  }

  #checkoutForm label { display: block; margin: 0 0 0.25rem 0; }
  #checkoutForm input, #checkoutForm textarea { display: block; width: 100%; }

  /* Make address lines, notes and actions full width */
  label[for="address1"], label[for="address1"] + input,
  label[for="address2"], label[for="address2"] + input,
  label[for="notes"], label[for="notes"] + textarea,
  .modal-actions { width: 100%; }

  .modal-content { width: 680px; padding: 1rem; }
}

@media (max-width: 480px) {
  /* Small-screen adjustments */
  .container { padding: 0.75rem; }
  .nav-inner { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .search-wrap { max-width: 100%; }
  .hero { padding: 2rem 0.75rem; gap: 1rem; }
  .hero img { width: 160px; }
  .cart-drawer { width: 100%; padding: 1rem; }
  .modal-content { width: 96%; padding: 1rem; margin: 0 0.5rem; }
  .modal-actions { flex-direction: column; gap: 0.5rem; }
}

#checkoutForm label {
  font-weight: bold;
}

#checkoutForm input,
#checkoutForm textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#checkoutForm button {
  padding: 0.75rem;
  font-weight: bold;
  cursor: pointer;
}

#checkoutMessage {
  margin-top: 1rem;
  text-align: center;
  font-weight: bold;
}

/* Compact checkout modal on desktop */
@media (min-width: 900px) {
  .modal-content {
    width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1rem 1.25rem;
  }

  #checkoutForm {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
  }

  #checkoutForm label {
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
  }

  #checkoutForm input,
  #checkoutForm textarea {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }

  .modal-actions {
    margin-top: 1rem;
  }
}

/* Fix checkout form size & scrolling for MOBILE */
@media (max-width: 480px) {

  /* allow the overlay itself to scroll */
  .modal {
    overflow-y: auto;
  }

  .modal-content {
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    /* content inside can scroll */
    padding: 0.75rem 1rem;
    border-radius: 10px;
  }

  #checkoutForm {
    gap: 0.5rem;
  }

  #checkoutForm label {
    font-size: 0.85rem;
  }

  #checkoutForm input,
  #checkoutForm textarea {
    padding: 0.55rem 0.7rem;
    font-size: 0.85rem;
  }

  .modal-actions {
    margin-top: 0.75rem;
  }

  #checkoutForm textarea {
    min-height: 70px;
  }
}

/* MOBILE HEADER: logo + text + cart on one line, search below */
@media (max-width: 480px) {

  .nav-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand cart"
      "search search";
    column-gap: 0.4rem;
    row-gap: 0.4rem;
    align-items: center;
  }

  .brand {
    grid-area: brand;
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .brand .logo {
    height: 50px;
    width: auto;
  }

  .brand h1 {
    font-size: 1.5rem;
    margin: 0;
    white-space: nowrap;
  }

  .nav-actions {
    grid-area: cart;
    justify-self: end;
  }

  #cartBtn {
    padding: 4px 8px;
    font-size: 0.85rem;
  }

  /* search full-width on second row */
  .search-wrap {
    grid-area: search;
  }

  #search {
    width: 100%;
    margin: 0;
  }
}