/* =====================================================
   CAP · Finalizar compra
   ===================================================== */

.cap-checkout {
  --cap-navy: #08284b;
  --cap-green: #568523;
  --cap-green-hover: #426b19;
  --cap-text: #43566b;
  --cap-border: #dce5ed;
  --cap-soft: #f5f8fa;
  --cap-error: #a62828;

  width: 100%;
  min-width: 0;
  color: var(--cap-text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
}

.cap-checkout,
.cap-checkout * {
  box-sizing: border-box;
}

/* TÍTULOS */

.cap-checkout h2,
.cap-checkout h3 {
  margin-bottom: 22px;
  color: var(--cap-navy) !important;
  font-family: inherit !important;
  font-weight: 800 !important;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.cap-checkout h2 {
  font-size: clamp(25px, 2.4vw, 32px) !important;
}

.cap-checkout h3 {
  font-size: 23px !important;
}

/* ENLACES */

.cap-checkout a {
  color: var(--cap-navy);
  text-underline-offset: 3px;
}

.cap-checkout a:hover {
  color: var(--cap-green);
}

/* FORMULARIO */

.cap-checkout form.checkout {
  margin: 0;
}

.cap-checkout .woocommerce-billing-fields,
.cap-checkout .woocommerce-shipping-fields,
.cap-checkout .woocommerce-additional-fields {
  min-width: 0;
}

.cap-checkout .form-row {
  margin-bottom: 18px;
}

.cap-checkout .form-row label {
  display: block;
  margin-bottom: 7px;
  color: var(--cap-navy);
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
}

.cap-checkout .form-row label.checkbox,
.cap-checkout .form-row label.woocommerce-form__label-for-checkbox {
  display: inline;
}

.cap-checkout .woocommerce-input-wrapper {
  display: block;
}

.cap-checkout .required {
  color: var(--cap-error);
  text-decoration: none;
}

.cap-checkout .optional {
  color: #697a8b;
  font-size: 12px;
  font-weight: 400;
}

/* CAMPOS */

.cap-checkout input.input-text,
.cap-checkout input[type="text"],
.cap-checkout input[type="email"],
.cap-checkout input[type="tel"],
.cap-checkout input[type="number"],
.cap-checkout input[type="password"],
.cap-checkout select,
.cap-checkout textarea {
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px !important;

  border: 1px solid var(--cap-border) !important;
  border-radius: 9px !important;
  background: #fff !important;
  color: var(--cap-navy) !important;

  font-family: inherit !important;
  font-size: 15px !important;
  font-weight: 400;
  line-height: 1.5;
  box-shadow: none;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.cap-checkout input::placeholder,
.cap-checkout textarea::placeholder {
  color: #697a8b;
  opacity: 1;
}

.cap-checkout textarea {
  min-height: 125px;
  resize: vertical;
}

.cap-checkout input.input-text:focus,
.cap-checkout select:focus,
.cap-checkout textarea:focus {
  border-color: var(--cap-green) !important;
}

.cap-checkout input[type="checkbox"],
.cap-checkout input[type="radio"] {
  accent-color: var(--cap-green);
}

/* SELECTORES DE PAÍS Y ESTADO */

.cap-checkout .select2-container {
  width: 100% !important;
  max-width: 100%;
}

.cap-checkout .select2-selection--single {
  min-height: 48px !important;
  border: 1px solid var(--cap-border) !important;
  border-radius: 9px !important;
  background: #fff !important;
}

.cap-checkout
.select2-container
.select2-selection--single
.select2-selection__rendered {
  padding: 10px 34px 10px 14px !important;
  color: var(--cap-navy) !important;
  font-family: inherit;
  font-size: 15px;
  line-height: 26px !important;
}

.cap-checkout .select2-selection__arrow {
  height: 46px !important;
}

.cap-checkout
.select2-container--focus
.select2-selection--single,
.cap-checkout
.select2-container--open
.select2-selection--single {
  border-color: var(--cap-green) !important;
}

/* RESUMEN DEL PEDIDO */

.cap-checkout #order_review_heading {
  color: var(--cap-navy) !important;
}

.cap-checkout table.shop_table {
  width: 100%;
  margin: 0 0 24px;
  border: 1px solid var(--cap-border) !important;
  border-spacing: 0;
  border-collapse: separate;
  border-radius: 14px;
  background: #fff;
}

.cap-checkout table.shop_table th,
.cap-checkout table.shop_table td {
  padding: 16px !important;
  border-top-color: var(--cap-border) !important;
  color: var(--cap-text);
  font-size: 14px !important;
  line-height: 1.5;
  vertical-align: middle;
}

.cap-checkout table.shop_table thead th {
  background: var(--cap-soft);
  color: var(--cap-navy) !important;
  font-weight: 750 !important;
}

.cap-checkout table.shop_table thead th:first-child {
  border-top-left-radius: 14px;
}

.cap-checkout table.shop_table thead th:last-child {
  border-top-right-radius: 14px;
}

.cap-checkout table.shop_table .product-name {
  color: var(--cap-navy);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.cap-checkout table.shop_table .product-total {
  text-align: right;
}

.cap-checkout .product-quantity {
  color: var(--cap-navy);
  font-weight: 750;
}

.cap-checkout dl.variation {
  margin: 6px 0 0;
  color: var(--cap-text);
  font-size: 12px;
  font-weight: 400;
}

.cap-checkout dl.variation p {
  margin: 0;
}

.cap-checkout .woocommerce-Price-amount {
  color: var(--cap-navy);
  font-weight: 700;
}

.cap-checkout table.shop_table tfoot th {
  color: var(--cap-navy);
  font-weight: 650;
}

/* TOTAL DESTACADO */

.cap-checkout table.shop_table .order-total th,
.cap-checkout table.shop_table .order-total td {
  padding-top: 22px !important;
  padding-bottom: 22px !important;
  background: #f1f6ec;
  color: var(--cap-navy);
  font-size: 18px !important;
  font-weight: 800;
}

.cap-checkout .order-total .woocommerce-Price-amount {
  font-size: 24px;
  font-weight: 800;
}

/* MÉTODOS DE ENVÍO */

.cap-checkout ul#shipping_method {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cap-checkout ul#shipping_method li {
  margin: 0 0 10px;
  line-height: 1.5;
}

.cap-checkout ul#shipping_method label {
  color: var(--cap-text);
  font-size: 14px;
}

/* MÉTODOS DE PAGO */

.cap-checkout #payment {
  overflow: visible;
  border: 1px solid var(--cap-border);
  border-radius: 14px;
  background: var(--cap-soft) !important;
}

