/* Redsys TPV - réplica interfaz */
body.redsys-active {
  overflow: auto;
  background: #f0f0f0 !important;
}

body.redsys-active #header,
body.redsys-active .breadcrumbsSection,
body.redsys-active .Steps,
body.redsys-active .sectonInfoFooter,
body.redsys-active .footerSection,
body.redsys-active .whatsapp,
body.redsys-active .listadoSection,
body.redsys-active #ModalAlertaAntesPago {
  display: none !important;
}

body.redsys-active .mainInterior {
  display: none !important;
}

body.redsys-active #redsys-gateway {
  display: block !important;
}

/* Redirect overlay */
.redsys-redirect-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-family: Arial, Helvetica, sans-serif;
}

.redsys-redirect-overlay.active {
  display: flex;
}

.redsys-redirect-overlay p {
  margin-top: 20px;
  color: #555;
  font-size: 15px;
}

.redsys-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #e0e0e0;
  border-top-color: #0066b3;
  border-radius: 50%;
  animation: redsys-spin 0.8s linear infinite;
}

@keyframes redsys-spin {
  to { transform: rotate(360deg); }
}

/* Gateway shell */
.redsys-gateway {
  display: none;
  font-family: Arial, Helvetica, sans-serif;
  color: #333;
  background: #f0f0f0;
  min-height: 100vh;
  padding: 20px 16px 36px;
  box-sizing: border-box;
}

.redsys-gateway.active {
  display: block;
}

.redsys-page {
  max-width: 960px;
  margin: 0 auto;
}

.redsys-header {
  text-align: center;
  margin-bottom: 24px;
  padding-top: 4px;
}

.redsys-gateway * {
  font-family: Roboto, Arial, Helvetica, sans-serif !important;
}

.redsys-gateway img {
  border: 0;
  max-height: 40px;
  -ms-interpolation-mode: bicubic;
}

.logoEntidad {
  text-align: center;
}

.logoEntidad img {
  width: 191px;
  height: auto;
  max-width: 100%;
  max-height: none;
  display: inline-block;
}

@media (max-width: 400px) {
  .logoEntidad img {
    max-width: 185px;
    width: 100%;
  }
}

/* Main layout: móvil = tarjeta arriba, operación abajo */
.redsys-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

.redsys-panel {
  background: #fff;
  border: 1px solid #d5d5d5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  width: 100%;
}

/* --- Pagar con Tarjeta --- */
.redsys-panel-card {
  order: 1;
}

.redsys-card-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #f3f3f3;
  border-bottom: 1px solid #e0e0e0;
  gap: 8px;
  flex-wrap: wrap;
}

.redsys-card-header h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: #222;
  flex: 0 0 auto;
}

.redsys-card-brands {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.redsys-card-brands img {
  height: 20px;
  width: auto;
}

.redsys-card-brands .bnpl {
  height: 18px;
}

.redsys-collapse-icon {
  width: 13px;
  height: auto;
  opacity: 0.55;
  flex-shrink: 0;
}

.redsys-card-body {
  padding: 16px;
}

.redsys-field {
  position: relative;
  margin-bottom: 12px;
}

.redsys-field-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: auto;
  pointer-events: none;
  opacity: 0.5;
}

.redsys-field-brand {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: auto;
  pointer-events: none;
}

.redsys-field-brand[hidden] {
  display: none;
}

.redsys-field-card.has-brand input {
  padding-right: 52px;
}

.redsys-field-card.has-brand.has-valid input {
  padding-right: 78px;
}

.redsys-field-card.has-valid .redsys-field-brand {
  right: 36px;
}

.redsys-field-valid {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.redsys-field-valid[hidden] {
  display: none;
}

.redsys-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #c8c8c8;
  border-radius: 3px;
  padding: 11px 40px 11px 40px;
  font-size: 14px;
  font-family: Arial, Helvetica, sans-serif;
  color: #333;
  background: #fff;
  outline: none;
  height: 44px;
}

.redsys-field-card input {
  padding-right: 44px;
}

.redsys-field input:focus {
  border-color: #7eb8e0;
  box-shadow: 0 0 0 1px #7eb8e0;
}

