/* === KEYFRAMES === */

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* === FORM LAYOUT === */

.checkout-left-column .form-section .row {
  --bs-gutter-x: 12px;
  --bs-gutter-y: 12px;
}

.checkout-left-column .form-section .form-group.mb-30 {
  margin-bottom: 4px;
}

/* Reduce padding-top from checkout to header */
.variation-sec.space {
  padding-top: 40px !important;
}

/* Reduce vertical padding of pills (type/size/platform buttons) */
.variations-buttons button,
.tof-grid-buttons button,
#account-type button,
#trading-capital button,
#platform button {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

/* === CHECKBOXES (Privacy Policy) === */

/* Custom styles for checkboxes (Privacy Policy) */
.form-check-label.check-container {
  display: inline-flex !important;
  align-items: center !important;
  cursor: pointer;
  gap: 8px;
  white-space: nowrap !important;
  width: 100% !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
}

#privacy_policy_field {
  padding-left: 0 !important;
  margin-top: 24px !important;
  margin-bottom: 16px !important;
}

#privacy_policy_field .woocommerce-input-wrapper {
  display: block !important;
}

#privacy_policy_field input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  border: 2px solid rgba(108, 255, 143, 0.3) !important;
  border-radius: 4px !important;
  background: rgba(20, 40, 30, 0.3) !important;
  backdrop-filter: blur(10px);
  cursor: pointer !important;
  position: relative;
  transition: all 0.25s ease;
  margin: -5px 8px 0 0 !important;
  vertical-align: middle;
}

#privacy_policy_field input[type="checkbox"]:hover {
  box-shadow: inset 0 0 12px rgba(108, 255, 143, 0.15);
}

#privacy_policy_field input[type="checkbox"]:checked {
  border-color: #6cff8f !important;
  background: rgba(108, 255, 143, 0.15) !important;
  box-shadow: inset 0 0 18px rgba(108, 255, 143, 0.25);
}

#privacy_policy_field input[type="checkbox"]::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 10px;
  border: solid #6cff8f;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg) scale(0);
  transition: transform 0.2s ease;
}

#privacy_policy_field input[type="checkbox"]:checked::after {
  transform: translate(-50%, -60%) rotate(45deg) scale(1);
}

#privacy_policy_field .woocommerce-input-wrapper label.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  font-size: 14px !important;
  color: white !important;
  line-height: 1.5 !important;
  cursor: pointer !important;
}

/* Error state - red border when invalid */
#privacy_policy_field.woocommerce-invalid input[type="checkbox"],
#privacy_policy_field.woocommerce-invalid-required-field
  input[type="checkbox"] {
  border-color: #f87171 !important;
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.4) !important;
}

#privacy_policy_field.woocommerce-invalid label,
#privacy_policy_field.woocommerce-invalid-required-field label {
  color: #f87171 !important;
}

#privacy_policy_field.woocommerce-invalid a,
#privacy_policy_field.woocommerce-invalid-required-field a {
  color: #f87171 !important;
}

#privacy_policy_field .woocommerce-input-wrapper a {
  color: #4ade80 !important;
  text-decoration: none !important;
}

#privacy_policy_field .woocommerce-input-wrapper a:hover {
  text-decoration: none !important;
  opacity: 0.8;
}

#privacy_policy_field .woocommerce-input-wrapper .required {
  color: #f87171 !important;
  margin-left: 4px !important;
}

/* === PAYMENT RADIO BUTTONS === */

/* Hide the original radio input */
.wc_payment_method input.input-radio,
input[type="radio"].input-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Label as simulated checkbox container */
.wc_payment_method label {
  display: inline-flex !important;
  align-items: center !important;
  cursor: pointer !important;
  gap: 0 !important;
  position: relative !important;
  padding-left: 28px !important;
}

/* Some gateways inject an empty .label-wrap; keep layout identical to oripadding-leftginal */
.wc_payment_method label .label-wrap {
  display: none !important;
}

