/* File Overview: frontend/css/home.css — home for frontend UI behavior. */

/* ─── Design Tokens ───────────────────────────────────────────── */
:root {
  --bg:             #f8fafc;
  --bg-soft:        #ffffff;
  --surface:        #ffffff;
  --surface-2:      #f1f5f9;
  --text:           #0f172a;
  --text-secondary: #475569;
  --muted:          #64748b;
  --subtle:         #94a3b8;
  --accent:         #a855f7;
  --accent-dim:     rgba(168, 85, 247, 0.12);
  --accent-strong:  #8b5cf6;
  --chip-bg:        #ede9fe;
  --border:         #e2e8f0;
  --border-hover:   #cbd5e1;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --radius-xl:      18px;
  --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md:      0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg:      0 8px 20px rgba(0, 0, 0, 0.12);
  --shadow-hover:   0 12px 24px rgba(168, 85, 247, 0.2);
  --transition:     150ms ease;
}

/* ─── Reset & Base ────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Page Shell ──────────────────────────────────────────────── */
.home-page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ─── Navbar ──────────────────────────────────────────────────── */
.home-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
}

.brand-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #8b5cf6;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-button {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-button:hover {
  background: var(--surface-2);
  border-color: var(--border-hover);
  color: var(--text);
}

.nav-button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text);
}

.nav-button.ghost:hover {
  border-color: var(--border);
  background: var(--surface-2);
}

.nav-button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}

.nav-button.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: var(--shadow-hover);
}

.cart-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cart-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ─── Hero ────────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 20px;
  margin-bottom: 20px;
}

