/* ==========================
   VARIABLES
========================== */
:root {
  /* Dimensions */
  --cta-radius: 0.5rem;
  --cta-btn-radius: 2.87rem;
  /* Spaces */
  --cta-btn-padding: 0.5rem 1rem;
  --cta-btn-padding-lg: 1rem 1.5rem;
  /* Typography */
  --cta-btn-font-size: 1rem;
  --cta-btn-font-size-lg: 1.75rem;
  --cta-btn-font-weight: 600;
  /* Transitions */
  --transition-fast: 0.2s;
  --transition-medium: 0.3s;
  /* Shadows */
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.18);
  --cta-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  /* Z-index */
  --z-index-cta: 100;
  --z-index-overlay: 300;
  --z-index-float-group: 150;
}

/* ==========================
   BASE STYLES
========================== */
button {
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* ==========================
   MOBILE BANNER
========================== */
.mobile-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-index-cta);
  background-color: var(--blue);
  height: 4.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 -0.1rem 0.2rem rgba(255, 255, 255, 0.2);
}

.banner-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 600px;
  padding: 0 1rem;
}
.form-overlay.active .banner-buttons {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.button-icon {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}

/* ==========================
   BTN STYLES
========================== */
.cta-btn,
.banner-btn,
.cta-action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--cta-btn-radius);
  padding: var(--cta-btn-padding);
  font-weight: var(--cta-btn-font-weight);
  font-size: var(--cta-btn-font-size);
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  text-decoration: none;
}

.primary-btn {
  background: var(--white);
  color: var(--blue);
}

.secondary-btn {
  background: transparent;
  color: var(--white);
  border: 0.125rem solid var(--white);
}

/* ==========================
   FORM OVERLAY
========================== */
.form-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--blue);
  color: var(--white);
  z-index: var(--z-index-overlay);
  transform: translateY(100%);
  transition: transform var(--transition-medium) ease;
  overflow-y: auto;
  padding: 2rem 2rem;
  display: block;
  height: 100vh;
  width: 100%;
}

.form-overlay.active,
.form-overlay[open] {
  transform: translateY(0);
   z-index: 9999 !important;
}

/* ==========================
   FLOATING CTA (DESKTOP)
========================== */
.cta-float-group {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: auto;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  z-index: var(--z-index-float-group);
}

/* Floating CTA */
.floating-cta {
  position: relative;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: var(--white);
  color: var(--blue);
  border-radius: .5rem;
  font-size: var(--small);
  font-weight: 600;
  text-align: right;
  z-index: 2;
  box-shadow: 0px 0px 9.7px 0px #FFFFFF;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.33, 1, 0.68, 1);
  position: relative;
  width: 10.68rem;
  height: 3.5rem;
  overflow: hidden;
  transform-origin: top right;
}