.cap-checkout #payment ul.payment_methods {
  margin: 0;
  padding: 22px !important;
  border-bottom: 1px solid var(--cap-border) !important;
  list-style: none;
}

.cap-checkout #payment ul.payment_methods li {
  margin-bottom: 14px;
}

.cap-checkout #payment ul.payment_methods li:last-child {
  margin-bottom: 0;
}

.cap-checkout #payment ul.payment_methods label {
  color: var(--cap-navy);
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
}

.cap-checkout #payment .payment_box {
  padding: 16px !important;
  border-radius: 9px;
  background: #eaf0f4 !important;
  color: var(--cap-text) !important;
  font-size: 14px;
  line-height: 1.6;
}

.cap-checkout #payment .payment_box::before {
  border-bottom-color: #eaf0f4 !important;
}

.cap-checkout #payment .place-order {
  padding: 22px !important;
}

/* PRIVACIDAD Y TÉRMINOS */

.cap-checkout .woocommerce-privacy-policy-text,
.cap-checkout .woocommerce-terms-and-conditions-wrapper {
  margin-bottom: 18px;
  color: var(--cap-text);
  font-size: 13px;
  line-height: 1.7;
}

.cap-checkout .woocommerce-privacy-policy-text a,
.cap-checkout .woocommerce-terms-and-conditions-wrapper a {
  color: var(--cap-navy);
  text-decoration: underline;
}

/* BOTONES SECUNDARIOS */

.cap-checkout button.button,
.cap-checkout input.button,
.cap-checkout a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 46px;
  max-width: 100%;
  padding: 12px 20px !important;

  border: 1px solid var(--cap-navy) !important;
  border-radius: 9px !important;
  background: var(--cap-navy) !important;
  color: #fff !important;

  font-family: inherit !important;
  font-size: 14px !important;
  font-weight: 750 !important;
  line-height: 1.4 !important;
  text-align: center;
  text-decoration: none !important;
  white-space: normal;
  cursor: pointer;
}

.cap-checkout button.button:hover,
.cap-checkout input.button:hover,
.cap-checkout a.button:hover {
  border-color: #164674 !important;
  background: #164674 !important;
  color: #fff !important;
}

/* BOTÓN PRINCIPAL */

.cap-checkout button#place_order {
  display: flex !important;
  align-items: center;
  justify-content: center;

  float: none !important;
  width: 100% !important;
  min-height: 56px;
  margin: 16px 0 0 !important;
  padding: 16px 22px !important;

  border: 1px solid var(--cap-green) !important;
  border-radius: 10px !important;
  background: var(--cap-green) !important;
  color: #fff !important;

  font-family: inherit !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  line-height: 1.4 !important;
}

