/* GroceryGO — Cartoony grocery delivery theme */

:root {
  --bg: #f0f9f4;
  --bg-card: #ffffff;
  --mint: #4ade80;
  --mint-light: #86efac;
  --mint-dark: #22c55e;
  --green-primary: #16a34a;
  --green-light: #bbf7d0;
  --green-dark: #15803d;
  --lime: #a3e635;
  --lime-light: #d9f99d;
  --emerald: #10b981;
  --emerald-light: #6ee7b7;
  --peach: #fbbf24;
  --peach-light: #fde68a;
  --butter: #fef3c7;
  --sky: #7dd3fc;
  --coral: #f87171;
  --orange: #fb923c;
  --text: #1f2937;
  --text-muted: #4b5563;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 8px 24px rgba(34, 197, 94, 0.15);
  --shadow-hover: 0 12px 32px rgba(34, 197, 94, 0.25);
  --font-display: "Fredoka", sans-serif;
  --font-body: "Nunito", sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Cartoony produce background */
.produce-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.produce-item {
  position: absolute;
  font-size: clamp(2rem, 4vw, 4rem);
  opacity: 0.18;
  animation: floatProduce 15s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(34, 197, 94, 0.2));
}

.apple { top: 8%; left: 5%; animation-delay: 0s; }
.banana { top: 15%; right: 8%; animation-delay: -1.5s; transform: rotate(-15deg); }
.carrot { bottom: 25%; left: 10%; animation-delay: -3s; transform: rotate(20deg); }
.tomato { top: 35%; right: 15%; animation-delay: -4.5s; }
.broccoli { bottom: 15%; right: 12%; animation-delay: -6s; transform: rotate(-10deg); }
.strawberry { top: 60%; left: 8%; animation-delay: -7.5s; }
.orange { top: 45%; left: 20%; animation-delay: -9s; transform: rotate(15deg); }
.avocado { bottom: 35%; right: 6%; animation-delay: -10.5s; transform: rotate(-20deg); }
.pepper { top: 25%; left: 12%; animation-delay: -12s; }
.corn { bottom: 45%; left: 18%; animation-delay: -13.5s; transform: rotate(10deg); }
.grapes { top: 70%; right: 20%; animation-delay: -15s; }
.lemon { bottom: 55%; right: 25%; animation-delay: -16.5s; transform: rotate(-25deg); }

@keyframes floatProduce {
  0%, 100% { 
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  25% { 
    transform: translate(20px, -25px) scale(1.1) rotate(5deg);
  }
  50% { 
    transform: translate(-15px, 15px) scale(0.95) rotate(-5deg);
  }
  75% { 
    transform: translate(10px, -10px) scale(1.05) rotate(3deg);
  }
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  padding: 28px 0 16px;
  text-align: center;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s ease;
}

.logo:hover {
  transform: scale(1.02);
}

.logo-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
  animation: bounceCart 2s ease-in-out infinite;
}

@keyframes bounceCart {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.logo-text {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--green-primary) 0%, var(--mint-dark) 30%, var(--mint) 60%, var(--emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Hero */
.hero {
  padding: 32px 0 48px;
  text-align: center;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 0 28px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* Search */
.search-form {
  max-width: 420px;
  margin: 0 auto;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
  border: 3px solid var(--green-light);
  background: linear-gradient(to bottom, #ffffff, #f0fdf4);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-wrap:focus-within {
  border-color: var(--green-primary);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.3);
}

.search-icon {
  padding: 0 14px;
  font-size: 1.4rem;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  padding: 14px 8px;
  outline: none;
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}

.search-btn {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--green-primary) 0%, var(--mint-dark) 50%, var(--emerald) 100%);
  border: none;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
  white-space: nowrap;
}

.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.6);
  background: linear-gradient(135deg, var(--mint-dark) 0%, var(--green-primary) 50%, var(--mint-dark) 100%);
}

.search-btn:active {
  transform: translateY(0);
}

