/* ============================================================
   ECOSWITCH - Stylesheet
   Optimisé pour performance et SEO
   ============================================================ */

/* === 1. BASE STYLES === */
body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  scroll-behavior: smooth;
}

.hero-pattern {
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.24 0 4-1.76 4-4s-1.76-4-4-4-4 1.76-4 4 1.76 4 4 4zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%231e40af' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* === 2. ANIMATIONS ET KEYFRAMES === */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-20px) rotate(1deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.animate-fade-in {
  animation: fadeIn 0.8s ease-in forwards;
  opacity: 0;
}

.phone-pulse {
  animation: pulse 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* === 3. NAVIGATION === */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 3px;
  bottom: 0;
  left: 0;
  background-color: #3b82f6;
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* === 4. BUTTONS === */
.btn-primary {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  transition: all 0.3s ease;
  position: relative;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(30, 64, 175, 0.3);
}

.btn-primary .ripple {
  pointer-events: none;
}

.btn-cookie {
  flex: 1;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.btn-accept {
  background: #4ade80;
  color: #0c4a22;
  border: none;
}

.btn-accept:hover {
  background: #22c55e;
  transform: translateY(-2px);
}

.btn-decline {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-decline:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* === 5. FORMS === */
.form-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

/* Default red border and background for all form inputs (when not validated) */
#energyForm input[type="text"]:not(.border-green-500),
#energyForm input[type="tel"]:not(.border-green-500),
#energyForm select:not(.border-green-500),
#energyForm textarea:not(.border-green-500) {
  border-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.08);
}

/* Validation states for form inputs - RED */
input.border-red-500,
select.border-red-500,
textarea.border-red-500,
.border-red-500 {
  border-color: #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.08) !important;
}

/* Validation states for form inputs - GREEN */
input.border-green-500,
select.border-green-500,
textarea.border-green-500,
.border-green-500 {
  border-color: #10b981 !important;
  background-color: rgba(16, 185, 129, 0.08) !important;
}

input.border-red-500:focus,
select.border-red-500:focus,
textarea.border-red-500:focus,
.border-red-500:focus {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.5) !important;
  background-color: rgba(239, 68, 68, 0.08) !important;
}

input.border-green-500:focus,
select.border-green-500:focus,
textarea.border-green-500:focus,
.border-green-500:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.5) !important;
  background-color: rgba(16, 185, 129, 0.08) !important;
}

/* Custom arrow for select dropdowns */
#energyForm select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23ef4444' d='M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px !important;
}

#energyForm select.border-green-500 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%2310b981' d='M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z'/%3E%3C/svg%3E");
}

/* Labels bold on desktop */
@media (min-width: 768px) {
  #energyForm label {
    font-weight: 600;
  }
}

