/* ========================================================
   FINALIZAR COMPRA (diseño Figma)
   Todo va bajo .jp-checkout para no afectar a otras páginas
   ======================================================== */

.jp-checkout {
  --jp-navy: #0f3a66;
  --jp-blue: #2d85c6;
  --jp-cta: #49a8df;
  --jp-text: #5b6775;
  --jp-muted: #9aa3af;
  --jp-border: #e2e6eb;
  --jp-input: #dde2e8;
  --jp-soft: #f6f8f9;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 40px 15px;
  box-sizing: border-box;
  font-family: inherit;
}

.jp-checkout *,
.jp-checkout *::before,
.jp-checkout *::after {
  box-sizing: border-box;
}

.jp-checkout-grid {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.jp-checkout-main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 744px;
}

.jp-checkout-side {
  flex: 0 0 372px;
  width: 372px;
  position: sticky;
  top: 24px;
}

.jp-co-hidden {
  display: none;
}

/* ---------- Secciones ---------- */
.jp-co-section {
  background: #fff;
  border: 1px solid var(--jp-border);
  border-radius: 4px;
  padding: 32px 24px;
  margin: 0 0 16px;
}

.jp-checkout .jp-co-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 28px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--jp-navy);
}

.jp-co-num {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.4px;
  color: var(--jp-muted);
}

.jp-co-intro {
  margin: -16px 0 24px 32px;
  font-size: 13px;
  color: var(--jp-text);
}

/* ---------- Campos ---------- */
.jp-co-fields {
  display: flex;
  flex-wrap: wrap;
  column-gap: 16px;
}

.jp-checkout .form-row {
  float: none !important;
  width: 100% !important;
  margin: 0 0 18px !important;
  padding: 0 !important;
}

.jp-checkout .jp-co-fields .form-row-first,
.jp-checkout .jp-co-fields .form-row-last {
  width: calc(50% - 8px) !important;
}

.jp-checkout .form-row label:not(.checkbox) {
  display: block;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--jp-navy);
}

.jp-checkout .form-row label .optional {
  font-weight: 400;
  color: var(--jp-muted);
}

.jp-checkout .form-row label abbr.required,
.jp-checkout .form-row label .required {
  display: none;
}

.jp-checkout .form-row input.input-text,
.jp-checkout .form-row textarea,
.jp-checkout .form-row select,
.jp-checkout .select2-container .select2-selection--single {
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--jp-input) !important;
  border-radius: 2px !important;
  background: #fff !important;
  box-shadow: none !important;
  font-size: 13px;
  color: var(--jp-navy);
}

.jp-checkout .form-row textarea {
  height: 110px;
  padding: 12px 14px;
  resize: vertical;
}

.jp-checkout .form-row input.input-text::placeholder,
.jp-checkout .form-row textarea::placeholder {
  color: var(--jp-muted);
}

.jp-checkout .form-row input.input-text:focus,
.jp-checkout .form-row textarea:focus {
  outline: none;
  border-color: var(--jp-blue) !important;
}

.jp-checkout .select2-container .select2-selection--single {
  display: flex;
  align-items: center;
  padding: 0;
}

.jp-checkout .select2-container .select2-selection--single .select2-selection__rendered {
  padding: 0 14px;
  line-height: 44px;
  color: var(--jp-navy);
}

.jp-checkout .select2-container .select2-selection--single .select2-selection__arrow {
  height: 44px;
  right: 8px;
}

.jp-checkout .form-row .description {
  display: block !important;
  position: static !important;
  margin: 8px 0 0 !important;
  padding: 0 !important;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  font-size: 11px !important;
  line-height: 1.4 !important;
  color: var(--jp-muted) !important;
}

.jp-checkout .form-row .description::before {
  display: none !important;
}

.jp-checkout .form-row.woocommerce-invalid input.input-text,
.jp-checkout .form-row.woocommerce-invalid .select2-selection {
  border-color: #d64545 !important;
}

/* ---------- Formas de pago ---------- */
.jp-checkout #payment {
  background: none;
  border-radius: 0;
}

.jp-checkout .jp-pay-methods {
  list-style: none;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jp-checkout .jp-pay-method {
  position: relative;
  margin: 0 !important;
  border: 1px solid var(--jp-input);
  border-radius: 2px;
  background: #fff;
  transition: border-color .2s, background .2s;
}

.jp-checkout .jp-pay-method:has(input:checked) {
  border-color: var(--jp-cta);
  background: #f5fafd;
}

.jp-checkout .jp-pay-method > input.input-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.jp-checkout .jp-pay-label {
  display: flex !important;
  align-items: flex-start;
  gap: 16px;
  margin: 0 !important;
  padding: 20px 16px !important;
  cursor: pointer;
}

.jp-pay-radio {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border: 1px solid #b7c0cb;
  border-radius: 50%;
  background: #fff;
}

.jp-pay-method:has(input:checked) .jp-pay-radio {
  border-color: var(--jp-blue);
  box-shadow: inset 0 0 0 3px #fff;
  background: var(--jp-blue);
}

.jp-pay-text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.jp-pay-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--jp-navy);
}

.jp-pay-desc {
  font-size: 11px;
  font-weight: 400;
  color: var(--jp-text);
}

.jp-pay-badges {
  display: flex;
  gap: 4px;
}