/* Simulated checkbox with ::before */
.wc_payment_method label::before {
  content: "" !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  border: 2px solid rgba(108, 255, 143, 0.3) !important;
  border-radius: 6px !important;
  background: rgba(20, 40, 30, 0.3) !important;
  box-shadow: none !important;
  transition: all 0.25s ease !important;
  flex-shrink: 0 !important;
  position: absolute !important;
  left: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

/* Checkbox when checked - brighter */
.wc_payment_method input.input-radio:checked + label::before,
input[type="radio"].input-radio:checked + label::before {
  border-color: #6cff8f !important;
  background: rgba(20, 40, 30, 0.6) !important;
  box-shadow: none !important;
}

/* Checkmark with ::after when checked */
.wc_payment_method input.input-radio:checked + label::after,
input[type="radio"].input-radio:checked + label::after {
  content: "" !important;
  position: absolute !important;
  left: 7px !important;
  top: 50% !important;
  width: 5px !important;
  height: 11px !important;
  border: solid #6cff8f !important;
  border-width: 0 2.5px 2.5px 0 !important;
  transform: translateY(-60%) rotate(45deg) !important;
  transition: all 0.2s ease !important;
}

/* Hover effect */
.wc_payment_method label:hover::before {
  box-shadow: none !important;
}

/* === CONFIG CHANGE MODAL === */

.tof-config-change-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tof-config-change-modal.show {
  display: flex;
  opacity: 1;
}

.tof-config-change-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.tof-config-change-content {
  position: relative;
  background: #1a1a1a;
  border: 1px solid rgba(108, 255, 143, 0.2);
  border-radius: 16px;
  padding: 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.tof-config-change-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  background: rgba(255, 193, 7, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.tof-config-change-title {
  font-size: 20px;
  font-weight: 700;
  color: white;
  text-align: center;
  margin: 0 0 12px 0;
}

.tof-config-change-message {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.tof-config-change-actions {
  display: flex;
  gap: 12px;
}

.tof-config-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tof-config-btn-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.tof-config-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
}

.tof-config-btn-confirm {
  background: #6cff8f;
  color: #1a1a1a;
}

.tof-config-btn-confirm:hover {
  background: #5ee87d;
}

/* === ORDER SUMMARY === */

/* Keep the Place Order button arrow even if WooCommerce rewrites the inner HTML */
button#place_order {
  position: relative;
  /* Flex layout doesn't work well when WooCommerce inserts plain text instead of a span,
       so we use an inline-flex approach or a positioned ::after next to the text */
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 12px !important;
}

button#place_order::after {
  content: "";
  display: inline-block;
  width: 40px;
  height: 28px;
  background-color: black;
  border-radius: 16px;
  /* Green arrow SVG embedded as data URI */
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236CFF8F' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3Cpolyline points='12 5 19 12 12 19'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  flex-shrink: 0;
}

/* === ACTIVECAMPAIGN MODAL === */

.tof-ac-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: all;
  transition: opacity 0.3s ease;
}

.tof-ac-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.tof-ac-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}

.tof-ac-modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 24px;
  padding: 32px 32px;
  max-width: 512px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(1);
  transition: transform 0.3s ease;
}

.tof-ac-modal-back {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #666;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.tof-ac-modal-back:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #333;
}

.tof-ac-modal-back svg {
  width: 18px;
  height: 18px;
}

.tof-ac-modal-logo {
  text-align: center;
  margin-bottom: 20px;
}

.tof-ac-modal-logo img {
  max-width: 160px;
  height: auto;
}

.tof-ac-modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  text-align: center;
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.tof-ac-modal-subtitle {
  font-size: 15px;
  color: #666;
  text-align: center;
  margin: 0 0 20px 0;
}

.tof-ac-modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.tof-ac-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  color: #1a1a1a !important;
  background: lab(98.2596% -0.247031 -0.706708) !important;
  border: 2px solid transparent !important;
  border-radius: 12px;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.tof-ac-input::placeholder {
  color: #666 !important;
}

