/**
 * Estilos para Panel de Pagos Pendientes
 * Módulo independiente para manejo de saldos pendientes
 * 
 * @package XTravel
 * @subpackage Confirmacion
 */

/* ============================================
   BOTÓN PAGAR SALDO PENDIENTE
   ============================================ */

.x-btn-pay-pending,
#x-confirmacion .x-btn-pay-pending,
button#btn-toggle-payment-methods {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.938rem;
  color: #ffffff !important;
  background: linear-gradient(90deg, #2563eb 0%, #1d4ed8 100%);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(15,23,42,0.18);
  transition: all 0.2s ease;
  border: none;
  position: relative;
  cursor: pointer;
}

.x-btn-pay-pending:hover,
#x-confirmacion .x-btn-pay-pending:hover,
button#btn-toggle-payment-methods:hover {
  background: linear-gradient(90deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 4px 10px rgba(15,23,42,0.25);
  transform: translateY(-1px);
  cursor: pointer;
}

#x-confirmacion .x-btn-pay-pending .x-amount {
  color: #dbeafe !important;
  font-weight: 600;
}

#x-confirmacion .x-btn-pay-pending svg {
  flex-shrink: 0;
}

/* Chevron icon rotation */
.x-btn-pay-pending .x-chevron {
  transition: transform 0.3s ease;
  margin-left: 0.5rem;
}

.x-btn-pay-pending.active .x-chevron {
  transform: rotate(180deg);
}

/* ============================================
   PANEL DE MÉTODOS DE PAGO (Deslizable)
   ============================================ */

.x-payment-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
  opacity: 0;
  margin-top: 0;
}

.x-payment-panel.show {
  max-height: none; /* Altura dinámica según contenido */
  height: auto; /* Se adapta al tamaño del contenido */
  opacity: 1;
  margin-top: 1rem;
  overflow: visible;
}

.x-payment-panel:not(.hidden) {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ============================================
   ESTADO DE CARGA
   ============================================ */

.x-payment-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

.x-payment-loading-state p {
  margin-top: 1rem;
  color: #6b7280;
  font-size: 0.875rem;
}

.x-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   RESUMEN DE PAGO
   ============================================ */

.x-payment-summary {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid #bfdbfe;
}

.x-payment-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.x-payment-summary-label {
  font-size: 0.813rem;
  font-weight: 600;
  color: #1e3a8a;
}

.x-payment-summary-amount {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1d4ed8;
}

/* ============================================
   SELECTOR DE PORCENTAJE
   ============================================ */

.x-percentage-selector {
  margin-bottom: 1rem;
}

.x-percentage-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.x-percentage-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.x-percentage-btn {
  padding: 0.625rem 0.75rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.x-percentage-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.x-percentage-btn.active {
  border-color: #2563eb;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.x-percentage-value {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
  color: #1f2937;
}

.x-percentage-btn.active .x-percentage-value {
  color: #1e40af;
}

.x-percentage-amount {
  display: block;
  font-size: 0.688rem;
  color: #6b7280;
  margin-top: 0.125rem;
}

.x-percentage-btn.active .x-percentage-amount {
  color: #1d4ed8;
  font-weight: 600;
}

/* ============================================
   LISTA DE OPCIONES DE PAGO
   ============================================ */

.x-payment-options-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* ============================================
   TARJETAS DE MÉTODOS DE PAGO (Compactas)
   ============================================ */

.x-payment-option {
  border: 2px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
  text-align: center;
}

.x-payment-option:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
  transform: translateY(-1px);
}

.x-payment-option.selected {
  border-color: #2563eb;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.x-payment-option-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.x-payment-option-icon {
  width: 20px;
  height: 20px;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
}

.x-payment-option.selected .x-payment-option-icon {
  background: #dbeafe;
}

.x-payment-option-title {
  font-weight: 700;
  font-size: 0.75rem;
  color: #111827;
  line-height: 1.2;
}

.x-payment-option-description {
  font-size: 0.625rem;
  color: #6b7280;
  margin-top: 0.125rem;
}

.x-payment-option-details {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e5e7eb;
}

.x-payment-option.selected .x-payment-option-details {
  border-top-color: #bfdbfe;
}

.x-payment-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.688rem;
  padding: 0.125rem 0;
}

