/* ============================================
   EURONEST — Custom Styles
   Complément à Tailwind CSS
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  line-height: 1.6;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
}

/* --- Header sticky --- */
.header {
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.header.scrolled {
  background-color: #fff;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

/* --- Desktop Nav Dropdown --- */
.nav-dropdown {
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: all 0.2s ease;
  pointer-events: none;
}

/* Invisible bridge to cover the gap between trigger and dropdown */
.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -16px;
  left: 0;
  right: 0;
  height: 16px;
}

.nav-item:hover .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Extend hover zone on nav-item */
.nav-item {
  padding-bottom: 12px;
  margin-bottom: -12px;
}

/* --- Mobile menu --- */
.mobile-menu {
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-overlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Prevent body scroll when menu is open */
body.menu-open {
  overflow: hidden;
}

/* --- Service cards hover --- */
.service-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

/* Ensure card images fill their container */
.service-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- FAQ accordion --- */
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
  padding-top: 0;
  padding-bottom: 0;
}

.faq-item.active .faq-answer {
  max-height: 600px;
  padding-bottom: 1.25rem;
}

.faq-question {
  cursor: pointer;
  user-select: none;
}

.faq-question:hover {
  background-color: rgba(25, 198, 183, 0.03);
}

.faq-icon {
  transition: transform 0.3s ease;
  line-height: 1;
}

.faq-item.active .faq-icon {
  transform: rotate(45deg);
}

/* --- Counter animation --- */
.counter-value {
  font-variant-numeric: tabular-nums;
}

/* --- CTA pulse --- */
.cta-pulse {
  animation: pulse 2.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(25, 198, 183, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(25, 198, 183, 0); }
}

/* --- Hero overlay --- */
.hero-overlay {
  background: linear-gradient(135deg, rgba(29, 45, 64, 0.88) 0%, rgba(29, 45, 64, 0.55) 100%);
}

/* --- Testimonial slider --- */
.testimonial-track {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Form focus states --- */
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #19C6B7;
  box-shadow: 0 0 0 3px rgba(25, 198, 183, 0.15);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input, textarea, select {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* --- Breadcrumb separator --- */
.breadcrumb-sep::after {
  content: '›';
  margin: 0 0.5rem;
  color: #7A7A7A;
}

/* --- Table tarifs --- */
.tarif-row:nth-child(even) {
  background-color: #F9FAFB;
}

/* --- Scroll reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* --- Footer logo white filter --- */
.footer-logo {
  filter: brightness(0) invert(1);
}

/* --- Active nav link --- */
.nav-active {
  color: #19C6B7 !important;
}

/* --- Button hover effects --- */
.btn-primary {
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* --- Ensure proper stacking --- */
.header { z-index: 50; }
.mobile-overlay { z-index: 998; }
.mobile-menu { z-index: 999; }
.nav-dropdown { z-index: 50; }

/* --- Responsive fixes --- */
@media (max-width: 1023px) {
  /* Prevent hover-triggered dropdown from interfering on touch */
  .nav-dropdown {
    display: none !important;
  }
}

/* --- Mobile (<640px) --- */
@media (max-width: 639px) {
  /* Reduce section padding on mobile */
  section[class*="py-20"] {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
  section[class*="py-16"] {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }

  /* Hero: reduce height and padding on small screens */
  .hero-section, section[class*="min-h-[90vh]"],
  section[class*="min-h-[70vh]"] {
    min-height: 60vh;
  }

  /* Reduce heading sizes on small mobile */
  h1 { font-size: 1.75rem !important; line-height: 1.2; }
  h2 { font-size: 1.5rem !important; line-height: 1.25; }
  h3 { font-size: 1.125rem !important; }

  /* Smaller gap in grids */
  .grid { gap: 1rem; }

  /* Footer: center text on mobile */
  footer .grid {
    text-align: center;
  }
  footer .footer-logo {
    margin-left: auto;
    margin-right: auto;
  }
  footer a.flex {
    justify-content: center;
  }
  footer .flex.items-start {
    justify-content: center;
  }

  /* CTA buttons: full width on mobile */
  .cta-pulse {
    width: 100%;
    justify-content: center;
  }

  /* Counter values: smaller on mobile */
  .counter-value {
    font-size: 2rem;
  }

  /* Mobile menu: full width on very small screens */
  .mobile-menu {
    width: 100%;
  }

  /* FAQ: smaller padding */
  .faq-question {
    padding: 1rem;
  }
  .faq-answer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Service cards: less padding */
  .service-card div[class*="p-6"] {
    padding: 1rem;
  }

  /* Rounded corners: smaller on mobile */
  .rounded-2xl {
    border-radius: 0.75rem;
  }
}

/* --- Small tablets (640px - 767px) --- */
@media (min-width: 640px) and (max-width: 767px) {
  .mobile-menu {
    width: 24rem;
  }
}

/* --- Tablet (768px - 1023px) --- */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Ensure grid layouts don't get too cramped */
  .service-card {
    min-height: auto;
  }
}

/* --- Touch device improvements --- */
@media (hover: none) {
  /* Remove hover effects that don't work on touch */
  .service-card:hover {
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  }

  .btn-primary:hover {
    transform: none;
  }

  /* Make tap targets at least 44px */
  .faq-question {
    min-height: 44px;
  }

  nav a, footer a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* --- Safe area for notched phones --- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  footer {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }

  .mobile-menu {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* --- Sticky phone CTA on mobile --- */
.mobile-cta-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: white;
  border-top: 1px solid #E5E7EB;
  padding: 0.75rem 1rem;
  display: none;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

@media (max-width: 1023px) {
  .mobile-cta-bar {
    display: flex;
    gap: 0.75rem;
  }

  /* Add bottom padding to body so content isn't hidden behind sticky CTA */
  body {
    padding-bottom: 72px;
  }
}

@media (min-width: 1024px) {
  .mobile-cta-bar {
    display: none !important;
  }
}

/* --- Selection color --- */
::selection {
  background-color: rgba(25, 198, 183, 0.2);
  color: #1D2D40;
}

/* --- Print styles --- */
@media print {
  .header, footer, .cta-band, .mobile-menu, .mobile-overlay, .cta-pulse {
    display: none !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