.tof-ac-input:focus {
  background: lab(98.2596% -0.247031 -0.706708) !important;
  border-color: #7bfc7f !important;
  box-shadow:
    0 0 0 4px rgba(123, 252, 127, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.tof-ac-continue-btn {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #d1d1d1;
  border: none;
  border-radius: 12px;
  cursor: not-allowed;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.tof-ac-continue-btn.enabled {
  background: #1a1a1a;
  cursor: pointer;
}

.tof-ac-continue-btn.enabled:hover {
  background: #000;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tof-ac-continue-btn.enabled:active {
  transform: translateY(0);
}

.tof-ac-continue-btn svg {
  width: 20px;
  height: 20px;
}

.tof-ac-modal-trust {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid #e5e5e5;
}

.tof-ac-trust-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: #666;
  text-align: center;
}

.tof-ac-trustpilot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  text-align: center;
}

/* === RESPONSIVE === */

@media (max-width: 768px) {
  /* Evitar doble padding: variation-sec cede el horizontal al container */
  .variation-sec.space {
    padding-top: 16px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .container {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* === CHECKOUT HEADER === */

  /* Override del font-size inline del H1 */
  .title-area h1.sec-title,
  h1.sec-title {
    font-size: 32px !important;
    margin-bottom: 10px !important;
  }

  /* Reducir margen-bottom del title-area (override inline) */
  .title-area {
    margin-bottom: 24px !important;
  }

  .title-area .sec-text {
    font-size: 14px !important;
    line-height: 1.5 !important;
  }

  /* Ocultar salto de línea del párrafo en mobile */
  .title-area .sec-text br {
    display: none;
  }

  /* === CHECKOUT LAYOUT === */

  /* Reducir gap vertical entre secciones del formulario */
  .checkout-left-column {
    gap: 24px !important;
  }

  /* Reducir margen inferior de account-items */
  .account-item {
    margin-bottom: 20px !important;
  }

  /* === ORDER SUMMARY CARD === */

  .order-summary-card {
    padding: 16px !important;
    gap: 12px !important;
  }

  .order-summary-card h4.card-title {
    font-size: 17px !important;
  }

  /* Reducir precio total en mobile para que no desborde */
  .challege-price {
    font-size: 26px !important;
  }

  /* Promo code: input y botón apilados en pantallas muy chicas */
  .promo-code-container > div {
    flex-wrap: wrap;
  }

  .promo-code-container #promo-code-input {
    min-width: 0;
  }

  /* Selection pills: más compactas */
  .selection-pills {
    gap: 6px !important;
    min-height: unset !important;
  }

  .selection-pill {
    padding: 4px 10px !important;
  }

  /* Ocultar overflow de textos en pills */
  .pill-value {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Instruction items: reducir font en mobile */
  .instruction-item .item-caption {
    font-size: 16px !important;
  }

  /* === PRIVACY POLICY CHECKBOX === */

  /* Permitir wrapping del texto en mobile (override de nowrap global) */
  .form-check-label.check-container {
    white-space: normal !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
  }

  /* Modal responsive on mobile */
  .tof-ac-modal-content {
    padding: 28px 20px;
    width: 92%;
    max-width: 380px;
    border-radius: 20px;
    margin: 20px auto;
  }

  .tof-ac-modal-back {
    top: 12px;
    left: 12px;
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
  }

  .tof-ac-modal-back svg {
    width: 16px;
    height: 16px;
  }

  .tof-ac-modal-logo img {
    max-width: 140px;
    margin-bottom: 16px;
  }

  .tof-ac-modal-title {
    font-size: 20px;
    margin-bottom: 8px;
    line-height: 1.2;
  }

  .tof-ac-modal-subtitle {
    font-size: 14px;
    margin-bottom: 24px;
    color: #666;
  }

  .tof-ac-modal-form {
    gap: 14px;
  }

  .tof-ac-input {
    padding: 16px 18px;
    font-size: 16px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
  }

  .tof-ac-input:focus {
    border-color: #7bfc7f;
    box-shadow: 0 0 0 3px rgba(123, 252, 127, 0.1);
    outline: none;
  }

  .tof-ac-continue-btn {
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    background: #d1d1d1;
    color: #fff;
    border: none;
    cursor: not-allowed;
    transition: all 0.2s ease;
    margin-top: 8px;
  }

  .tof-ac-continue-btn.enabled {
    background: #1a1a1a;
    cursor: pointer;
  }

  .tof-ac-continue-btn.enabled:hover {
    background: #000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  .tof-ac-continue-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
  }

  .tof-ac-modal-trust {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
  }

  .tof-ac-trust-badge,
  .tof-ac-trustpilot {
    font-size: 12px;
    text-align: center;
    color: #666;
    line-height: 1.4;
  }

  /* Improve entry animation on mobile */
  .tof-ac-modal-content {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
  }

  .tof-ac-modal:not(.hidden) .tof-ac-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
  }

  /* === GEO CARD === */

  /* Geo card responsive: stack vertical on mobile */
  .geo-info-card {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: flex-start !important;
    padding: 12px 16px !important;
  }

  .geo-info-card > div {
    flex-wrap: wrap !important;
  }

  .geo-info-card a {
    width: 100% !important;
    text-align: center !important;
    margin-top: 8px !important;
  }

  /* Adjust geo info spacing on mobile */
  #geo-location {
    font-size: 13px !important;
    margin-left: 8px !important;
  }

  #geo-ip {
    font-size: 12px !important;
    margin-left: 8px !important;
    display: block !important;
    width: 100% !important;
    margin-top: 4px !important;
  }
}

/* === EXTRA SMALL PHONES (≤ 400px) === */

@media (max-width: 400px) {
  .container {
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  /* H1 más pequeño en pantallas de 375px */
  .title-area h1.sec-title,
  h1.sec-title {
    font-size: 26px !important;
  }

  /* Reducir padding de la card al mínimo */
  .order-summary-card {
    padding: 12px !important;
  }

  /* Botón Apply + input en columna */
  .promo-code-container > div {
    flex-direction: column;
  }

  .promo-code-container #apply-promo-btn {
    width: 100% !important;
  }

  /* Pill text más corto */
  .pill-value {
    max-width: 90px;
  }

  /* Place Order menor padding */
  button#place_order {
    padding: 14px 20px !important;
    font-size: 15px !important;
  }
}

/* === ACCORDION / BREAKDOWN === */

.tof-accordion {
  width: 100%;
}

.tof-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  text-align: left;
}

.tof-accordion-header:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.tof-accordion-header:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(225, 245, 73, 0.25);
}

.tof-accordion-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tof-accordion-title {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.tof-accordion-subtitle {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tof-accordion-chevron {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  transition: transform 200ms ease-in-out;
  flex: 0 0 auto;
}

.tof-accordion-chevron-expanded {
  transform: rotate(180deg);
}

.tof-accordion-panel {
  overflow: hidden;
  max-height: 0px;
  opacity: 0;
  transition:
    max-height 300ms ease,
    opacity 250ms ease;
  margin-top: 10px;
}

.tof-accordion-panel-expanded {
  opacity: 1;
}

.tof-accordion-panel-inner {
  padding: 0;
}