.x-payment-detail-label {
  color: #6b7280;
}

.x-payment-detail-value {
  font-weight: 600;
  color: #111827;
}

.x-payment-detail-value.total {
  font-size: 0.813rem;
  color: #2563eb;
}

.x-payment-option-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.188rem;
  background: #dcfce7;
  color: #166534;
  font-size: 0.563rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border-radius: 9999px;
  margin-top: 0.375rem;
}

/* Radio button custom */
.x-payment-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.x-payment-radio-indicator {
  width: 16px;
  height: 16px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: #ffffff;
  transition: all 0.2s ease;
  position: relative;
  margin: 0 auto;
  margin-top: 0.375rem;
}

.x-payment-option.selected .x-payment-radio-indicator {
  border-color: #2563eb;
  background: #2563eb;
}

.x-payment-option.selected .x-payment-radio-indicator::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 5px;
  height: 5px;
  background: #ffffff;
  border-radius: 50%;
}

/* ============================================
   BOTÓN CONTINUAR
   ============================================ */

.x-btn-continue-payment {
  width: 100%;
  padding: 0.75rem 1.5rem;
  font-size: 0.938rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.x-btn-continue-payment:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.x-btn-continue-payment:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   CONTENEDOR FORMULARIOS INLINE
   ============================================ */

.x-payment-form-container {
  margin-top: 1rem;
  padding: 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  display: none;
  max-height: none; /* Permitir crecimiento ilimitado */
  overflow: visible; /* Evitar que se corte el contenido */
}

.x-payment-form-container.show {
  display: block;
  animation: slideDown 0.3s ease;
  overflow: visible; /* Mantener visible durante animación */
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.x-payment-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.x-payment-form-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

.x-payment-form-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: #6b7280;
  transition: color 0.2s;
}

.x-payment-form-close:hover {
  color: #1f2937;
}

.x-payment-form-body {
  min-height: 200px;
  max-height: none; /* Permitir crecimiento ilimitado */
  overflow: visible; /* Evitar que se corte el contenido */
  position: relative;
  z-index: 10; /* Asegurar que quede por encima de otras capas internas */
}

/* Asegurar que los iframes de PayPal e Izipay crezcan correctamente */
.x-payment-form-body iframe,
.x-payment-form-body #paypal-button-container,
.x-payment-form-body #tarjeta-container,
.x-payment-form-body #izipay-container {
  width: 100% !important;
  min-height: 300px;
  position: relative;
  z-index: 20;
  pointer-events: auto;
}

/* Contenedor de formulario Izipay */
.x-payment-form-body .izipay-form-wrapper {
  width: 100%;
  min-height: 400px;
}

.x-payment-form-body #izipay-form-container,
.x-payment-form-body .kr-embedded {
  min-height: 350px;
  pointer-events: auto;
}

/* ============================================
   ESTADO DE ERROR
   ============================================ */

.x-payment-error-state {
  text-align: center;
  padding: 2rem 0;
}

.x-payment-error-icon {
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
}

.x-payment-error-state p {
  color: #6b7280;
  font-size: 0.875rem;
}

/* ============================================
   DISEÑO RESPONSIVO
   ============================================ */

@media (max-width: 640px) {
  .x-payment-panel:not(.hidden) {
    padding: 1rem;
  }

  .x-percentage-buttons {
    gap: 0.375rem;
  }

  .x-percentage-btn {
    padding: 0.5rem 0.625rem;
  }

  .x-percentage-value {
    font-size: 1rem;
  }

  .x-payment-options-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.375rem;
  }

  .x-payment-option {
    padding: 0.375rem;
  }

  .x-payment-option-icon {
    width: 18px;
    height: 18px;
  }

  .x-payment-option-title {
    font-size: 0.688rem;
  }

  .x-payment-detail-row {
    font-size: 0.625rem;
  }

  .x-payment-form-container {
    padding: 0.75rem;
  }
}

@media (max-width: 480px) {
  .x-payment-options-list {
    grid-template-columns: 1fr;
  }

  .x-btn-continue-payment {
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
  }
}

/* ============================================
   OVERLAY DE ÉXITO - PAGOS (GENÉRICO)
   ============================================ */

#payment-success-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-in;
}

