/* ═══════════════════════════════════════════════════════════════════════════
   Calculadora Giros Aleyn — Frontend CSS
   Diseño limpio y responsive (mobile < 600px | tablet 600-959px | desktop ≥ 960px)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Reset local — encapsulado bajo .ag-calc-wrapper */
.ag-calc-wrapper *,
.ag-calc-wrapper *::before,
.ag-calc-wrapper *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Normaliza botones sin destruir sus fondos propios (NO usar !important
   sobre background/color: rompería el gradiente del CTA y los métodos). */
.ag-calc-wrapper button {
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  line-height: normal;
}
/* Solo el selector de país hereda fondo transparente del campo */
.ag-calc-wrapper .ag-selector {
  background: transparent;
  border: none;
  box-shadow: none;
}

/* ── Contenedor principal ────────────────────────────────────────────────── */
.ag-calc-wrapper {
  font-family: 'Outfit', sans-serif;
  color: #020606;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.ag-calc-wrapper .ag-calc-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 30px 26px;
  box-shadow: 0 4px 32px rgba(22, 62, 63, 0.12);
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}

/* ── Título ──────────────────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ag-calc-wrapper .ag-title {
  font-weight: 700;
  font-size: 26px;
  line-height: 28px;
}

.ag-calc-wrapper .ag-subtitle {
  font-weight: 400;
  font-size: 16px;
  line-height: 18px;
  color: #555;
}

/* ── Campos de monto ─────────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-fields-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  position: relative;
  gap: 0;
}

.ag-calc-wrapper .ag-field {
  display: flex;
  align-items: stretch;
  width: 100%;
  border: 1.5px solid #8B9F9F;
  border-radius: 8px;
  background: #ffffff;
  transition: border-color 0.18s;
  position: relative;
}

.ag-calc-wrapper .ag-field:focus-within {
  border-color: #163E3F;
}

.ag-calc-wrapper .ag-field-envia {
  padding: 20px 20px 24px 20px;
  align-items: flex-start;
}

.ag-calc-wrapper .ag-field-recibe {
  padding: 24px 20px 20px 20px;
  align-items: flex-end;
}

.ag-calc-wrapper .ag-field-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ag-calc-wrapper .ag-field-label {
  font-size: 14px;
  font-weight: 400;
  line-height: 16px;
}

.ag-calc-wrapper .ag-monto-input {
  font-weight: 700;
  font-size: 30px;
  line-height: 32px;
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  padding: 0;
  -moz-appearance: textfield;
}
.ag-calc-wrapper .ag-monto-input::-webkit-outer-spin-button,
.ag-calc-wrapper .ag-monto-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
.ag-calc-wrapper .ag-monto-input::placeholder {
  color: #C5D0D0;
}

/* ── Selector de país ────────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-selector-wrap {
  position: relative;
  display: flex;
  align-items: center;
  align-self: stretch;
  flex-shrink: 0;
  border-left: 1.5px solid #8B9F9F;
  margin-left: 20px;
  padding-left: 20px;
}

.ag-calc-wrapper .ag-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  outline: none;
  cursor: default;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  transition: opacity 0.2s;
}

.ag-calc-wrapper .ag-selector.ag-active {
  cursor: pointer;
}

/* Hover/focus del selector: vencer estilos rojos del tema (mantener limpio) */
.ag-calc-wrapper .ag-selector,
.ag-calc-wrapper .ag-selector:hover,
.ag-calc-wrapper .ag-selector:focus,
.ag-calc-wrapper .ag-selector:active {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}
.ag-calc-wrapper .ag-selector .ag-sel-code {
  color: #020606 !important;
}
.ag-calc-wrapper .ag-selector.ag-active:hover {
  opacity: 0.7;
}
.ag-calc-wrapper .ag-selector.ag-active:focus {
  outline: none;
}

.ag-calc-wrapper .ag-flag-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #E7E7E7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.ag-calc-wrapper .ag-flag-circle img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.ag-calc-wrapper .ag-sel-code {
  font-size: 18px;
  font-weight: 400;
  line-height: 20px;
  width: 48px;
  flex-shrink: 0;
}

/* ── Chevron ─────────────────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
}
.ag-calc-wrapper .ag-chevron.ag-open {
  transform: rotate(180deg);
}

/* ── Dropdown de países ──────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1.5px solid #8B9F9F;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 9999;
  min-width: 190px;
  list-style: none;
  overflow: hidden;
  padding: 4px 0;
}

.ag-calc-wrapper .ag-dropdown li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  color: #020606;
  transition: background 0.14s;
}
.ag-calc-wrapper .ag-dropdown li:hover,
.ag-calc-wrapper .ag-dropdown li.ag-selected {
  background: #EDF6F5;
  color: #163E3F;
}

.ag-calc-wrapper .ag-drop-flag {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #E7E7E7;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ag-calc-wrapper .ag-drop-flag img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.ag-calc-wrapper .ag-drop-name {
  flex: 1;
}
.ag-calc-wrapper .ag-drop-code {
  font-size: 12px;
  color: #8B9F9F;
  flex-shrink: 0;
}

/* ── Pill de tasa ────────────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-pill-absolute {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
}

.ag-calc-wrapper .ag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #B5DBD6;
  color: #163E3F;
  border-radius: 100px;
  padding: 10px 22px 10px 20px;
  white-space: nowrap;
  pointer-events: auto;
}

.ag-calc-wrapper .ag-pill-text {
  font-size: 14px;
  font-weight: 400;
  line-height: 16px;
}
.ag-calc-wrapper .ag-pill-text strong {
  font-weight: 700;
}

/* ── Sección de detalles ─────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-details {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

/* Métodos de pago y entrega */
.ag-calc-wrapper .ag-detail-methods {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1.5px solid #E8EEEC;
}

