/* ============================================================
   VILLALVA — Premium Effects & Enhancements
   "Muy fregón" edition 🎯
   ============================================================ */

/* ---------- Smooth Font Rendering ---------- */
* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ---------- Custom Selection ---------- */
::selection { background: var(--secondary); color: var(--white); }
::-moz-selection { background: var(--secondary); color: var(--white); }

/* ===== 1. HERO — Geometric Particle Overlay ===== */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(233, 113, 50, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(11, 111, 153, 0.1) 0%, transparent 50%),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 40px,
      rgba(11, 111, 153, 0.03) 40px,
      rgba(11, 111, 153, 0.03) 41px
    );
  pointer-events: none;
  z-index: 1;
}

/* Hero badge entrance */
.hero-badge {
  animation: fadeSlideUp 0.6s ease 0.1s both;
}
.hero h1 {
  animation: fadeSlideUp 0.6s ease 0.2s both;
}
.hero-content p {
  animation: fadeSlideUp 0.6s ease 0.3s both;
}
.hero-actions {
  animation: fadeSlideUp 0.6s ease 0.4s both;
}

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

/* Hero parallax effect via transform */
.hero-bg img {
  transition: transform 0.1s linear;
  will-change: transform;
}

/* ===== 2. SERVICE CARDS — 3D Tilt & Premium Hover ===== */
.service-card {
  position: relative;
  border: 1px solid rgba(10, 47, 65, 0.08);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
  perspective: 1000px;
}

/* Gradient accent line at top of card */
.service-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--secondary), var(--accent), var(--primary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.service-card:hover::before {
  transform: scaleX(1);
}

.service-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 60px rgba(10, 47, 65, 0.15), 0 8px 20px rgba(233, 113, 50, 0.08);
  border-color: rgba(233, 113, 50, 0.2);
}

/* Service icon hover effect */
.service-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  font-size: 1.6rem;
  background: rgba(11, 111, 153, 0.08);
  border-radius: 14px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.service-card:hover .service-icon {
  background: rgba(233, 113, 50, 0.15);
  transform: scale(1.1) rotate(-5deg);
  border-radius: 12px;
}

/* ===== 3. SECTOR CARDS — Premium Image Reveal ===== */
.sector-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  min-height: 380px;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sector-card img {
  transition: transform 0.6s ease;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sector-card:hover img {
  transform: scale(1.08);
}

.sector-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 25px 50px rgba(10, 47, 65, 0.2);
}

.sector-card-overlay {
  background: linear-gradient(
    0deg,
    rgba(10, 47, 65, 0.95) 0%,
    rgba(10, 47, 65, 0.4) 50%,
    rgba(10, 47, 65, 0.1) 100%
  );
  transition: background 0.4s ease;
}

.sector-card:hover .sector-card-overlay {
  background: linear-gradient(
    0deg,
    rgba(10, 47, 65, 0.97) 0%,
    rgba(233, 113, 50, 0.25) 50%,
    rgba(10, 47, 65, 0.15) 100%
  );
}

/* ===== 4. SMOOTH COUNTERS — Gradient Background ===== */
.stats-section {
  position: relative;
  background: linear-gradient(135deg, var(--primary), #0d3a52, var(--primary));
  overflow: hidden;
}

.stats-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 10% 50%, rgba(233, 113, 50, 0.1) 0%, transparent 60%),
    radial-gradient(circle at 90% 50%, rgba(11, 111, 153, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.stat-number {
  background: linear-gradient(135deg, var(--secondary), #f5943e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
}

/* ===== 5. BUTTONS — Glow & Ripple ===== */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary {
  position: relative;
  z-index: 1;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(45deg, var(--secondary), var(--accent), var(--secondary));
  border-radius: 50px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  filter: blur(4px);
}

.btn-primary:hover::after {
  opacity: 0.5;
  animation: glowPulse 1.5s infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}

.btn-accent {
  background: linear-gradient(135deg, var(--secondary), #f5943e);
  border: none;
  color: var(--white);
  box-shadow: 0 4px 15px rgba(233, 113, 50, 0.3);
}

.btn-accent:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(233, 113, 50, 0.4);
}

/* ===== 6. TESTIMONIALS — Premium Cards ===== */
.testimonial-card {
  position: relative;
  border: 1px solid rgba(10, 47, 65, 0.06);
  transition: all 0.4s ease;
}

.testimonial-card::before {
  content: '"';
  position: absolute;
  top: 15px;
  left: 20px;
  font-size: 4rem;
  line-height: 1;
  color: rgba(233, 113, 50, 0.15);
  font-family: Georgia, serif;
}

.testimonial-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(10, 47, 65, 0.1);
  border-color: rgba(233, 113, 50, 0.15);
}

.testimonial-avatar {
  background: linear-gradient(135deg, var(--secondary), var(--accent));
}

/* ===== 7. CERT BADGES — Animated Entry ===== */
.cert-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.cert-badge {
  padding: 12px 28px;
  background: var(--white);
  border: 1px solid rgba(10, 47, 65, 0.1);
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
  transition: all 0.3s ease;
  animation: fadeSlideUp 0.5s ease both;
}

.cert-badge:nth-child(1) { animation-delay: 0.05s; }
.cert-badge:nth-child(2) { animation-delay: 0.1s; }
.cert-badge:nth-child(3) { animation-delay: 0.15s; }
.cert-badge:nth-child(4) { animation-delay: 0.2s; }
.cert-badge:nth-child(5) { animation-delay: 0.25s; }
.cert-badge:nth-child(6) { animation-delay: 0.3s; }

.cert-badge:hover {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(10, 47, 65, 0.2);
}

/* ===== 8. REVEAL CLASS — Enhanced Animations ===== */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

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

.grid-3 .reveal:nth-child(2) { transition-delay: 0.1s; }
.grid-3 .reveal:nth-child(3) { transition-delay: 0.15s; }
.grid-3 .reveal:nth-child(4) { transition-delay: 0.2s; }
.grid-3 .reveal:nth-child(5) { transition-delay: 0.1s; }
.grid-3 .reveal:nth-child(6) { transition-delay: 0.15s; }
.grid-3 .reveal:nth-child(7) { transition-delay: 0.1s; }
.grid-3 .reveal:nth-child(8) { transition-delay: 0.15s; }
.grid-3 .reveal:nth-child(9) { transition-delay: 0.2s; }
.grid-3 .reveal:nth-child(10) { transition-delay: 0.1s; }
.grid-3 .reveal:nth-child(11) { transition-delay: 0.15s; }
.grid-3 .reveal:nth-child(12) { transition-delay: 0.2s; }

/* ===== 9. SECTION DIVIDERS ===== */
.section.bg-white + .section.blueprint-bg {
  position: relative;
}

.section.bg-white + .section.blueprint-bg::before {
  display: none; /* handled by existing blueprint bg */
}

/* ===== 10. WHATSAPP FLOAT — Premium Pulse ===== */
.whatsapp-float {
  animation: whatsappPulse 2s infinite;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3);
}

.whatsapp-float:hover {
  animation: none;
  transform: scale(1.1);
  box-shadow: 0 8px 30px rgba(37, 211, 102, 0.5);
}

@keyframes whatsappPulse {
  0% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3); }
  50% { box-shadow: 0 4px 30px rgba(37, 211, 102, 0.5); }
  100% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3); }
}