.payment-success-card {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  color: white;
  animation: slideUp 0.4s ease-out;
  position: relative;
}

.payment-success-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.payment-success-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.payment-success-close svg {
  width: 20px;
  height: 20px;
  stroke: white;
}

.payment-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: block;
}

.payment-success-title {
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
}

.payment-success-subtitle {
  text-align: center;
  opacity: 0.9;
  margin-bottom: 24px;
  font-size: 14px;
}

.payment-success-details {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 20px;
  backdrop-filter: blur(10px);
}

.payment-success-row {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.payment-success-row:last-child {
  border-bottom: none;
  padding-top: 8px;
  padding-bottom: 0;
}

.payment-success-row + .payment-success-row {
  margin-top: 12px;
}

.payment-success-label {
  opacity: 0.9;
  font-size: 13px;
}

.payment-success-value {
  font-weight: 600;
  font-size: 13px;
  font-family: monospace;
}

.payment-success-row.total .payment-success-label {
  font-size: 15px;
  font-weight: 600;
}

.payment-success-row.total .payment-success-value {
  font-size: 18px;
  font-weight: 700;
}

.payment-success-pending {
  display: flex;
  justify-content: space-between;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.payment-success-pending .payment-success-label {
  font-size: 13px;
  opacity: 0.9;
}

.payment-success-pending .payment-success-value {
  font-size: 14px;
  font-weight: 600;
}

.payment-success-complete {
  text-align: center;
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.payment-success-complete span {
  font-size: 14px;
  font-weight: 600;
}

.payment-success-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  opacity: 0.8;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .payment-success-card {
    padding: 24px;
    width: 95%;
  }

  .payment-success-title {
    font-size: 20px;
  }

  .payment-success-subtitle {
    font-size: 13px;
  }

  .payment-success-details {
    padding: 16px;
  }

  .payment-success-row {
    font-size: 12px;
  }

  .payment-success-value {
    font-size: 12px !important;
  }

  .payment-success-row.total .payment-success-value {
    font-size: 16px !important;
  }
}

/* ==========================================
   FORMULARIO DE TRANSFERENCIA BANCARIA
   ========================================== */
.x-transfer-form {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.x-transfer-summary {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}

.x-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  color: #0f172a;
}

.x-summary-row strong {
  font-size: 18px;
  font-weight: 700;
  color: #0369a1;
}

.x-summary-note {
  font-size: 13px;
  color: #059669;
  font-weight: 500;
  margin-top: 4px;
}

.x-transfer-fields {
  margin-bottom: 24px;
}

.x-form-group {
  margin-bottom: 20px;
}

.x-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.x-form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #1e293b;
  transition: all 0.2s ease;
  font-family: inherit;
}

.x-form-control:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.x-form-control::placeholder {
  color: #9ca3af;
}

.x-help-text {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
}

/* Detalles del banco */
.x-bank-details {
  margin: 16px 0;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  animation: fadeIn 0.3s ease;
}

.xtr-bank-details {
  width: 100%;
}

.xtr-bank-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

.xtr-bank-account {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  font-size: 13px;
  gap: 12px;
}

.xtr-account-label {
  font-weight: 600;
  color: #64748b;
  min-width: 100px;
}

.xtr-account-value {
  font-family: 'Courier New', monospace;
  color: #1e293b;
  font-weight: 500;
  text-align: right;
  flex: 1;
  word-break: break-word;
}

/* Botón de transferencia */
.x-btn-primary {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.x-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.x-btn-primary:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
}

.x-spinner-small {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 640px) {
  .x-transfer-summary {
    padding: 12px;
  }

  .x-summary-row {
    font-size: 13px;
  }

  .x-summary-row strong {
    font-size: 16px;
  }

  .x-form-group label {
    font-size: 13px;
  }

  .x-form-control {
    font-size: 13px;
    padding: 9px 10px;
  }

  .x-btn-primary {
    font-size: 15px;
    padding: 12px 16px;
  }

  .xtr-bank-name {
    font-size: 13px;
  }

  .xtr-bank-account {
    font-size: 12px;
    flex-direction: column;
    gap: 4px;
  }

  .xtr-account-label {
    min-width: auto;
  }

  .xtr-account-value {
    text-align: left;
  }
}