/* Isotype dot */
.cta-dot {
  position: absolute;
  top:4px;
  left: 4px;
  width: 0.375rem;
  height:  0.375rem;
  border-radius: 50%;
  background-color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background-color 0.3s ease;
}
.cta-float-group:hover .cta-dot,
.cta-float-group:focus-within .cta-dot {
  width: 1.25rem;
  height: 1.25rem;
  top:7.93px;
  left: 8px;
}
.cta-dot-logo {
  width: 0.6rem;
  height: 0.6rem;
  object-fit: contain;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-fast) ease, visibility var(--transition-fast) ease;
  filter: brightness(0) invert(1);
}
.cta-float-group:hover .cta-dot-logo,
.cta-float-group:focus-within .cta-dot-logo {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cta-dot-overlay {
  position: absolute;
  top: 8px;  
  left: 8px;  
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10; 
}



/* Logo visible con el form activo */
.cta-float-group:not(.form-active) .cta-form-overlay {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.cta-float-group.form-active .cta-dot-logo {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
/* Init state (inside hero): blue dot, white logo */
.cta-float-group.in-hero .cta-dot{
  background-color: var(--blue);
}

.cta-float-group.in-hero .cta-dot-logo {
  filter: brightness(0) invert(1);
}

/* outside hero: white dot, blue logo */
.cta-float-group:not(.in-hero) .cta-dot{
  background-color: var(--white);
}
.cta-float-group:not(.in-hero) .cta-dot-overlay {
   background-color: var(--white);
}

.cta-float-group:not(.in-hero) .cta-dot-logo {
  filter: none;
}

/* outside hero: blue floating-cta */
.cta-float-group:not(.in-hero) .floating-cta {
  background: var(--blue) !important;
  color: var(--white) !important;
  box-shadow: 0px 0px 9.7px 0px #4332FF;
}

/* Fuera del hero expandido: mantener fondo azul siempre */
.cta-float-group:not(.in-hero):hover .floating-cta,
.cta-float-group:not(.in-hero):focus-within .floating-cta {
  background: var(--blue) !important;
  color: var(--white) !important;
  width: 24rem;
  height: 12rem;
}
.cta-float-group:not(.in-hero) .cta-phone {
  color: var(--white);
}

/* outside hero: white divider */
.cta-float-group:not(.in-hero) .cta-divider::before,
.cta-float-group:not(.in-hero) .cta-divider::after {
  border-bottom-color: var(--white);
}

.cta-float-group:not(.in-hero) .cta-divider span {
  color: var(--white);
}

/* outside hero: cta-actions inverted */
.cta-float-group:not(.in-hero) .cta-action-blue {
  background: var(--white);
  color: var(--blue);
  border: 1.5px solid var(--white);
}

.cta-float-group:not(.in-hero) .cta-action-white {
  background: var(--blue);
  color: var(--white);
  border: 1.5px solid var(--white);
}

/* inside hero: white logo */
.cta-float-group.in-hero .cta-dot-logo {
  filter: brightness(0) invert(1);
}

/* outside hero: blue logo (without filter) */
.cta-float-group:not(.in-hero) .cta-dot-logo {
  filter: none;
}

/* inside hero: blue icons */
.cta-float-group.in-hero .cta-action-blue .button-icon {
  filter: brightness(0) invert(1);
}

.cta-float-group.in-hero .cta-action-white .button-icon {
  filter: brightness(0) saturate(100%) invert(26%) sepia(100%) saturate(1000%)
    hue-rotate(220deg) brightness(0.9) contrast(1.1);
}

/* Fuera del hero: iconos de botones invertidos */
.cta-float-group:not(.in-hero) .cta-action-blue .button-icon {
  filter: brightness(0) saturate(100%) invert(26%) sepia(100%) saturate(1000%)
    hue-rotate(220deg) brightness(0.9) contrast(1.1);
}

.cta-float-group:not(.in-hero) .cta-action-white .button-icon {
  filter: brightness(0) invert(1);
}

.floating-cta.bg-blue {
  background: var(--blue);
  color: var(--white);
}

.cta-expanded-content {
  position: relative;
  margin: 0 0 0 0.5rem;
  width: 100%;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0 0.5rem 0 0.5rem;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
  text-align: right;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, max-height;
  contain: layout style;
}

.cta-float-group:hover .cta-expanded-content,
.cta-float-group:focus-within .cta-expanded-content {
  max-height: 100%;
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  padding-bottom: 1rem;
}


.cta-float-group:hover .floating-cta.bg-blue,
.cta-float-group:focus-within .floating-cta.bg-blue {
  background: var(--blue);
  color: var(--white);
}

.cta-label {
  transition: opacity 0.4s;
  display: block;
  white-space: nowrap;
  font-weight: 600;
  font-style: SemiBold;
  font-size: 24px;
  line-height: 100%;
  letter-spacing: -0.5px;
}

.cta-label,
.cta-dot {
  transition: opacity var(--transition-fast) ease,
    visibility var(--transition-fast) ease;
}

.cta-float-group:hover .floating-cta .cta-label,
.cta-float-group:focus-within .floating-cta .cta-label {
  opacity: 0;
  pointer-events: none;
  height: 0;
  overflow: hidden;
}

.cta-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  width: 100%;
  position: relative;
  z-index: 1;
}

.cta-actions .cta-action-btn {
  z-index: 1;
  flex-shrink: 0;
}

.cta-float-group:not(:hover):not(:focus-within) .cta-action-btn {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  z-index: -1;
}

.cta-float-group:hover .cta-action-btn,
.cta-float-group:focus-within .cta-action-btn {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  position: relative;
  z-index: auto;
}

/* ==========================
   ACCION BUTTONS COLORS
========================== */
.cta-action-blue {
  background: var(--blue);
  color: var(--white);
  border: 1.5px solid var(--blue);
}

/* BG blue modifiers */
.bg-blue {
  background-color: var(--blue);
  color: var(--white);
}

.bg-blue .cta-expanded-content {
  background: var(--blue);
  color: var(--white);
}

.bg-blue .cta-phone {
  color: var(--white);
}

.bg-blue .cta-divider::before,
.bg-blue .cta-divider::after {
  border-bottom-color: var(--white);
}

.bg-blue .cta-divider span {
  color: var(--white);
}

.in-hero .cta-action-white {
  background:tansparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}

/* ==========================
   DIVIDERS & PHONE STYLE
========================== */
.cta-phone {
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue);
  text-align: left;
  margin-bottom: 0;
}

.phone-number {
  font-weight: 600;
  display: block;
  font-size: 1.75rem;
}

.cta-divider {
  display: flex;
  align-items: center;
  width: 100%;
}

.cta-divider::before,
.cta-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--blue);
  opacity: 0.3;
}