.cap-checkout button#place_order:hover {
  border-color: var(--cap-green-hover) !important;
  background: var(--cap-green-hover) !important;
}

.cap-checkout button.button:disabled,
.cap-checkout input.button:disabled,
.cap-checkout .button.disabled {
  opacity: 0.5 !important;
  cursor: not-allowed;
}

/* CUPÓN Y ACCESO A CUENTA */

.cap-checkout form.checkout_coupon,
.cap-checkout form.woocommerce-form-login {
  margin: 0 0 24px;
  padding: 22px;
  border: 1px solid var(--cap-border);
  border-radius: 14px;
  background: #fff;
}

/* AVISOS */

.cap-checkout .woocommerce-message,
.cap-checkout .woocommerce-info,
.cap-checkout .woocommerce-error {
  border-radius: 10px;
  color: var(--cap-navy);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
}

.cap-checkout .woocommerce-message {
  border-top-color: var(--cap-green);
  background: #f1f6ec;
}

.cap-checkout .woocommerce-info {
  border-top-color: var(--cap-navy);
  background: #f1f5f9;
}

.cap-checkout .woocommerce-error {
  border-top-color: var(--cap-error);
  background: #fff3f2;
}

/* CAMPOS CON ERROR */

.cap-checkout .woocommerce-invalid input.input-text,
.cap-checkout .woocommerce-invalid select,
.cap-checkout .woocommerce-invalid .select2-selection--single,
.cap-checkout [aria-invalid="true"] {
  border-color: var(--cap-error) !important;
}

/* ACCESIBILIDAD */

.cap-checkout a:focus-visible,
.cap-checkout button:focus-visible,
.cap-checkout input:focus-visible,
.cap-checkout select:focus-visible,
.cap-checkout textarea:focus-visible,
.cap-checkout .select2-selection:focus-visible {
  outline: 3px solid #79ad40;
  outline-offset: 3px;
}

/* MÓVIL */

@media (max-width: 767px) {
  .cap-checkout h3 {
    font-size: 21px !important;
  }

  .cap-checkout .form-row-first,
  .cap-checkout .form-row-last {
    float: none !important;
    width: 100% !important;
  }

  /* Evita el zoom automático al escribir en móviles. */
  .cap-checkout input.input-text,
  .cap-checkout select,
  .cap-checkout textarea {
    font-size: 16px !important;
  }

  .cap-checkout table.shop_table th,
  .cap-checkout table.shop_table td {
    padding: 13px 10px !important;
    font-size: 13px !important;
  }

  .cap-checkout .order-total .woocommerce-Price-amount {
    font-size: 21px;
  }

  .cap-checkout #payment ul.payment_methods,
  .cap-checkout #payment .place-order,
  .cap-checkout form.checkout_coupon,
  .cap-checkout form.woocommerce-form-login {
    padding: 16px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cap-checkout input,
  .cap-checkout select,
  .cap-checkout textarea {
    transition: none !important;
  }
}

/* CAP · Aviso superior del cupón */
.cap-checkout .woocommerce-form-coupon-toggle .woocommerce-info {
  position: relative;
  margin: 0 0 24px !important;
  padding: 18px 22px !important;

  background: #f3f7ef !important;
  color: #08284b !important;
  border: 1px solid #dce5d3 !important;
  border-left: 4px solid #568523 !important;
  border-radius: 12px !important;
  box-shadow: none !important;

  font-family: inherit;
  font-size: 15px !important;
  font-weight: 500;
  line-height: 1.6;
}

/* Quita el icono que aparece como un cuadrito */
.cap-checkout .woocommerce-form-coupon-toggle .woocommerce-info::before {
  display: none !important;
}

/* Enlace que abre el formulario */
.cap-checkout .woocommerce-form-coupon-toggle .woocommerce-info a {
  display: inline;
  padding: 0 !important;
  background: transparent !important;
  color: #426b19 !important;
  border: 0 !important;
  box-shadow: none !important;

  font: inherit;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cap-checkout .woocommerce-form-coupon-toggle .woocommerce-info a:hover {
  color: #08284b !important;
}

.cap-checkout .woocommerce-form-coupon-toggle .woocommerce-info a:focus-visible {
  outline: 2px solid #568523;
  outline-offset: 4px;
  border-radius: 3px;
}

@media (max-width: 767px) {
  .cap-checkout .woocommerce-form-coupon-toggle .woocommerce-info {
    padding: 15px 16px !important;
    font-size: 14px !important;
  }
}