/* === 6. CARDS === */
.feature-card,
.testimonial-card {
  transition: all 0.3s ease;
  transform: translateY(0);
  opacity: 1;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.testimonial-card:hover {
  transform: scale(1.02);
}

/* === 7. COOKIE POPUP === */
.cookie-popup {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 10000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.5s ease-out;
  max-width: 400px;
  margin: 0 auto;
}

.cookie-popup.show {
  transform: translateY(0);
  opacity: 1;
}

.cookie-popup h3 {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
}

.cookie-popup h3 i {
  margin-right: 10px;
  font-size: 24px;
}

.cookie-popup p {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.cookie-buttons {
  display: flex;
  gap: 12px;
}

/* === 8. PROGRESS BAR === */
.progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  z-index: 1000;
}

.progress-bar {
  height: 4px;
  background: linear-gradient(90deg, #1e40af, #3b82f6);
  width: 0%;
  transition: width 0.2s ease-out;
}

/* === 9. SECTION ECONOMIES (graphiques) === */
/* Variables CSS */
:root {
  --bar-basis-xs: 52px;
  --bar-basis-sm: 66px;
  --bar-basis-md: 80px;
  --bar-basis-lg: 96px;
  --bar-basis-xl: 112px;
  --gap-xs: 0.5rem;
  --gap-sm: 0.875rem;
  --gap-md: 1.25rem;
  --gap-lg: 1.75rem;
  --gap-xl: 2.25rem;
}

[data-anim] {
  opacity: 0;
  transform: translateY(30px);
}

#economies.is-visible [data-anim] {
  opacity: 1;
  transform: translateY(0);
}

.bar-chart {
  display: flex;
  gap: var(--gap-sm);
  align-items: flex-end;
  overflow-x: auto;
  padding: 2.75rem 1rem 1rem;
  margin: 0 -1rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.bar-chart::-webkit-scrollbar {
  display: none;
}

.bar {
  flex: 0 0 var(--bar-basis-sm);
  max-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  scroll-snap-align: center;
}

.bar-inner {
  width: 100%;
  border-radius: 0.75rem 0.75rem 0 0;
  background: linear-gradient(135deg, #3b82f6 0%, #0ea5e9 100%);
  box-shadow: 0 8px 18px -4px rgba(59, 130, 246, 0.35);
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar:hover .bar-inner {
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 12px 24px -6px rgba(59, 130, 246, 0.45);
}

.bar-value {
  position: absolute;
  top: -0.25rem;
  transform: translateY(-100%);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(3px);
  border-radius: 0.5rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0c2a4a;
  white-space: nowrap;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.bar:hover .bar-value {
  opacity: 1;
  transform: translateY(-130%);
}

.bar-label {
  margin-top: 0.7rem;
  font-size: clamp(0.8rem, 3.5vw, 0.88rem);
  font-weight: 600;
  color: #1e40af;
  text-align: center;
}

.feature-card {
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 30px -10px rgba(30, 64, 175, 0.18);
}

.progress-bar-inner {
  height: 100%;
  border-radius: 9999px;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6 0%, #0ea5e9 100%);
}

.stepper {
  counter-reset: step;
}

.stepper-item {
  position: relative;
  padding-top: 2.4rem;
}

.stepper-item::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3b82f6;
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 4px 10px -2px rgba(59, 130, 246, 0.3);
  z-index: 1;
}

.stepper-item::after {
  display: none !important;
}

/* === 10. UTILITIES === */
#formulaire {
  scroll-margin-top: 6rem;
}

#adresse-wrapper {
  position: relative;
}

#suggestions {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  z-index: 30;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 18px 36px -18px rgba(15, 23, 42, 0.4);
  max-height: 18rem;
  overflow-y: auto;
  padding: 0;
  margin: 0;
  list-style: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#suggestions.hidden {
  display: none !important;
}

#suggestions li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  color: #1f2937;
  border-bottom: 1px solid #eef2f7;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

#suggestions li:last-child {
  border-bottom: none;
}

#suggestions li.is-active,
#suggestions li:hover {
  background: #eef2ff;
  color: #1e3a8a;
}

.cta-hero {
  z-index: 2;
}

.piggy-badge {
  pointer-events: auto;
  z-index: 20;
}

/* === 11. MEDIA QUERIES === */
@media (min-width: 640px) {
  .cookie-popup {
    bottom: 30px;
    right: 30px;
    left: auto;
    margin: 0;
  }

  .bar-chart {
    gap: var(--gap-md);
    margin: 0;
    padding-inline: 0;
    justify-content: center;
  }

  .bar {
    flex-basis: var(--bar-basis-sm);
  }
}

@media (min-width: 768px) {
  .stepper {
    display: flex;
    gap: var(--gap-lg);
    align-items: flex-start;
  }

  .stepper-item {
    flex: 1;
    padding-top: 0;
    padding-left: 3rem;
    text-align: left;
  }

  .stepper-item::before {
    top: 0;
    left: 0;
    transform: none;
    width: 3rem;
    height: 3rem;
    font-size: 1.1rem;
  }
}

@media (min-width: 1024px) {
  .bar-chart {
    gap: var(--gap-lg);
  }

  .bar {
    flex-basis: var(--bar-basis-lg);
  }
}

@media (min-width: 1280px) {
  .bar-chart {
    gap: var(--gap-xl);
  }

  .bar {
    flex-basis: var(--bar-basis-xl);
  }
}

@media (max-width: 420px) {
  .feature-card .text-3xl {
    font-size: 2rem;
  }
}

@media (max-width: 399px) {
  .bar-chart {
    gap: var(--gap-xs);
  }

  .bar {
    flex-basis: var(--bar-basis-xs);
    max-width: 94px;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-anim] {
    transition: none;
    opacity: 1;
    transform: none;
  }

  .progress-bar-inner {
    transition: none;
  }
}
/* === 8. RECAPTCHA & FOOTER FIXES === */
.grecaptcha-badge { visibility: hidden !important; }

footer { margin-bottom: 0; padding-bottom: 1rem; }
.floating-call-button { z-index: 9999 !important; }