.redsys-field.is-invalid input {
  border-color: #dc2626;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.35);
}

.redsys-field-error {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #dc2626;
}

.redsys-field input::placeholder {
  color: #aaa;
}

.redsys-field-row {
  display: flex;
  gap: 10px;
}

.redsys-field-row .redsys-field {
  flex: 1;
  margin-bottom: 12px;
}

.redsys-remember {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0 10px;
  font-size: 12px;
  color: #444;
  line-height: 1.45;
  cursor: pointer;
}

.redsys-remember input {
  margin-top: 2px;
  flex-shrink: 0;
}

.redsys-disclaimer {
  font-size: 11px;
  color: #888;
  line-height: 1.5;
  margin: 0 0 16px;
}

.redsys-disclaimer a {
  color: #0066b3;
  text-decoration: none;
}

.redsys-disclaimer a:hover {
  text-decoration: underline;
}

.redsys-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.redsys-btn {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 32px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid transparent;
  min-width: 120px;
}

.redsys-btn-cancel {
  background: #fff;
  border-color: #ccc;
  color: #555;
}

.redsys-btn-cancel:hover {
  background: #fafafa;
}

.redsys-btn-pay {
  background: #d4d4d4;
  color: #888;
  border-color: #d4d4d4;
  cursor: not-allowed;
}

.redsys-btn-pay.enabled {
  background: #0066b3;
  border-color: #0066b3;
  color: #fff;
  cursor: pointer;
}

.redsys-btn-pay.enabled:hover {
  background: #005299;
}

/* --- Datos de la operación --- */
.redsys-panel-operation {
  order: 2;
}

.redsys-panel-operation h2 {
  font-size: 15px;
  font-weight: 700;
  color: #444;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid #e8e8e8;
  text-align: center;
}

.redsys-op-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid #efefef;
  font-size: 13px;
  gap: 16px;
}

.redsys-op-row:last-child {
  border-bottom: none;
}

.redsys-op-row .label {
  color: #333;
  font-weight: 700;
  flex-shrink: 0;
}

.redsys-op-row .value {
  color: #666;
  text-align: right;
  font-style: italic;
}

.redsys-op-amount {
  padding: 14px 16px;
}

.redsys-op-amount .label {
  color: #0066b3;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.redsys-op-amount .amount {
  font-size: 22px;
  font-weight: 700;
  color: #111;
  font-style: normal;
}

/* Footer */
.redsys-footer {
  margin-top: 32px;
  text-align: center;
}

.redsys-security-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.redsys-security-logos img {
  height: 34px;
  width: auto;
}

.redsys-powered {
  margin-bottom: 10px;
}

.redsys-powered img {
  height: 30px;
  width: auto;
}

.redsys-copyright {
  font-size: 11px;
  color: #888;
  margin: 0;
}

.redsys-copyright a {
  color: #0066b3;
  text-decoration: none;
}

.redsys-copyright a:hover {
  text-decoration: underline;
}

/* Escritorio: operación izquierda, tarjeta derecha */
@media (min-width: 769px) {
  .redsys-gateway {
    padding: 28px 20px 40px;
  }

  .redsys-main {
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 20px;
  }

  .redsys-panel-card {
    flex: 1 1 0;
    min-width: 0;
    order: 1;
  }

  .redsys-panel-operation {
    flex: 0 0 320px;
    order: 2;
  }

  .redsys-card-body {
    padding: 18px 20px 20px;
  }
}

/* Móvil estrecho */
@media (max-width: 480px) {
  .redsys-gateway {
    padding: 14px 10px 28px;
  }

  .redsys-card-header {
    padding: 10px 12px;
  }

  .redsys-card-header h2 {
    font-size: 14px;
    width: 100%;
    margin-bottom: 4px;
  }

  .redsys-card-brands {
    justify-content: flex-start;
  }

  .redsys-card-brands img {
    height: 18px;
  }

  .redsys-card-body {
    padding: 14px 12px;
  }

  .redsys-field-row {
    gap: 8px;
  }

  .redsys-btn {
    flex: 1 1 45%;
    min-width: 0;
    padding: 10px 16px;
  }

  .redsys-op-amount .amount {
    font-size: 20px;
  }
}