.hero-main,
.hero-aside {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.hero-main { padding: 36px 32px; }

.hero-main h2 {
  margin: 8px 0 16px;
  font-size: clamp(1.8rem, 2.5vw, 2.5rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.hero-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 480px;
}

/* ─── Search ──────────────────────────────────────────────────── */
.search-shell {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr 1.1fr auto;
  gap: 10px;
}

.search-assist {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.search-suggestions {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(6, 4, 16, 0.8);
}

.suggestion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-size: 0.88rem;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
}

.suggestion-item:hover {
  border-color: var(--border-hover);
  background: var(--surface-2);
}

.suggestion-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

/* ─── Recent Searches ─────────────────────────────────────────── */
.recent-searches { display: grid; gap: 8px; }

.recent-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recent-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recent-chip {
  border: 1px solid #a855f7;
  border-radius: 999px;
  background: #a855f7;
  color: white;
  padding: 6px 14px;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.recent-chip:hover {
  border-color: #8b5cf6;
  background: #8b5cf6;
}

/* ─── Filter Shell ────────────────────────────────────────────── */
.filter-shell {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.location-box,
.service-box,
.filter-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  transition: border-color var(--transition);
}

.location-box:focus-within,
.service-box:focus-within,
.filter-box:focus-within {
  border-color: var(--border-hover);
}

.location-box label,
.service-box label,
.filter-box label {
  font-size: 0.7rem;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

.location-box input,
.service-box input,
.filter-box select {
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font-size: 0.9rem;
}

.filter-box select option {
  color: #0f0720;
  background: #ede9ff;
}

/* ─── Card Shared ─────────────────────────────────────────────── */
.card-top-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.card-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.favorite-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 5px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
}

.favorite-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.favorite-btn.active {
  background: rgba(155, 92, 246, 0.15);
  border-color: rgba(155, 92, 246, 0.4);
  color: #d4b8ff;
}

/* ─── Compare ─────────────────────────────────────────────────── */
.inline-link.compare-active {
  color: var(--accent);
  text-decoration: underline;
}

.compare-tray {
  margin-top: 20px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid rgba(155, 92, 246, 0.28);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.compare-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.compare-tray-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.compare-pill {
  border: 1px solid #a855f7;
  border-radius: 999px;
  background: #a855f7;
  color: white;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

/* ─── Favorites & Notifications ───────────────────────────────── */
.favorites-section,
.notifications-panel {
  margin-top: 20px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.notifications-list { display: grid; gap: 8px; }

.notification-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  transition: border-color var(--transition);
}

.notification-item:hover { border-color: var(--border-hover); }

.notification-item.unread {
  border-color: rgba(155, 92, 246, 0.35);
  background: var(--accent-dim);
}

.notification-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.empty-card {
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

/* ─── Hero Aside ──────────────────────────────────────────────── */
.hero-aside {
  padding: 20px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.hero-image-card {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.hero-image-card img {
  width: 100%;
  height: 185px;
  object-fit: cover;
  display: block;
}

.mini-stat {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: border-color var(--transition);
}

.mini-stat:hover { border-color: var(--border-hover); }

.mini-stat span {
  font-weight: 700;
  font-size: 1.25rem;
  color: #c4a0ff;
}

.mini-stat p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ─── Sections ────────────────────────────────────────────────── */
.categories-section,
.booked-section,
.trust-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-top: 20px;
  padding: 28px;
}

.section-heading h3,
.trust-copy h3 {
  margin: 6px 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 1px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ─── Grids ───────────────────────────────────────────────────── */
.categories-grid,
.booked-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

/* ─── Cards ───────────────────────────────────────────────────── */
.category-card,
.booked-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.category-card:hover,
.booked-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.category-card img,
.booked-card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  object-position: center;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  display: block;
  border: 1px solid var(--border);
  padding: 12px;
}

.booked-card img { height: 112px; }

.category-card h4,
.booked-card h4 {
  margin: 10px 0 5px;
  font-size: 0.95rem;
  font-weight: 600;
}

.category-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
  min-height: 36px;
}

.chip {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #a855f7;
  border: 1px solid #a855f7;
  color: white;
  letter-spacing: 0.3px;
}

.rating {
  margin: 8px 0 0;
  color: #b89dff;
  font-size: 0.84rem;
}

.booked-row {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 2px 0;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  margin-right: 2px;
  transition: all var(--transition);
}

.inline-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* ─── Trust Section ───────────────────────────────────────────── */
.trust-section {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
}

.trust-copy ul {
  padding-left: 18px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.8;
}

.app-cta {
  background: linear-gradient(160deg, rgba(109, 40, 217, 0.25), rgba(91, 28, 180, 0.12));
  border: 1px solid rgba(155, 92, 246, 0.22);
  border-radius: var(--radius-md);
  padding: 20px;
}

.app-cta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.app-cta h4 {
  margin: 8px 0 16px;
  font-size: 1rem;
  font-weight: 600;
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .hero,
  .trust-section { grid-template-columns: 1fr; }

  .filter-shell { grid-template-columns: 1fr 1fr; }

  .categories-grid,
  .booked-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .search-shell { grid-template-columns: 1fr 1fr auto; }

  .booked-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  .booked-row strong { width: 100%; }
}

@media (max-width: 860px) {
  .search-shell,
  .filter-shell { grid-template-columns: 1fr; }

  .home-navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .nav-links {
    width: 100%;
    gap: 8px;
  }

  #auth-buttons,
  #profile-buttons {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 680px) {
  .home-page { padding: 0 16px 48px; }

  .categories-grid,
  .booked-grid { grid-template-columns: 1fr; }

  .hero-main { padding: 24px 20px; }

  .categories-section,
  .booked-section,
  .trust-section,
  .favorites-section,
  .notifications-panel,
  .compare-tray { padding: 20px; }

  .card-top-row,
  .booked-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  .booked-row strong { width: 100%; }

  .compare-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ─── Animations ──────────────────────────────────────────────── */
@keyframes pageFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes navFadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.home-page   { animation: pageFadeUp  0.5s ease-out both; }
.home-navbar { animation: navFadeDown 0.4s ease-out both; }
.hero-main   { animation: pageFadeUp  0.5s 0.05s ease-out both; }
.hero-aside  { animation: pageFadeUp  0.5s 0.12s ease-out both; }

.category-card,
.booked-card { animation: cardFadeUp 0.5s ease-out both; }

.category-card:nth-child(1), .booked-card:nth-child(1) { animation-delay: 0.06s; }
.category-card:nth-child(2), .booked-card:nth-child(2) { animation-delay: 0.10s; }
.category-card:nth-child(3), .booked-card:nth-child(3) { animation-delay: 0.14s; }
.category-card:nth-child(4), .booked-card:nth-child(4) { animation-delay: 0.18s; }
.category-card:nth-child(5), .booked-card:nth-child(5) { animation-delay: 0.22s; }
.category-card:nth-child(6), .booked-card:nth-child(6) { animation-delay: 0.26s; }
.category-card:nth-child(7), .booked-card:nth-child(7) { animation-delay: 0.30s; }
.category-card:nth-child(8), .booked-card:nth-child(8) { animation-delay: 0.34s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}