/**
 * ZOX Robotics - Selector de país y bandera para teléfono
 * Utilizado en landing de eventos (ES y EN)
 */

/* Anular margin-top negativo de style-pages.css para evitar que el input tape el label */
body.landing-zox-eventos .zrx-events .wpcf7-form .wpcf7-form-control-wrap,
body.landing-zox-eventos-en .zrx-ind-en .wpcf7-form .wpcf7-form-control-wrap,
.wpcf7-form .wpcf7-form-control-wrap[data-name="your-phone"] {
  display: block !important;
  width: 100% !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  position: relative !important;
}

body.landing-zox-eventos .zrx-events .wpcf7-form label,
body.landing-zox-eventos-en .zrx-ind-en .wpcf7-form label {
  display: block !important;
  margin-bottom: 6px !important;
  line-height: 1.2 !important;
}

/* Contenedor unificado: mismo borde, radio y fondo que los otros inputs */
.zrx-phone-input-group {
  display: flex !important;
  align-items: stretch !important;
  width: 100% !important;
  border: 1.8px solid #0aa6d6 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  position: relative !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.zrx-phone-input-group:focus-within {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(10, 166, 214, 0.2) !important;
}

.zrx-phone-input-group.has-error,
.zrx-phone-input-group:has(.wpcf7-not-valid) {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18) !important;
}

/* Wrapper del desplegable de país */
.zrx-country-select {
  position: relative !important;
  display: flex !important;
  align-items: stretch !important;
  flex-shrink: 0 !important;
  z-index: 10 !important;
}

/* Botón con bandera + código + flecha: Fondo blanco y divisor cian sutil */
.zrx-country-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  padding: 13px 10px 13px 14px !important;
  background: #ffffff !important;
  border: none !important;
  border-right: 1.5px solid rgba(10, 166, 214, 0.3) !important;
  border-radius: 10px 0 0 10px !important;
  cursor: pointer !important;
  font-family: inherit !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  color: #1e293b !important;
  outline: none !important;
  user-select: none !important;
  transition: background-color 0.15s ease !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}

.zrx-country-btn:hover {
  background: #f0f9ff !important;
}

.zrx-country-btn:focus-visible {
  background: #e0f2fe !important;
}

/* Bandera dentro del botón */
.zrx-country-flag {
  width: 22px !important;
  height: 15px !important;
  object-fit: cover !important;
  border-radius: 2px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18) !important;
  flex-shrink: 0 !important;
  display: block !important;
}

/* Texto del código de país (+51) */
.zrx-country-dial {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  letter-spacing: 0.2px !important;
  white-space: nowrap !important;
}

/* Flechita / Caret down en color cian */
.zrx-country-arrow {
  width: 12px !important;
  height: 12px !important;
  fill: #0aa6d6 !important;
  transition: transform 0.2s ease !important;
  flex-shrink: 0 !important;
  display: block !important;
}

.zrx-country-select.is-open .zrx-country-arrow {
  transform: rotate(180deg) !important;
}

/* Input de teléfono dentro del grupo */
body.landing-zox-eventos .zrx-events .wpcf7-form .zrx-phone-input-group input[name="your-phone"],
body.landing-zox-eventos-en .zrx-ind-en .wpcf7-form .zrx-phone-input-group input[name="your-phone"],
.zrx-phone-input-group input.cf7-input,
.zrx-phone-input-group input[name="your-phone"] {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: 100% !important;
  border: none !important;
  border-radius: 0 10px 10px 0 !important;
  padding: 13px 14px 13px 10px !important;
  margin: 0 !important;
  font-size: 16px !important;
  font-family: inherit !important;
  outline: none !important;
  background: transparent !important;
  color: #1e293b !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
}

/* Asegurar que el contenedor del formulario no cree barras de scroll al abrir el desplegable */
body.landing-zox-eventos .zrx-events__card,
body.landing-zox-eventos-en .zrx-ind-en__card {
  overflow: visible !important;
}

/* Menú desplegable flotante */
.zrx-country-dropdown {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  left: 0 !important;
  width: 280px !important;
  max-width: min(280px, calc(100vw - 32px)) !important;
  max-height: 260px !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 12px !important;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08) !important;
  z-index: 99999 !important;
  display: none !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  animation: zrxCountryFadeIn 0.16s ease-out !important;
}

@keyframes zrxCountryFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.zrx-country-select.is-open .zrx-country-dropdown {
  display: flex !important;
}

/* Buscador de países dentro del dropdown */
.zrx-country-search-wrap {
  padding: 8px 10px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
  box-sizing: border-box !important;
}

.zrx-country-search-inner {
  display: flex !important;
  align-items: center !important;
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 0 10px !important;
  height: 36px !important;
  box-sizing: border-box !important;
  cursor: text !important;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease !important;
}