.ag-calc-wrapper .ag-detail-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Filas genéricas */
.ag-calc-wrapper .ag-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.ag-calc-wrapper .ag-detail-label {
  font-size: 14px;
  font-weight: 500;
  line-height: 16px;
  color: #020606;
  flex: 1;
  min-width: 0;
}

/* Filas de método: en columna (label arriba, botón full-width abajo) */
.ag-calc-wrapper .ag-method-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.ag-calc-wrapper .ag-method-row .ag-detail-label {
  flex: none;
}

/* ── Dropdown de métodos ─────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-method-wrap {
  position: relative;
  width: 100%;
  flex-shrink: 0;
}

.ag-calc-wrapper .ag-method-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  padding: 12px 14px;
  background: #F5FBFA;
  border: 1.5px solid #E8EEEC;
  border-radius: 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 16px;
  color: #020606;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s, background 0.16s;
}
/* Hover: fondo verde claro y texto que SIEMPRE queda verde oscuro
   (vence el text-blanco que aplica el tema de WordPress) */
.ag-calc-wrapper .ag-method-btn:hover,
.ag-calc-wrapper .ag-method-btn:focus {
  border-color: #B5DBD6;
  background: #E2F0EE !important;
  color: #163E3F !important;
}
.ag-calc-wrapper .ag-method-btn:hover .ag-method-val,
.ag-calc-wrapper .ag-method-btn:focus .ag-method-val {
  color: #163E3F !important;
}
.ag-calc-wrapper .ag-method-btn.ag-open {
  border-color: #163E3F;
  background: #E2F0EE !important;
  color: #163E3F !important;
}

.ag-calc-wrapper .ag-method-val {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-calc-wrapper .ag-method-chv {
  flex-shrink: 0;
  transition: transform 0.2s;
}
.ag-calc-wrapper .ag-method-chv.ag-open {
  transform: rotate(180deg);
}

.ag-calc-wrapper .ag-method-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1.5px solid #8B9F9F;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(22, 62, 63, 0.14);
  z-index: 9998;
  list-style: none;
  overflow: hidden;
  padding: 4px 0;
}

.ag-calc-wrapper .ag-method-dropdown li {
  padding: 11px 14px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #020606;
  transition: background 0.14s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-calc-wrapper .ag-method-dropdown li:hover {
  background: #EDF6F5;
  color: #163E3F;
}
.ag-calc-wrapper .ag-method-dropdown li.ag-selected {
  background: #EDF6F5;
  color: #163E3F;
  font-weight: 600;
}

/* ── Valores finales ─────────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-detail-value {
  font-size: 16px;
  font-weight: 700;
  line-height: 18px;
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}
.ag-calc-wrapper .ag-value-green { color: #163E3F; }
.ag-calc-wrapper .ag-value-dark  { color: #020606; }

/* ── Botón CTA ───────────────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-btn-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px;
  background: linear-gradient(138.8deg, #163E3F 14.66%, #47A599 128.32%);
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 18px;
  line-height: 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.2s;
}
.ag-calc-wrapper .ag-btn-cta:hover {
  opacity: 0.9;
}
.ag-calc-wrapper .ag-btn-cta:active {
  opacity: 0.85;
}

/* ── Spinner de carga ────────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 10px;
  z-index: 100;
}
.ag-calc-wrapper .ag-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #EDF6F5;
  border-top-color: #163E3F;
  border-radius: 50%;
  animation: ag-spin 0.65s linear infinite;
  display: block;
}
@keyframes ag-spin { to { transform: rotate(360deg); } }

/* ── Utilidades ──────────────────────────────────────────────────────────── */
.ag-calc-wrapper .ag-hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (600px – 959px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 600px) and (max-width: 959px) {
  /* Sin cambios especiales — hereda desktop */
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (< 600px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 599px) {
  .ag-calc-wrapper .ag-calc-card {
    padding: 40px 20px;
    gap: 20px;
  }

  .ag-calc-wrapper .ag-title {
    font-size: 22px;
    line-height: 24px;
  }

  /* Campos alineados al centro en mobile */
  .ag-calc-wrapper .ag-field-envia,
  .ag-calc-wrapper .ag-field-recibe {
    padding: 16px 20px 22px 20px;
    align-items: center;
  }
  .ag-calc-wrapper .ag-field-recibe {
    padding: 22px 20px 16px 20px;
  }

  /* Métodos en columna completa */
  .ag-calc-wrapper .ag-detail-methods {
    gap: 16px;
    padding-bottom: 20px;
  }

  .ag-calc-wrapper .ag-method-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .ag-calc-wrapper .ag-method-wrap {
    width: 100%;
  }

  .ag-calc-wrapper .ag-method-btn {
    padding: 12px 14px;
    font-size: 14px;
  }

  .ag-calc-wrapper .ag-method-dropdown {
    position: static;
    border-radius: 0 0 6px 6px;
    border-top: none;
    box-shadow: none;
    border-color: #163E3F;
  }

  /* Detalles footer */
  .ag-calc-wrapper .ag-detail-footer {
    gap: 16px;
  }

  .ag-calc-wrapper .ag-detail-footer .ag-detail-row {
    gap: 40px;
  }

  .ag-calc-wrapper .ag-btn-cta {
    padding: 14px 16px;
    font-size: 16px;
  }
}