/* ===== 11. BREADCRUMB ENHANCEMENT ===== */
.breadcrumb a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: var(--secondary);
}

.breadcrumb {
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
  margin-bottom: 15px;
}

/* ===== 12. LOADING SKELETON ===== */
.hero-mini-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hero-mini-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== 13. CARD GRID — Hover Group Effect ===== */
.grid-3:hover > .service-card:not(:hover) {
  opacity: 0.7;
  transform: scale(0.98);
}

.grid-3 {
  transition: opacity 0.3s ease;
}

/* ===== 14. BLOG CARDS ===== */
#blog-grid .card {
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#blog-grid .card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 20px 50px rgba(10, 47, 65, 0.12);
}

/* ===== 15. MOBILE NAV — Glass Effect ===== */
@media (max-width: 768px) {
  .nav.active {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .hero h1 {
    font-size: clamp(1.8rem, 6vw, 2.8rem);
  }

  .stat-number {
    font-size: 2.2rem;
  }

  .sector-card {
    min-height: 280px;
  }
}

/* ===== 16. DARK CTA SECTION ENHANCEMENT ===== */
.bg-primary .btn-primary {
  background: var(--white);
  color: var(--primary);
}

.bg-primary .btn-primary:hover {
  background: var(--secondary);
  color: var(--white);
}

/* ===== PREMIUM FEATURES v2 ===== */

/* Scroll Progress Bar */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--secondary), var(--accent));
  z-index: 9999;
  transition: width 0.1s linear;
  width: 0;
  border-radius: 0 2px 2px 0;
}

/* Back to Top */
#back-to-top {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 997;
  font-size: 1.3rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(10,47,65,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}
#back-to-top:hover { background: var(--secondary); transform: translateY(-3px); box-shadow: 0 8px 25px rgba(10,47,65,0.3); }

/* AI Chat Bubble */
#ai-chat-bubble {
  animation: bubblePulse 3s infinite;
}
@keyframes bubblePulse {
  0%, 100% { box-shadow: 0 8px 25px rgba(10,47,65,0.3); }
  50% { box-shadow: 0 8px 35px rgba(11,118,159,0.5), 0 0 0 6px rgba(11,118,159,0.08); }
}
#ai-chat-bubble:hover { animation: none; }

/* AI Chat Panel */
#ai-chat {
  animation: chatSlideUp 0.3s ease;
}
@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
#ai-chat-messages a { text-decoration: underline; }

/* Hero slider smooth */
.hero-bg {
  transition: transform 0.1s linear;
}
.hero-bg img {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* 3D card tilt */
.service-card, .sector-card {
  transition: transform 0.1s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  will-change: transform;
}

/* Premium section dividers */
.section.blueprint-bg {
  position: relative;
}
.section.blueprint-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background-image: 
    linear-gradient(rgba(11,118,159,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11,118,159,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* Stats section with animated gradient */
.stats-section {
  animation: statsGlow 4s ease-in-out infinite;
}
@keyframes statsGlow {
  0%, 100% { background: linear-gradient(135deg, var(--primary), #0d3a52, var(--primary)); }
  50% { background: linear-gradient(135deg, var(--primary), #0B769F, var(--primary)); }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  #ai-chat {
    width: calc(100vw - 30px) !important;
    left: 15px !important;
    max-height: 60vh;
  }
  #ai-chat-bubble {
    left: 15px;
    bottom: 90px;
  }
  #back-to-top {
    right: 15px;
    bottom: 80px;
  }
}

/* Pulsing loading dots for empty states */
@keyframes dotPulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}
