/* ==========================================
   STRIPE CHECKOUT UX - METAVERSE EDITION
   Estilos premium con glassmorphism y efectos holográficos
   ========================================== */

/* ==========================================
   CSS VARIABLES - METAVERSE THEME
   ========================================== */
:root {
    --gradient-gold: linear-gradient(135deg, #FFD700, #FFA500);
    --gradient-purple: linear-gradient(135deg, #8b5cf6, #9d6bff);
    --gradient-mixed: linear-gradient(135deg, #FFD700 0%, #9d6bff 50%, #FFD700 100%);
    --glow-gold: rgba(255, 215, 0, 0.45);
    --glow-purple: rgba(139, 92, 246, 0.35);
    --shadow-deep: 0 20px 60px rgba(0, 0, 0, 0.7);
}

/* ==========================================
   1. STICKY FOOTER - GLASSMORPHISM PREMIUM
   ========================================== */
.checkout-sticky-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    
    background: rgba(18, 18, 38, 0.82);
    backdrop-filter: blur(28px) saturate(150%);
    -webkit-backdrop-filter: blur(28px) saturate(150%);
    
    border-top: 1.5px solid rgba(255, 215, 0, 0.28);
    box-shadow: 
        0 -12px 45px rgba(0, 0, 0, 0.55),
        0 0 40px rgba(139, 92, 246, 0.25);
    
    padding: 1.2rem 1.5rem;
    margin-top: 1.5rem;
    
    animation: slideUpCinematic 0.45s ease-out forwards;
}

/* ==========================================
   2. BOTÓN PAGAR - GRADIENTE ANIMADO
   ========================================== */
.checkout-pay-btn {
    width: 100%;
    position: relative;
    overflow: hidden;
    
    background: linear-gradient(135deg, #FFD700 0%, #9d6bff 50%, #FFD700 100%);
    background-size: 220% 220%;
    
    color: #1b1432;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 1.05rem 2.6rem;
    min-height: 48px; /* Touch target base desktop */
    border-radius: 18px;
    border: none;
    
    box-shadow: 
        0 18px 55px rgba(255, 215, 0, 0.45),
        0 0 65px rgba(157, 107, 255, 0.35);
    
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    
    animation: 
        gradientShift 4s ease infinite,
        fadeInUp 0.45s ease-out,
        pulse 2.8s ease-in-out 0.45s infinite;
    
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.checkout-pay-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 
        0 22px 65px rgba(255, 215, 0, 0.55),
        0 0 75px rgba(157, 107, 255, 0.45);
}

.checkout-pay-btn:active {
    transform: translateY(-1px) scale(1.01);
}

.checkout-pay-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Shimmer effect al hover */
.checkout-pay-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.9s ease;
}

.checkout-pay-btn:hover::before {
    left: 120%;
}

/* ==========================================
   3. BOTÓN CANCELAR - DISCRETO
   ========================================== */
.checkout-cancel-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 215, 0, 0.18);
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.85rem 1.6rem;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    
    margin-top: 0.8rem;
}

.checkout-cancel-btn:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.3);
    color: rgba(255, 255, 255, 0.85);
    transform: translateY(-2px);
}

.checkout-cancel-btn:active {
    transform: translateY(0);
}

/* ==========================================
   4. PACKAGE CARDS - FEEDBACK MEJORADO
   ========================================== */
.stripe-package-card {
    position: relative;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.stripe-package-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.2);
}

/* Display de cantidad de SPS */
.package-sps-amount {
    font-size: 0.95rem;
    font-weight: 700;
    color: #8b5cf6;
    margin: 0.4rem 0;
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    animation: fadeInUp 0.5s ease-out 0.2s both;
}

/* Estado SELECTED con efectos holográficos */
.stripe-package-card.selected {
    transform: scale(1.05);
    box-shadow: 
        0 16px 50px rgba(139, 92, 246, 0.35),
        0 0 55px rgba(255, 215, 0, 0.28);
    
    /* Border animado con gradiente */
    border: 2px solid transparent;
    background-image: 
        linear-gradient(rgba(26, 26, 46, 0.95), rgba(26, 26, 46, 0.95)),
        linear-gradient(120deg, #FFD700, #8b5cf6, #FFD700);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    background-size: 100% 100%, 200% 100%;
    
    animation: borderFlow 2.8s linear infinite;
}

/* Checkmark holográfico */
.stripe-package-card.selected::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    
    width: 32px;
    height: 32px;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    font-size: 18px;
    font-weight: 900;
    color: #FFD700;
    
    background: radial-gradient(circle, rgba(255, 215, 0, 0.75) 0%, rgba(139, 92, 246, 0.3) 50%, transparent 70%);
    border-radius: 50%;
    
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 40px rgba(139, 92, 246, 0.4);
    
    animation: 
        iconFloat 3s ease-in-out infinite,
        checkmarkPulse 1.5s ease-in-out infinite;
}

/* ==========================================
   5. SELECTED PACKAGE INFO - UX ENHANCEMENTS
   (Base layout styles en stripe-packages.css)
   ========================================== */
/* Additional visual enhancements for selected package info */
.stripe-package-selected-info {
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.4s ease-out;
}

.selected-icon {
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.5));
    animation: iconFloat 3s ease-in-out infinite;
}

.selected-amounts {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

#selectedUSD {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.selected-sps-display {
    font-size: 1.05rem;
    font-weight: 700;
    color: #8b5cf6;
    margin-left: 0.6rem;
    padding-left: 0.6rem;
    border-left: 2px solid rgba(139, 92, 246, 0.3);
    display: inline-block;
    animation: fadeInUp 0.4s ease-out;
}

