/* Enhanced UI Styles for Garage Pass */

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Scroll Progress Bar --- */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  /* Gradient from Teal to Orange (Accent) to create the "leading" effect */
  background: linear-gradient(90deg, var(--teal) 70%, var(--accent) 100%);
  /* Glow effect mixing both colors */
  box-shadow: 0 0 10px var(--teal), 0 0 8px var(--accent);
  z-index: 9999;
  /* Slower, smoother transition */
  transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease;
  opacity: 0; /* Hidden by default, toggled by JS */
}

/* --- Neon Hover Effects --- */
.card {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(24, 225, 255, 0.3) !important;
  box-shadow: 0 10px 30px -10px rgba(24, 225, 255, 0.15), 0 0 0 1px rgba(24, 225, 255, 0.1);
}

/* --- Hero Cross-Fade Image Transition --- */
.hero-images {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: 16px;
}

.hero-images picture {
  position: absolute;
  inset: 0;
  display: block;
}

.hero-images img,
.hero-images picture img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
}

.hero-images img.is-active,
.hero-images picture:has(img.is-active) img {
  opacity: 1;
  transform: scale(1.1);
  transition: opacity 1.2s ease-in-out, transform 6s linear;
}

/* --- Bottom Navigation (Mobile) --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(11, 15, 18, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 24px; /* Extra padding for safe area */
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
  stroke-width: 2px;
}

.bottom-nav-item.active {
  color: var(--teal);
}

.bottom-nav-item.active svg {
  filter: drop-shadow(0 0 8px rgba(24, 225, 255, 0.5));
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

/* Ensure hero content sits above images */
.hero.has-crossfade {
  position: relative;
  min-height: 320px;
}

.hero.has-crossfade > *:not(.hero-images) {
  position: relative;
  z-index: 2;
}

/* Gradient overlay for text readability */
.hero.has-crossfade::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(11, 15, 18, 0.4) 0%, rgba(11, 15, 18, 0.85) 100%);
  z-index: 1;
  border-radius: 16px;
  pointer-events: none;
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(24, 225, 255, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(24, 225, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(24, 225, 255, 0);
  }
}