.cta-divider span {
  margin: 0 1rem;
  color: var(--blue);
  font-weight: 700;
  font-size: 1.1rem;
}

/* ==========================
   RESPONSIVE
========================== */
@media (max-width: 599px) {
  .cta-float-group {
    display: none;
  }

  .mobile-banner {
    display: flex;
  }

  /* .form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    
    margin: 0;
    border-radius: 0;
  } */
  .form-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-index-overlay);
  transform: translateY(100%);
  transition: transform var(--transition-medium) ease;
  display: flex; 
  flex-direction: column; 
  justify-content: flex-start; 
  align-items: center; 
  padding: 2rem 1.5rem; 
  height: auto;
  width: 100%;
  overflow-y: auto; 
}
.form-overlay.active,
.form-overlay[open] {
  transform: translateY(0);
}

}

@media (min-width: 600px) {
  .cta-float-group {
    display: flex;
    transition: padding-bottom var(--transition-medium) ease;
  }

  .mobile-banner {
    display: none;
  }

  .banner-buttons {
    flex-wrap: wrap;
    padding-bottom: 0.5rem;
  }

  .form-overlay {
    bottom: 4.3rem;
  }
}

/* ==========================
   REDUCED MOTION
========================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================
   CTA FORM OVERLAY
========================== */
.cta-form-overlay {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 30rem;
  background: var(--blue);
  border-radius: 1.5rem;
  transform: scaleY(0.8) translateY(100%); 
  transform: translateY(0);
  transform-origin: center bottom; 
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.33, 1, 0.68, 1), opacity 0.3s ease;
  z-index: 1;
  box-shadow: var(--shadow-md);
  height: auto; 
  
}

.cta-form-overlay.active {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  z-index: 1000;
  pointer-events:all;
  width: 30rem;
  border-radius: 1.5rem;
  margin-left: -13rem;
  padding: 3rem 2rem 2rem 2rem; 
  height: fit-content; 
  display : flex;
  bottom: -1rem;
  flex-direction: column;
}