.zrx-country-search-inner:focus-within {
  border-color: #0aa6d6 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(10, 166, 214, 0.15) !important;
}

.zrx-country-search-icon {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  min-height: 15px !important;
  fill: #64748b !important;
  color: #64748b !important;
  margin: 0 8px 0 0 !important;
  flex-shrink: 0 !important;
  display: block !important;
  pointer-events: none !important;
}

body.landing-zox-eventos .zrx-events .wpcf7-form input.zrx-country-search,
body.landing-zox-eventos-en .zrx-ind-en .wpcf7-form input.zrx-country-search,
.wpcf7-form input.zrx-country-search,
input.zrx-country-search,
.zrx-country-search {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 13px !important;
  font-family: inherit !important;
  color: #1e293b !important;
  outline: none !important;
  background: transparent !important;
  height: 100% !important;
  box-shadow: none !important;
  line-height: normal !important;
}

body.landing-zox-eventos .zrx-events .wpcf7-form input.zrx-country-search::placeholder,
body.landing-zox-eventos-en .zrx-ind-en .wpcf7-form input.zrx-country-search::placeholder,
.wpcf7-form input.zrx-country-search::placeholder,
input.zrx-country-search::placeholder,
.zrx-country-search::placeholder {
  color: #94a3b8 !important;
  font-size: 13px !important;
  opacity: 1 !important;
}

/* Lista scrolleable de países */
.zrx-country-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 4px 0 !important;
  max-height: 220px !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  box-sizing: border-box !important;
}

.zrx-country-list::-webkit-scrollbar {
  width: 6px !important;
}
.zrx-country-list::-webkit-scrollbar-track {
  background: transparent !important;
}
.zrx-country-list::-webkit-scrollbar-thumb {
  background: #cbd5e1 !important;
  border-radius: 4px !important;
}
.zrx-country-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8 !important;
}

/* Divisor de grupo */
.zrx-country-divider {
  padding: 6px 12px 4px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  color: #94a3b8 !important;
  background: #f8fafc !important;
  border-top: 1px solid #f1f5f9 !important;
  border-bottom: 1px solid #f1f5f9 !important;
  margin: 4px 0 !important;
  user-select: none !important;
}

/* Elemento país */
.zrx-country-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 12px !important;
  cursor: pointer !important;
  transition: background-color 0.12s ease !important;
  user-select: none !important;
  box-sizing: border-box !important;
}

.zrx-country-item:hover,
.zrx-country-item.is-highlighted {
  background: #f0f9ff !important;
}

.zrx-country-item.is-selected {
  background: #e0f2fe !important;
}

.zrx-country-item-flag {
  width: 20px !important;
  height: 14px !important;
  object-fit: cover !important;
  border-radius: 2px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) !important;
  flex-shrink: 0 !important;
}

.zrx-country-item-name {
  flex: 1 !important;
  font-size: 13.5px !important;
  color: #334155 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  text-align: left !important;
}

.zrx-country-item.is-selected .zrx-country-item-name {
  font-weight: 600 !important;
  color: #0369a1 !important;
}

.zrx-country-item-code {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #0aa6d6 !important;
  flex-shrink: 0 !important;
  letter-spacing: 0.2px !important;
}

.zrx-country-no-results {
  padding: 16px !important;
  text-align: center !important;
  font-size: 13px !important;
  color: #64748b !important;
  user-select: none !important;
}

/* =========================================================
   RESPONSIVIDAD Y BREAKPOINTS (alineado con landing-zox-eventos.css)
   ========================================================= */

@media (max-height: 900px) and (min-width: 1025px) {
  .zrx-country-btn {
    padding: 10px 8px 10px 12px !important;
    font-size: 14px !important;
  }
  .zrx-country-dial {
    font-size: 14px !important;
  }
  body.landing-zox-eventos .zrx-events .wpcf7-form .zrx-phone-input-group input[name="your-phone"],
  body.landing-zox-eventos-en .zrx-ind-en .wpcf7-form .zrx-phone-input-group input[name="your-phone"] {
    padding: 10px 12px 10px 8px !important;
    font-size: 15px !important;
  }
}

@media (max-width: 1366px) and (max-height: 768px) and (min-width: 1200px) {
  .zrx-country-btn {
    padding: 9px 8px 9px 10px !important;
    font-size: 14px !important;
  }
  .zrx-country-dial {
    font-size: 14px !important;
  }
  body.landing-zox-eventos .zrx-events .wpcf7-form .zrx-phone-input-group input[name="your-phone"],
  body.landing-zox-eventos-en .zrx-ind-en .wpcf7-form .zrx-phone-input-group input[name="your-phone"] {
    padding: 9px 10px 9px 8px !important;
    font-size: 15px !important;
  }
}
