/* ==========================================================================
   Add Balance Stripe - Estilos v2
   ========================================================================== */

/* Botón principal */
.abs-open-popup {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.abs-open-popup:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

/* Modal */
.abs-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.abs-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: absModalFadeIn 0.3s ease;
}

@keyframes absModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Contenido del modal */
.abs-modal-content {
    background: #ffffff;
    padding: 32px;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: absModalSlideIn 0.3s ease;
}

@keyframes absModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Botón cerrar */
.abs-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    font-weight: 300;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.abs-close:hover {
    color: #374151;
}

/* Pasos */
.abs-step {
    display: none;
}

.abs-step.active {
    display: block;
    animation: absStepFadeIn 0.3s ease;
}

@keyframes absStepFadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Título del modal */
.abs-modal-title {
    margin: 0 0 24px 0;
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    text-align: center;
}

/* Wrapper del formulario */
.abs-form-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Grupo de input */
.abs-input-group {
    display: flex;
    align-items: center;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.abs-input-group:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Símbolo de moneda */
.abs-currency {
    padding: 16px;
    font-size: 18px;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
}

/* Input de cantidad */
.abs-amount-input {
    flex: 1;
    padding: 16px;
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
}

.abs-amount-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
    font-size: 16px;
}

.abs-amount-input::-webkit-outer-spin-button,
.abs-amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.abs-amount-input[type=number] {
    -moz-appearance: textfield;
}

/* Display de cantidad en paso de pago */
.abs-amount-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    margin-bottom: 8px;
}

.abs-amount-label {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.abs-amount-value {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
}

/* Stripe Card Element */
#abs-card-element {
    padding: 16px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#abs-card-element.StripeElement--focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

#abs-card-element.StripeElement--invalid {
    border-color: #ef4444;
}

/* Mensaje de error */
.abs-error-message {
    margin: 0;
    padding: 10px 14px;
    font-size: 14px;
    color: #dc2626;
    background: #fef2f2;
    border-radius: 8px;
    display: none;
}

.abs-error-message.visible {
    display: block;
}

/* Botón de enviar */
.abs-submit-button {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.abs-submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.abs-submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.abs-submit-button.loading {
    position: relative;
    color: transparent;
}

.abs-submit-button.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: absSpinner 0.8s linear infinite;
}

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

/* Botón volver */
.abs-back-button {
    width: 100%;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.abs-back-button:hover {
    color: #374151;
}

/* Paso de éxito */
.abs-step-success {
    text-align: center;
    padding: 20px 0;
}

.abs-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: absSuccessPop 0.5s ease;
}

@keyframes absSuccessPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.abs-success-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.abs-success-title {
    color: #059669;
    margin-bottom: 12px;
}

.abs-success-message {
    color: #6b7280;
    font-size: 15px;
    margin: 0 0 24px 0;
}

/* Mensaje de error general */
.abs-error {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 480px) {
    .abs-modal-content {
        padding: 24px;
        margin: 16px;
        width: calc(100% - 32px);
    }
    
    .abs-amount-input {
        font-size: 20px;
        padding: 14px;
    }
    
    .abs-currency {
        padding: 14px;
        font-size: 16px;
    }
    
    .abs-amount-value {
        font-size: 20px;
    }
}