/* Estado después de enviar el formulario */
.cta-form-overlay.active.form-sent {
  height: 20rem !important; 
}
.cta-form-overlay.active.form-sent .feedback-container{
  position: absolute;     
  bottom:16rem;               
  left: 0;
  transform: translateX(-50%) scale(1);
  width: auto;
  max-width: 90%;         
  text-align: left;
  padding: 0;
  margin: 0;
  opacity: 1;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Ocultar elementos innecesarios */
.cta-form-overlay.form-sent .cta-expanded-content,
.cta-form-overlay.form-sent .cta-actions {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}



.cta-float-group.form-active {
  padding-bottom: 0;
  pointer-events: all;
  z-index: 140; 
}

/* When active form, hide expanded content */
.cta-float-group.form-active .cta-expanded-content {
  opacity: 0;
  max-height: 0;
  pointer-events: none;
  visibility: hidden;
  overflow: hidden;
  display: none;
}

/* When active form, fix floating-cta */
.cta-float-group.form-active .floating-cta {
  border-radius: 0 0 1.5rem 1.5rem;
  width: 26rem;
  height: 4rem;
  position: relative;
  overflow: visible;
  transition: none !important;
}
.cta-float-group.form-active:hover .floating-cta,
.cta-float-group.form-active:focus-within .floating-cta {
  width: 26rem !important;
  height: 4rem !important;
}

/* hide "Pedir cita" btn inside form */
.cta-float-group.form-active .cta-form-overlay .date-btn {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: none !important;
}

/* hide actions container when form active */
.cta-float-group.form-active .cta-actions {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* inside hero: form background white */
.cta-float-group.in-hero.form-active .cta-form-overlay {
  background: var(--white);
  color: var(--blue);
  padding: 3rem 2rem 2rem 2rem;
  gap: 1.5rem;
}

/* inside hero: blue typography in form */
.cta-float-group.in-hero.form-active .cta-form-overlay .close-form {
  color: var(--blue);
}

.cta-float-group.in-hero.form-active .cta-form-overlay .back-icon {
  filter: brightness(0) saturate(100%) invert(26%) sepia(100%) saturate(1000%)
    hue-rotate(220deg) brightness(0.9) contrast(1.1);
}

.cta-float-group.in-hero.form-active .cta-form-overlay .form-title {
  color: var(--blue);
}

.cta-float-group.in-hero.form-active .cta-form-overlay .form-notice {
  color: var(--blue);
}

.cta-float-group.in-hero.form-active .cta-form-overlay .form-group input {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.cta-float-group.in-hero.form-active
  .cta-form-overlay
  .form-group
  input::placeholder {
  color: var(--blue);
}

/* Fix validation message alignment */
.cta-float-group.form-active .cta-form-overlay .form-group .validation-message,
.cta-float-group.form-active .cta-form-overlay .validation-message,
.cta-form-overlay.active .form-group .validation-message,
.cta-form-overlay .validation-message {
  position: absolute !important;
  bottom: -1.2rem !important;
  left: 0 !important;
  right: auto !important;
  transform: translateY(0) !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  color: #D4D4D4 !important; 
}

/* Color de mensajes de validación cuando hay error en CTA */
.cta-form-overlay .form-group input:focus:invalid ~ .validation-message,
.cta-form-overlay .form-group input[data-empty="true"] ~ .validation-message,
.cta-float-group.form-active .cta-form-overlay .form-group input:focus:invalid ~ .validation-message,
.cta-float-group.form-active .cta-form-overlay .form-group input[data-empty="true"] ~ .validation-message {
  color: #D4D4D4 !important;
}

.cta-float-group.in-hero.form-active .cta-form-overlay .form-check {
  color: var(--blue);
}

.cta-float-group.in-hero.form-active
  .cta-form-overlay
  .form-check
  input[type="checkbox"] {
  border-color: var(--blue);
}

.cta-float-group.in-hero.form-active .cta-form-overlay .form-check label a {
  color: var(--blue);
}

.cta-float-group.in-hero.form-active .cta-form-overlay .date-btn {
  visibility: hidden;
}

.cta-float-group.in-hero.form-active .cta-form-overlay .submit-btn {
  color: var(--white);
  background-color: var(--blue);
  border-color: var(--white);
}
/* Outside hero: form background blue */
.cta-float-group:not(.in-hero).form-active .cta-form-overlay {
  background: var(--blue);
  color: var(--white);
  padding: 3rem 2rem 2rem 2rem;
  gap: 1.5rem;
}

.cta-float-group:not(.in-hero).form-active .cta-form-overlay .date-btn {
  visibility: hidden;
}

.cta-float-group:not(.in-hero).form-active .cta-form-overlay .submit-btn {
  color: var(--blue);
  background-color: var(--white);
  border-color: var(--blue);
}

/* Estilos de foco visible para accesibilidad */
.cta-action-btn:focus {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.cta-action-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.banner-btn:focus {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}
