/* ============================================
   JJ Motors del Sur - Premium CSS
   ============================================ */

:root {
  --jj-red: #ED1C24;
  --jj-red-hover: #d41920;
  --jj-dark: #231F20;
  --jj-white: #FFFFFF;
  --wa-green: #25D366;
  --transition-base: 0.3s ease;
  --transition-slow: 0.6s ease;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 12px 48px rgba(0, 0, 0, 0.12);
  --shadow-premium: 0 20px 60px rgba(0, 0, 0, 0.08);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: var(--jj-red);
  color: var(--jj-white);
}

/* ----- Custom Scrollbar ----- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }

/* ----- Hero Background Pattern ----- */
.hero-bg-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ----- Hero Text Animation ----- */
@keyframes heroTextSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-text-animate {
  opacity: 0;
  animation: heroTextSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ----- Reveal on Scroll ----- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ----- Stagger Items ----- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.stagger-item {
  opacity: 0;
  transform: translateY(30px);
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }

/* ----- Brands Marquee ----- */
.brands-marquee {
  position: relative;
}

.brands-marquee-track {
  display: flex;
  will-change: transform;
}

/* ----- WhatsApp FAB ----- */
@keyframes wa-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
  70% { box-shadow: 0 0 0 18px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

#whatsapp-fab {
  animation: wa-pulse 2s infinite;
}

#whatsapp-fab:hover {
  animation: none;
  transform: scale(1.1);
}

/* ----- Mobile Bottom Nav ----- */
.mobile-nav {
  transform: translateY(0);
  transition: transform var(--transition-base);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-nav--hidden {
  transform: translateY(100%);
}

/* ----- Header Scroll Shadow ----- */
#site-header {
  transition: box-shadow var(--transition-base), background-color var(--transition-base);
}

#site-header.header-scrolled {
  box-shadow: 0 2px 30px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.95);
}

/* ----- Swiper Custom ----- */
.swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  background: #d1d5db;
  opacity: 1;
  transition: all var(--transition-base);
  border-radius: 8px;
}

.swiper-pagination-bullet-active {
  background: var(--jj-red);
  width: 32px;
}

.hero-pagination .swiper-pagination-bullet {
  background: rgba(255, 255, 255, 0.4);
}

.hero-pagination .swiper-pagination-bullet-active {
  background: var(--jj-white);
}

.recent-pagination .swiper-pagination-bullet {
  width: 6px;
  height: 6px;
}

.recent-pagination .swiper-pagination-bullet-active {
  width: 24px;
}

.swiper-button-next,
.swiper-button-prev {
  color: var(--jj-red) !important;
  background: rgba(255, 255, 255, 0.95);
  width: 44px !important;
  height: 44px !important;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all var(--transition-base);
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
  background: var(--jj-red);
  color: var(--jj-white) !important;
  box-shadow: 0 8px 24px rgba(237, 28, 36, 0.3);
}

.swiper-button-next::after,
.swiper-button-prev::after {
  font-size: 14px !important;
  font-weight: bold;
}

/* ----- Search Modal ----- */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.search-modal--open {
  opacity: 1;
  visibility: visible;
}

.search-modal__content {
  max-width: 640px;
  margin: 5vh auto 0;
  padding: 0 1rem;
  transform: translateY(-20px);
  transition: transform var(--transition-base);
}

.search-modal--open .search-modal__content {
  transform: translateY(0);
}

/* ----- Bottom Sheet ----- */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.bottom-sheet-overlay--open { opacity: 1; visibility: visible; }

.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--jj-white);
  border-radius: 1.5rem 1.5rem 0 0;
  z-index: 70;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 85vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-sheet--open { transform: translateY(0); }

.bottom-sheet__handle {
  width: 36px; height: 4px;
  background: #d1d5db;
  border-radius: 2px;
  margin: 0.75rem auto;
}

/* ----- Badges ----- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge--new { background: #dbeafe; color: #1d4ed8; }
.badge--sale { background: #fef2f2; color: var(--jj-red); }
.badge--featured { background: #fef3c7; color: #b45309; }
.badge--out-of-stock { background: #f1f5f9; color: #64748b; }
.badge--financing { background: #d1fae5; color: #047857; }

/* ----- Toast ----- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.875rem 1.5rem;
  border-radius: 1rem;
  color: var(--jj-white);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 100;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s ease;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.toast--visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast--success { background: #10b981; }
.toast--error { background: #ef4444; }
.toast--info { background: #3b82f6; }

/* ----- Skeleton Loading ----- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 0.5rem;
}

/* ----- Filter Chips ----- */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: #fef2f2;
  color: var(--jj-red);
  border: 1px solid #fecaca;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--transition-base);
}