@keyframes gradientText {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* --- Hero Section Enhancements --- */
.hero {
  position: relative;
  overflow: hidden;
  /* Ensure text is readable over images */
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(11, 15, 18, 0.3), rgba(11, 15, 18, 0.9));
  z-index: 1;
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 2;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.hero .tagline {
  /* Slower gradient animation for better readability */
  background: linear-gradient(90deg, #fff 0%, #18e1ff 25%, #fff 50%, #18e1ff 75%, #fff 100%);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientText 8s ease infinite; /* Slower: 8s instead of 5s */
  text-shadow: none; /* Remove text-shadow for clipped text */
  /* Ensure sufficient contrast */
  filter: contrast(1.1);
}

/* Reduced motion preference - disable animation for accessibility */
@media (prefers-reduced-motion: reduce) {
  .hero .tagline {
    animation: none;
    background: var(--teal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  .hero .scan .btn.btn-primary {
    animation: none;
  }
  
  .hero .chip::before {
    display: none;
  }
}

/* --- Hero Button Hierarchy --- */
.hero .scan {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  width: 100%;
  max-width: 360px;
  margin: 16px auto 0;
}

/* Primary CTA - Create Account (most prominent) */
.hero .btn.btn-primary {
  background: linear-gradient(135deg, var(--teal) 0%, #0ea5e9 100%);
  color: #000;
  font-weight: 700;
  font-size: 18px;
  padding: 16px 24px;
  border: none;
  border-radius: 16px;
  width: 100%;
  animation: pulseGlow 2s infinite;
  box-shadow: 0 4px 20px rgba(24, 225, 255, 0.4);
  transition: all 0.3s ease;
}

.hero .btn.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(24, 225, 255, 0.5);
}

.hero .btn.btn-primary .icon {
  color: #000;
}

/* Secondary CTA - Browse Cars */
.hero .btn.btn-secondary {
  background: linear-gradient(180deg, #10303b, #0e2a33);
  border: 2px solid var(--teal);
  color: var(--teal);
  font-weight: 600;
  font-size: 16px;
  padding: 14px 20px;
  border-radius: 14px;
  width: 100%;
  transition: all 0.3s ease;
}

.hero .btn.btn-secondary:hover {
  background: linear-gradient(180deg, #143845, #10303b);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(24, 225, 255, 0.2);
}

.hero .btn.btn-secondary .icon {
  color: var(--teal);
}

/* Tertiary CTA - Scan QR */
.hero .btn.btn-tertiary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 12px;
  width: auto;
  min-width: 140px;
  transition: all 0.3s ease;
}

.hero .btn.btn-tertiary:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

/* Hide Create Account button when logged in (JS will handle this) */
.hero .btn.btn-primary.is-hidden {
  display: none;
}

/* Mobile adjustments for hero buttons */
@media (max-width: 640px) {
  .hero .scan {
    max-width: 100%;
    padding: 0 16px;
  }
  
  .hero .btn.btn-primary {
    font-size: 16px;
    padding: 14px 20px;
  }
  
  .hero .btn.btn-secondary {
    font-size: 15px;
    padding: 12px 18px;
  }
}

/* --- Card Enhancements --- */
.card {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
  border-color: var(--teal);
}

/* Disable hover effect for hero card and specific sections if needed */
.card.hero:hover, .card.banner-ad:hover {
  transform: none;
  border-color: var(--line);
}

/* --- Button Enhancements --- */
.btn {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.btn:active::after {
  width: 200px;
  height: 200px;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* --- Typography & Spacing --- */
.section-title {
  position: relative;
  padding-left: 16px;
  margin-bottom: 16px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  letter-spacing: 1px;
}

.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--teal);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--teal);
}

/* --- Navigation --- */
header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.pill .btn {
  border: 1px solid transparent;
}

.pill .btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.pill .btn.is-active {
  background: rgba(24, 225, 255, 0.1);
  border-color: var(--teal);
  color: var(--teal);
  box-shadow: 0 0 12px rgba(24, 225, 255, 0.2);
}

/* --- Mobile Optimizations --- */
@media (max-width: 640px) {
  .hero .tagline {
    font-size: 36px;
  }
  
  .card:hover {
    transform: none; /* Disable lift on touch devices to prevent sticky hover states */
  }
}

/* --- How It Works Section --- */
.steps-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  margin-top: 16px;
  counter-reset: step-counter;
}

@media (min-width: 760px) {
  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 20px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.step-item:hover {
  background: rgba(24, 225, 255, 0.04);
  border-color: rgba(24, 225, 255, 0.2);
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(24, 225, 255, 0.1);
}

.step-item .step-cta {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(24, 225, 255, 0.35);
  background: rgba(24, 225, 255, 0.08);
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

.step-item .step-cta:hover {
  background: rgba(24, 225, 255, 0.16);
  box-shadow: 0 0 12px rgba(24, 225, 255, 0.2);
}

.step-item:hover .step-icon {
  transform: scale(1.1);
  box-shadow: 0 0 24px rgba(24, 225, 255, 0.5);
}

.step-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--teal), #0ea5e9);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(24, 225, 255, 0.35);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.step-icon svg {
  width: 26px;
  height: 26px;
}

.step-title {
  margin: 0 0 10px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}

.step-desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 260px;
}

/* --- Skeleton Loading States --- */
@keyframes skeletonPulse {
  0%, 100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.8;
  }
}

.skeleton {
  background: linear-gradient(90deg, var(--line) 0%, rgba(255, 255, 255, 0.08) 50%, var(--line) 100%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
  border-radius: 8px;
}

/* Skeleton for event list rows */
.skeleton-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px;
  border-top: 1px solid var(--line);
}

.skeleton-row:first-child {
  border-top: 0;
}

.skeleton-text {
  height: 14px;
  border-radius: 4px;
}

.skeleton-text.lg {
  width: 60%;
  height: 16px;
}

.skeleton-text.sm {
  width: 30%;
  height: 12px;
  margin-top: 6px;
}

.skeleton-badge {
  width: 70px;
  height: 28px;
  border-radius: 999px;
}

/* Skeleton for car cards */
.skeleton-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.skeleton-card .skeleton-img {
  width: 100%;
  height: 160px;
}

.skeleton-card .skeleton-body {
  padding: 12px;
}

.skeleton-card .skeleton-title {
  width: 70%;
  height: 18px;
  margin-bottom: 10px;
}

.skeleton-card .skeleton-meta {
  width: 90%;
  height: 12px;
  margin-bottom: 12px;
}

.skeleton-card .skeleton-btn {
  width: 100px;
  height: 32px;
  border-radius: 10px;
}

/* Skeleton for feed items */
.skeleton-feed {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.skeleton-feed .skeleton-thumb {
  width: 100%;
  height: 96px;
}

.skeleton-feed .skeleton-body {
  padding: 8px;
}

.skeleton-feed .skeleton-title {
  width: 80%;
  height: 14px;
  margin-bottom: 6px;
}

.skeleton-feed .skeleton-meta {
  width: 60%;
  height: 10px;
}

/* Hide skeletons when content loads */
.list:not(:empty) ~ .skeleton-list,
.car-grid:not(:empty) ~ .skeleton-grid,
.feed-grid:not(:empty) ~ .skeleton-grid {
  display: none;
}

/* Skeleton containers */
.skeleton-list {
  padding: 6px 6px 10px;
}

.skeleton-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .skeleton-grid.cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 980px) {
  .skeleton-grid.cards {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* --- Hero Enhanced Text Styles --- */

/* Hero subtitle/tagline enhancement */
.hero .meta {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  background: linear-gradient(90deg, rgba(24, 225, 255, 0.15) 0%, transparent 100%);
  padding: 10px 18px;
  border-radius: 8px;
  border-left: 3px solid var(--teal);
  display: inline-block;
  backdrop-filter: blur(4px);
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

/* Hero chips enhancement */
.hero .chips {
  animation: fadeInUp 0.6s ease-out 0.4s both;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Mobile: horizontal scroll for chips */
@media (max-width: 480px) {
  .hero .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 0;
    justify-content: flex-start;
    width: 100%;
    scroll-snap-type: x mandatory;
  }
  
  .hero .chips::-webkit-scrollbar {
    display: none;
  }
  
  .hero .chip {
    flex-shrink: 0;
    scroll-snap-align: start;
  }
}

.hero .chip {
  background: linear-gradient(135deg, rgba(24, 225, 255, 0.12) 0%, rgba(24, 225, 255, 0.05) 100%);
  border: 1px solid rgba(24, 225, 255, 0.35);
  color: var(--teal);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 10px 16px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 8px rgba(24, 225, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.hero .chip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(24, 225, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.hero .chip:hover {
  border-color: var(--teal);
  background: linear-gradient(135deg, rgba(24, 225, 255, 0.25) 0%, rgba(24, 225, 255, 0.1) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(24, 225, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.hero .chip:hover::before {
  transform: translateX(100%);
}

/* Add icons to hero chips */
.hero .chip:nth-child(1)::after {
  content: '📱';
  margin-left: 6px;
}

.hero .chip:nth-child(2)::after {
  content: '📖';
  margin-left: 6px;
}

.hero .chip:nth-child(3)::after {
  content: '⭐';
  margin-left: 6px;
}
