/* ========================================
   IPM Tech — Fluid Precision Styles
   ======================================== */

/* --- Base Transitions for Dark Mode --- */
* {
  transition-property: background-color, border-color, color, fill, stroke, box-shadow;
  transition-duration: 0ms;
}

body, section, nav, footer, div[class*="bg-"],
input, select, textarea, button, a {
  transition-duration: 300ms;
  transition-timing-function: ease;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #c1c7d3;
  border-radius: 999px;
}
.dark ::-webkit-scrollbar-thumb {
  background: #414751;
}

/* --- Reveal Animations --- */
.reveal-up {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-up.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays */
.reveal-up:nth-child(1) { transition-delay: 0ms; }
.reveal-up:nth-child(2) { transition-delay: 80ms; }
.reveal-up:nth-child(3) { transition-delay: 160ms; }
.reveal-up:nth-child(4) { transition-delay: 240ms; }
.reveal-up:nth-child(5) { transition-delay: 320ms; }

/* --- Floating Animations --- */
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(10px, -20px) scale(1.02); }
}
@keyframes float-delayed {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-15px, 15px) scale(1.03); }
}
.animate-float {
  animation: float 8s ease-in-out infinite;
}
.animate-float-delayed {
  animation: float-delayed 10s ease-in-out infinite;
}

/* --- WhatsApp Pulse --- */
@keyframes whatsapp-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 105, 85, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(0, 105, 85, 0); }
}
.whatsapp-pulse {
  animation: whatsapp-pulse 2.5s ease-in-out infinite;
}

/* --- Category Cards --- */
.category-card {
  position: relative;
  background: #ffffff;
  border-radius: 2rem;
  padding: 2.5rem;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.dark .category-card {
  background: #1d2023;
}
.category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 2rem;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
  pointer-events: none;
}
.category-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 48px -12px rgba(0, 93, 167, 0.08);
}
.dark .category-card:hover {
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.3);
}
.category-card:hover::before {
  border-color: rgba(0, 93, 167, 0.12);
}
.dark .category-card:hover::before {
  border-color: rgba(164, 201, 255, 0.12);
}
.category-card:active {
  transform: translateY(-2px) scale(0.99);
}

/* Card Icon Animation */
.category-card .card-icon {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.category-card:hover .card-icon {
  transform: scale(1.1) rotate(-5deg);
}

/* Card Arrow */
.category-card .card-arrow {
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  transform: translateX(-8px);
}
.category-card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* --- Service Cards inside Modal --- */
.service-card {
  background: #f7f9fc;
  border-radius: 1.5rem;
  padding: 2rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dark .service-card {
  background: #191c1e;
}
.service-card:hover {
  background: #f2f4f7;
  box-shadow: 0 8px 32px -8px rgba(0, 93, 167, 0.06);
}
.dark .service-card:hover {
  background: #1d2023;
  box-shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.2);
}

/* Stagger for modal cards */
.service-card {
  opacity: 0;
  transform: translateY(20px);
}
.service-card.card-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.3s ease,
              box-shadow 0.3s ease;
}

/* Expandable sections */
.expandable-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.expandable-content.expanded {
  max-height: 500px;
}
.expand-toggle {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}
.expand-toggle:hover {
  color: #005da7;
}
.dark .expand-toggle:hover {
  color: #a4c9ff;
}

/* --- Modal --- */
#modalOverlay {
  transition: opacity 0.28s ease;
}
#modalOverlay #modalCard {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
}
#modalOverlay.modal-open {
  opacity: 1;
}
#modalOverlay.modal-open #modalCard {
  transform: scale(1);
  opacity: 1;
}

/* --- Custom Select --- */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* --- Price Flip Animation --- */
@keyframes price-flip {
  0% { opacity: 1; transform: rotateX(0deg); }
  50% { opacity: 0; transform: rotateX(90deg); }
  100% { opacity: 1; transform: rotateX(0deg); }
}
.price-flip {
  animation: price-flip 0.4s ease;
  display: inline-block;
}

/* --- Nav hide/show --- */
.nav-hidden {
  transform: translateY(-120%);
}

/* --- Dark mode toggle icons --- */
.dark .dark-icon { display: none; }
.dark .light-icon { display: inline-block !important; }

/* --- Form States --- */
.form-success {
  border: 2px solid #006955 !important;
}
.form-error {
  border: 2px solid #ba1a1a !important;
}

/* --- Iguala Plans --- */
.plan-card {
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  transition: all 0.2s ease;
  cursor: default;
}
.plan-card:hover {
  background: rgba(0, 93, 167, 0.05);
}
.dark .plan-card:hover {
  background: rgba(164, 201, 255, 0.05);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal-up {
    opacity: 1;
    transform: none;
  }
  .service-card {
    opacity: 1;
    transform: none;
  }
}

/* --- Brief Modal --- */
#briefOverlay {
  transition: opacity 0.28s ease;
}
#briefOverlay #briefCard {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
}

/* --- Scroll to Top --- */
#scrollTopBtn {
  transition: opacity 0.3s ease, transform 0.2s ease;
}

/* --- Radio as pills --- */
label:has(input[type="radio"]:checked) {
  background: rgba(0, 93, 167, 0.12) !important;
  box-shadow: inset 0 0 0 2px #005da7;
}
.dark label:has(input[type="radio"]:checked) {
  background: rgba(164, 201, 255, 0.12) !important;
  box-shadow: inset 0 0 0 2px #a4c9ff;
}

/* --- Language transition --- */
[data-i18n] {
  transition: opacity 0.2s ease;
}

/* --- Mobile adjustments --- */
@media (max-width: 768px) {
  .category-card {
    padding: 1.75rem;
  }
  .service-card {
    padding: 1.5rem;
  }
}