/* ==========================================
   6. ANIMACIONES - METAVERSE KEYFRAMES
   ========================================== */
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes pulse {
    0%, 100% { 
        box-shadow: 
            0 18px 55px rgba(255, 215, 0, 0.45),
            0 0 0 0 rgba(255, 215, 0, 0.45);
    }
    50% { 
        box-shadow: 
            0 18px 55px rgba(255, 215, 0, 0.45),
            0 0 28px 0 rgba(255, 215, 0, 0);
    }
}

@keyframes borderFlow {
    0% { background-position: 100% 100%, 0% 0%; }
    100% { background-position: 100% 100%, 200% 0%; }
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-3px) rotate(-2deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-3px) rotate(2deg); }
}

@keyframes checkmarkPulse {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
    }
    50% { 
        transform: scale(1.1);
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.9));
    }
}

@keyframes slideUpCinematic {
    0% {
        transform: translateY(50px) scale(0.95);
        opacity: 0;
        filter: blur(10px);
    }
    50% {
        transform: translateY(-10px) scale(1.01);
        opacity: 0.8;
        filter: blur(0);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

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

/* ==========================================
   7. RESPONSIVE - MOBILE OPTIMIZATIONS
   ========================================== */

/* FASE 1 - OPTIMIZACIONES CRÍTICAS MÓVIL (<640px) */
@media screen and (max-width: 640px) {
    /* Grid forzado a 1 columna para móviles */
    .stripe-packages-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 0 0.5rem !important;
    }
    
    /* Touch targets seguros - Cards */
    .stripe-package-card {
        min-height: 220px !important;
        padding: 1.25rem 1rem !important;
    }
    
    /* JERARQUÍA TIPOGRÁFICA MÓVIL */
    /* USD es el PROTAGONISTA */
    .package-usd-amount {
        font-size: 1.75rem !important; /* 28px */
        font-weight: 800 !important;
        margin: 0.3rem 0 !important;
    }
    
    /* SPS es secundario pero LEGIBLE */
    .package-sps-amount {
        font-size: 1rem !important; /* 16px - mínimo accesible */
        font-weight: 700 !important;
        margin: 0.4rem 0 !important;
    }
    
    /* Nombre del paquete */
    .package-name {
        font-size: 1.125rem !important; /* 18px */
        font-weight: 600 !important;
        margin-bottom: 0.3rem !important;
    }
    
    /* Descripción sutil */
    .package-description {
        font-size: 0.875rem !important; /* 14px */
        opacity: 0.7 !important;
    }
    
    /* Icono del paquete */
    .package-icon {
        font-size: 2.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Sticky Footer con Safe Areas */
    .checkout-sticky-footer {
        padding: 1.25rem 1rem !important;
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)) !important;
        min-height: 88px !important;
        border-radius: 24px 24px 0 0 !important;
    }
    
    /* Touch target seguro - Botón de pago WCAG COMPLIANT */
    .checkout-pay-btn {
        font-size: 1.125rem !important; /* 18px - MANDATORIO */
        padding: 1rem 2.5rem !important;
        min-height: 52px !important; /* WCAG touch target - MANDATORIO */
        font-weight: 700 !important;
        line-height: 1.4 !important;
    }
    
    .checkout-cancel-btn {
        font-size: 0.95rem !important;
        padding: 0.85rem 1.5rem !important;
        min-height: 44px !important;
    }
    
    /* FASE 2 - Selected Package Info Vertical */
    .stripe-package-selected-info {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: flex-start !important;
        padding: 1rem !important;
    }
    
    .selected-package-details {
        width: 100% !important;
    }
    
    .selected-icon {
        font-size: 2rem !important;
    }
    
    .selected-name {
        font-size: 1.125rem !important;
        font-weight: 600 !important;
    }
    
    #selectedUSD {
        font-size: 1.375rem !important; /* 22px */
        font-weight: 800 !important;
    }
    
    .selected-sps-display {
        font-size: 1rem !important;
        margin-left: 0.5rem !important;
        padding-left: 0.5rem !important;
        font-weight: 600 !important;
    }
    
    /* Spacing optimizado */
    .packages-section {
        padding: 0.75rem !important;
        margin-top: 1rem !important;
    }
    
    .packages-title {
        font-size: 1.125rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Estado seleccionado con transformación suave */
    .stripe-package-card.selected {
        transform: scale(1.02) !important;
        border-width: 3px !important;
    }
    
    /* Optimizaciones de animación para móvil */
    .stripe-package-card {
        transition: all 0.2s ease !important;
    }
    
    .stripe-package-card:active {
        transform: scale(0.97) !important;
    }
}

/* Breakpoint intermedio tablet (641px - 767px) */
@media screen and (min-width: 641px) and (max-width: 767px) {
    .stripe-packages-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    .checkout-sticky-footer {
        padding: 1rem;
        border-radius: 20px 20px 0 0;
    }
    
    .checkout-pay-btn {
        font-size: 1rem;
        padding: 1rem 2rem;
    }
}

/* ==========================================
   8. LOADING STATE - SPINNER ANIMADO
   ========================================== */
.checkout-pay-btn .creditcard-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(27, 20, 50, 0.3);
    border-top-color: #1b1432;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================
   9. ACCESSIBILITY & FOCUS STATES
   ========================================== */
.checkout-pay-btn:focus,
.checkout-cancel-btn:focus,
.stripe-package-card:focus {
    outline: 2px solid rgba(255, 215, 0, 0.6);
    outline-offset: 3px;
}

/* ==========================================
   10. DARK MODE OPTIMIZATIONS
   ========================================== */
@media (prefers-color-scheme: dark) {
    .checkout-sticky-footer {
        background: rgba(15, 15, 30, 0.88);
    }
}
