:root {
  /* Modern Apple-Luxury Color Palette */
  --color-bg: #0A1425; /* Brighter premium navy */
  --color-surface: #101d36;
  --color-surface-light: #16284a;
  --color-text: #ffffff; /* Pure white */
  --color-text-muted: #94a3b8;
  --color-chrome: #1e293b;
  --color-gold: #c5a880; /* Legacy accent — prefer --lpvp-blue / --color-silver on Home */
  --lpvp-blue: #4a7fd4;
  --color-silver: #c5ccd6;
  --color-chrome-bright: #9aa4b2;
  --color-whatsapp: #25d366;
  
  /* Borders & Blurs */
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(10, 20, 37, 0.7);

  /* Fonts */
  --font-heading: 'Montserrat', -apple-system, sans-serif;
  --font-body: 'Montserrat', -apple-system, sans-serif;
  
  /* Spacing & Radii */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  scroll-behavior: smooth;
  background-color: var(--color-bg);
  /* iOS overscroll/bounce paints root — keep continuous with body/#app */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
  font-weight: 300;
}

html {
  overflow-x: hidden;
  max-width: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.02em; /* Tighter modern tracking */
  color: var(--color-text);
}

h1 { font-size: 3.5rem; line-height: 1.1; font-weight: 700; }
h2 { font-size: 2.2rem; line-height: 1.2; font-weight: 600; }
h3 { font-size: 1.4rem; font-weight: 500; }

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* Utilities */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.text-gold {
  color: var(--color-gold);
}

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

.text-center { text-align: center; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 32px;
  border-radius: var(--radius-md);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

/* Subtle shine effect on primary buttons */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  transition: none;
}

.btn-primary:hover::after {
  animation: shine 1.5s ease;
}

@keyframes shine {
  0% { left: -100%; }
  100% { left: 200%; }
}

.btn-primary {
  background: var(--color-text);
  color: var(--color-bg);
}

.btn-primary:hover {
  background: var(--color-chrome);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--glass-border);
}

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

.btn-whatsapp {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-whatsapp);
}

.btn-whatsapp:hover {
  background: var(--color-whatsapp);
  color: var(--color-bg);
}

/* Main Layout */
#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg);
}

main {
  flex: 1;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(3, 5, 10, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  transition: all var(--transition-smooth);
}

.navbar .container {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  letter-spacing: 0.05em;
  color: var(--color-text);
}

.nav-links {
  display: flex;
  gap: 2.5rem;
}

.nav-link {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.nav-link:hover, .nav-link.active {
  color: var(--color-text);
}

.cart-btn {
  background: transparent;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 0.7rem;
  font-weight: 600;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.animate-fade-in {
  animation: fadeIn 1s var(--transition-smooth) forwards;
}

/* Scroll Reveal Classes */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--transition-smooth), transform 0.8s var(--transition-smooth);
  will-change: opacity, transform;
  backface-visibility: hidden;
}

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

/* Floating WhatsApp — mid chrome layer; yields to overlays + sticky ATC */
.floating-wa,
#floating-wa.floating-wa {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  min-width: 44px;
  min-height: 44px;
  background: var(--color-whatsapp);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: var(--lpvp-z-wa, 50);
  transition: transform var(--transition-fast), opacity 0.2s ease, visibility 0.2s ease, bottom 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.floating-wa:hover {
  transform: scale(1.1);
}

.floating-wa i,
.floating-wa svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

@media (max-width: 600px) {
  /* Above bottom nav + safe area — never park in top discovery chrome */
  #floating-wa.floating-wa {
    bottom: calc(var(--lpvp-bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
    right: 16px;
    width: 44px;
    height: 44px;
  }
}

@media (min-width: 601px) and (max-width: 860px) {
  #floating-wa.floating-wa {
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    width: 44px;
    height: 44px;
  }
  /* Nudge above sticky bar when sticky is active (no bottom nav band) */
  html.lpvp-chrome-pdp-sticky #floating-wa.floating-wa {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
}

/* Sticky ATC wins on phone: hide WA while sticky is visible */
@media (max-width: 600px) {
  html.lpvp-chrome-pdp-sticky #floating-wa.floating-wa {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* C8 M4.1 — Mobile PDP: purchase UI always wins; suppress floating WA on PDP only */
@media (max-width: 860px) {
  html.lpvp-chrome-pdp #floating-wa.floating-wa {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* C8 M5 — Mobile Advisor: quiz/results/refine actions win over floating WA */
@media (max-width: 860px) {
  html.lpvp-chrome-advisor #floating-wa.floating-wa {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* C8 M6.1 — Mobile Rights: form/receipt CTAs win; hide floating WA on #/derechos */
@media (max-width: 860px) {
  html.lpvp-chrome-rights #floating-wa.floating-wa {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* Overlays (minicart / filters) always cover WA */
html.lpvp-chrome-overlay-open #floating-wa.floating-wa {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Catalog / Home: keep assist FAB bottom-right; never top chrome over search/filters */
@media (max-width: 860px) {
  html.lpvp-chrome-catalog #floating-wa.floating-wa,
  html.lpvp-chrome-home #floating-wa.floating-wa {
    top: auto;
    left: auto;
    right: 16px;
    bottom: calc(var(--lpvp-bottom-nav-h, 48px) + env(safe-area-inset-bottom, 0px) + 12px);
    width: 44px;
    height: 44px;
  }
}

/* C8 M7 — open drawer must not inherit sideways page scroll from Catalog rails */
html.lpvp-chrome-overlay-open,
html.lpvp-chrome-overlay-open body {
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
html.lpvp-chrome-overlay-open #minicart {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Footer */
footer,
.site-footer {
  background: var(--color-bg);
  border-top: 1px solid var(--glass-border);
  padding: 4rem 0 2rem;
  margin-top: 4rem;
}

@media (max-width: 768px) {
  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.8rem; }
  .nav-links { display: none; }
  
  /* M1.1 / Advisor v2 final — compact mobile header; desktop ≥769 unchanged */
  .navbar {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .navbar .container {
    height: 52px;
    padding: 0 14px;
    gap: 0.4rem;
    align-items: center;
  }
  
  .brand-logo {
    max-height: 32px;
    display: flex;
    align-items: center;
    padding: 0 !important;
    flex-shrink: 0;
    overflow: visible;
  }
  
  .brand-logo img {
    height: 30px !important;
    width: auto !important;
    max-width: none !important;
    transform: none !important;
    object-fit: contain;
  }

  .nav-actions {
    gap: 0.2rem;
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-end;
    align-items: center;
  }

  .nav-icon-btn,
  .cart-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .nav-icon-btn i,
  .cart-btn i {
    width: 18px;
    height: 18px;
  }

  .cart-badge {
    top: -4px;
    right: -2px;
    width: 16px;
    height: 16px;
    font-size: 0.62rem;
  }
  
  .container {
    padding: 0 16px; /* Less horizontal padding on mobile */
  }
}

@media (max-width: 360px) {
  .navbar .container {
    height: 48px;
    padding: 0 12px;
  }
  .brand-logo img {
    height: 26px !important;
  }
  .c8-withdrawal-access {
    max-width: 5.6rem;
    font-size: 0.46rem;
    margin-right: 0.2rem;
  }
}