.filter-chip:hover { background: var(--jj-red); color: var(--jj-white); border-color: var(--jj-red); }

/* ----- Tabs ----- */
.tabs { border-bottom: 2px solid #e2e8f0; }

.tab-btn {
  position: relative;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition-base);
}

.tab-btn:hover { color: var(--jj-dark); }
.tab-btn--active { color: var(--jj-red); }

.tab-btn--active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--jj-red);
  border-radius: 1px 1px 0 0;
}

.tab-panel { display: none; animation: fadeIn 0.3s ease; }
.tab-panel--active { display: block; }

/* ----- Accordion ----- */
.accordion-item { border-bottom: 1px solid #e2e8f0; }

.accordion-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 0;
  font-weight: 500;
  color: var(--jj-dark);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.accordion-btn__icon { transition: transform var(--transition-base); flex-shrink: 0; }
.accordion-btn[aria-expanded="true"] .accordion-btn__icon { transform: rotate(180deg); }
.accordion-content { overflow: hidden; max-height: 0; transition: max-height 0.35s ease; }
.accordion-content--open { max-height: 500px; }

/* ----- Location Section (glass = mismo estandar que Financiamiento) ----- */
.location-section {
  margin-bottom: 0;
}

.location-moto-parallax {
  transition: transform 0.15s ease-out;
  will-change: transform;
}

.location-moto-img {
  opacity: 0.35;
  filter: drop-shadow(0 25px 45px rgba(0, 0, 0, 0.55));
}

@media (min-width: 1024px) {
  .location-moto-img {
    opacity: 0.28;
  }
}

/* Location cards now use Tailwind inline classes (bg-white/5 backdrop-blur-sm) */

.location-map-container,
.location-map-wrapper > div {
  line-height: 0;
  font-size: 0;
}

.location-map-wrapper iframe,
.location-map-container iframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  display: block;
  filter: saturate(0.8) contrast(1.08) brightness(0.95);
  transition: filter 0.6s ease;
  margin: 0;
  padding: 0;
}

.location-map-wrapper:hover iframe,
.location-map-container:hover iframe {
  filter: saturate(1) contrast(1) brightness(1);
}

.location-map-wrapper {
  margin: 0;
  padding: 0;
  line-height: 0;
}

/* ----- About Cinematic Section ----- */
.about-cinematic {
  position: relative;
  isolation: isolate;
}

.about-cinematic img {
  transition: transform 8s cubic-bezier(0.16, 1, 0.3, 1);
}

.about-cinematic:hover img {
  transform: scale(1.04);
}

.about-film-grain {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: overlay;
}

@keyframes aboutSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(0);
  }
}

.about-animate {
  opacity: 0;
  animation: aboutSlideIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-play-state: paused;
}

.about-cinematic.revealed .about-animate {
  animation-play-state: running;
}

.about-stat-card {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.about-stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(237, 28, 36, 0.3);
}

/* Parallax-like subtle shift on the background */
@media (min-width: 1024px) {
  .about-cinematic {
    background-attachment: fixed;
  }
}

/* ----- Focus Styles ----- */
:focus-visible { outline: 2px solid var(--jj-red); outline-offset: 2px; }

/* ----- Page Enter ----- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.page-enter { animation: fadeIn 0.3s ease; }

/* ----- Price Display ----- */
.price-original { text-decoration: line-through; color: #94a3b8; font-size: 0.875em; }
.price-sale { color: var(--jj-red); font-weight: 700; }

/* ----- Print Styles ----- */
@media print {
  header, footer, #mobile-bottom-nav, #whatsapp-fab,
  .search-modal, .bottom-sheet, .bottom-sheet-overlay, .mobile-nav, .no-print {
    display: none !important;
  }
  body { background: white !important; color: black !important; font-size: 12pt; padding: 0 !important; }
  main { margin: 0 !important; padding: 0 !important; }
  a { color: black !important; text-decoration: underline; }
  img { max-width: 100% !important; }
  @page { margin: 2cm; }
}