.jp-pay-badges span {
  padding: 4px 7px;
  border: 1px solid var(--jp-input);
  border-radius: 2px;
  background: #fff;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: #6c7684;
}

.jp-checkout #payment .payment_box {
  margin: 0;
  padding: 0 16px 20px 46px;
  background: none;
  font-size: 12px;
  color: var(--jp-text);
}

.jp-checkout #payment .payment_box::before {
  display: none;
}

/* ---------- Consentimientos ---------- */
.jp-co-consents {
  margin-top: 12px;
  padding-top: 24px;
  border-top: 1px solid #e9ebef;
}

.jp-checkout .jp-co-consents .form-row {
  margin: 0 0 12px !important;
}

.jp-checkout .jp-co-consents label.checkbox {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: #3b4652;
  cursor: pointer;
}

.jp-checkout .jp-co-consents input[type="checkbox"] {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  margin: 2px 0 0;
  accent-color: var(--jp-blue);
}

.jp-checkout .jp-co-consents a {
  color: var(--jp-blue);
  text-decoration: none;
}

.jp-checkout .jp-co-consents abbr.required {
  display: inline;
  color: #d64545;
  text-decoration: none;
  border: 0;
}

/* ---------- Botones ---------- */
.jp-co-actions {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0 !important;
}

.jp-checkout .jp-btn-place {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 50px;
  margin: 0 !important;
  padding: 0 22px !important;
  border: 1px solid var(--jp-cta) !important;
  border-radius: 2px !important;
  background: var(--jp-cta) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #fff !important;
  cursor: pointer;
  transition: background .2s;
}

.jp-checkout .jp-btn-place:hover {
  background: #3b93c5 !important;
  border-color: #3b93c5 !important;
}

.jp-btn-back {
  display: inline-flex;
  align-items: center;
  height: 50px;
  padding: 0 18px;
  border: 1px solid var(--jp-input);
  border-radius: 2px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--jp-navy) !important;
  text-decoration: none;
}

.jp-btn-back:hover {
  border-color: #ccd3dc;
  background: #f8fafc;
}

/* ---------- Resumen del pedido ---------- */
.jp-co-summary {
  background: #fff;
  border: 1px solid var(--jp-border);
  border-radius: 4px;
  padding: 28px 20px;
}

.jp-co-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}

.jp-checkout .jp-co-summary-title {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--jp-navy);
}

.jp-co-summary-edit {
  font-size: 11px;
  font-weight: 600;
  color: var(--jp-blue) !important;
  text-decoration: none;
}

.jp-co-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.jp-co-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.jp-co-qty {
  flex: 0 0 30px;
  width: 30px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  background: #e9f4fb;
  font-size: 9px;
  font-weight: 600;
  color: var(--jp-blue);
}

.jp-co-item-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.jp-co-item-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--jp-navy);
}

.jp-co-item-meta {
  font-size: 10px;
  color: #6c7684;
}

.jp-co-item-price {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: #1f2a36;
}

.jp-co-divider {
  height: 1px;
  margin: 20px 0;
  background: #e9ebef;
}

.jp-co-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  font-size: 12px;
  color: var(--jp-text);
}

.jp-co-row strong {
  font-weight: 600;
  color: #1f2a36;
}

.jp-co-muted {
  color: #6c7684;
}

.jp-co-row.jp-co-total {
  margin-top: 36px;
}

.jp-co-total > span {
  font-size: 12px;
  font-weight: 700;
  color: var(--jp-navy);
}

.jp-co-total strong,
.jp-co-total strong .woocommerce-Price-amount {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--jp-navy);
}

.jp-co-total small {
  display: none;
}

/* ---------- Bloque de confianza ---------- */
.jp-co-trust {
  list-style: none;
  margin: 12px 0 0;
  padding: 18px 16px;
  border: 1px solid var(--jp-border);
  border-radius: 4px;
  background: #f1f4f7;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.jp-co-trust li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  color: #3b4652;
}

.jp-co-help {
  margin: 18px 0 0;
  padding: 0 4px;
  font-size: 10px;
  line-height: 1.7;
  color: var(--jp-muted);
}

.jp-co-help a {
  color: var(--jp-blue);
  text-decoration: none;
}

/* ---------- Avisos de error de WooCommerce ---------- */
.woocommerce-checkout .woocommerce-NoticeGroup-checkout,
.woocommerce-checkout .woocommerce-error {
  max-width: 1130px;
  margin-left: auto;
  margin-right: auto;
}

/* ========================================================
   RESPONSIVE
   ======================================================== */
@media (max-width: 960px) {
  .jp-checkout-grid {
    flex-direction: column;
  }
  .jp-checkout-main,
  .jp-checkout-side {
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    position: static;
  }
  .jp-checkout-side {
    order: -1;
  }
}

@media (max-width: 600px) {
  .jp-checkout {
    padding: 24px 0;
  }
  .jp-co-section {
    padding: 24px 16px;
  }
  .jp-checkout .jp-co-fields .form-row-first,
  .jp-checkout .jp-co-fields .form-row-last {
    width: 100% !important;
  }
  .jp-co-intro {
    margin-left: 0;
  }
  .jp-pay-badges {
    display: none;
  }
  .jp-co-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .jp-checkout .jp-btn-place,
  .jp-btn-back {
    width: 100%;
    justify-content: center;
  }
}