.search-hint {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Listings */
.listings {
  padding: 24px 0 64px;
}

.listings-header {
  margin-bottom: 24px;
}

.listings-header[hidden] {
  display: none;
}

.listings-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.listings-count {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.listings-empty,
.listings-no-results {
  text-align: center;
  padding: 48px 24px;
  background: linear-gradient(to bottom, #ffffff, #f0fdf4);
  border-radius: var(--radius);
  border: 3px dashed var(--green-light);
  color: var(--text-muted);
}

.listings-empty[hidden],
.listings-no-results[hidden],
.listings-loading[hidden],
.listings-error[hidden] {
  display: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border: 4px solid var(--green-light);
  border-top-color: var(--green-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.listings-loading,
.listings-error {
  text-align: center;
  padding: 48px 24px;
  background: linear-gradient(to bottom, #ffffff, #f0fdf4);
  border-radius: var(--radius);
  border: 3px dashed var(--green-light);
  color: var(--text-muted);
}

.listings-error {
  border-color: var(--coral);
  color: var(--text);
}

.empty-illus {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.8;
}

/* Service cards */
.card {
  background: linear-gradient(to bottom, #ffffff, #f9fafb);
  border-radius: var(--radius);
  padding: 24px;
  border: 3px solid var(--green-light);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--green-primary);
  background: linear-gradient(to bottom, #ffffff, #f0fdf4);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--green-light) 0%, var(--emerald-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.card-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--text);
  margin: 0;
  line-height: 1.5;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.tag {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--butter);
  color: var(--text);
}

.tag.green {
  background: var(--green-light);
  color: var(--green-primary);
  border: 1px solid var(--emerald-light);
}

.tag.peach {
  background: var(--peach-light);
  color: #b85c3a;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--green-primary);
  text-decoration: none;
  margin-top: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--green-light);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
  border: 2px solid var(--emerald-light);
}

.card-link:hover {
  background: linear-gradient(135deg, var(--green-primary) 0%, var(--mint-dark) 100%);
  color: white;
  transform: translateX(4px);
  border-color: var(--green-primary);
}

/* Footer */
.footer {
  padding: 24px 0;
  text-align: center;
  border-top: 3px solid var(--green-light);
  background: linear-gradient(to bottom, rgba(240, 253, 244, 0.8), rgba(255, 255, 255, 0.9));
}

.footer-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  font-weight: 600;
}

.footer-text + .footer-text {
  margin-top: 8px;
}

.footer-link {
  color: var(--green-primary);
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  text-decoration: underline;
}

.footer-cta {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 24px;
  background: var(--green-primary);
  color: white;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.footer-cta:hover {
  background: var(--green-dark);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 28px;
  max-width: 420px;
  width: 100%;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay[data-open="true"] .modal {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.modal-close:hover {
  color: var(--text);
  background: var(--green-light);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text);
  margin: 0 0 20px 0;
  padding-right: 36px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.modal-input {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 2px solid var(--green-light);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text);
  transition: border-color 0.2s;
}

.modal-input:focus {
  outline: none;
  border-color: var(--green-primary);
}

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

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

.modal-btn {
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: background 0.2s, color 0.2s;
}

.modal-btn-primary {
  background: var(--green-primary);
  color: white;
}

.modal-btn-primary:hover {
  background: var(--green-dark);
}

.modal-btn-secondary {
  background: var(--green-light);
  color: var(--text);
}

.modal-btn-secondary:hover {
  background: var(--mint-light);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .header {
    padding: 20px 0 12px;
  }

  .logo-text {
    font-size: 1.75rem;
  }

  .hero {
    padding: 24px 0 36px;
  }

  .hero-subtitle {
    font-size: 1rem;
    padding: 0 16px;
  }

  .search-form {
    max-width: 100%;
    padding: 0 8px;
  }

  .search-wrap {
    flex-direction: row;
    padding: 6px;
  }

  .search-input {
    font-size: 1rem;
    padding: 12px 6px;
  }

  .search-btn {
    padding: 12px 20px;
    font-size: 0.95rem;
  }

  .listings-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card {
    padding: 20px;
  }

  .produce-item {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
  }
}

@media (max-width: 480px) {
  .search-wrap {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 8px;
  }

  .search-icon {
    text-align: center;
    padding: 8px;
  }

  .search-input {
    width: 100%;
    text-align: center;
  }

  .search-btn {
    width: 100%;
  }

  .listings {
    padding: 20px 0 48px;
  }

  .listings-title {
    font-size: 1.25rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .produce-item {
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    opacity: 0.12;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }

  .listings-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}
