/* ============================================
   CHECKOUT V2 - ULTRA OTIMIZADO
   Prioridade: Performance > Estética
   Mobile-first, zero jank, 60fps garantido
   ============================================ */

/* === VARIÁVEIS === */
:root {
    /* Cores (mesmo tema da página principal) */
    --primary: #8B5CF6;
    --primary-dark: #6D28D9;
    --primary-light: #A78BFA;
    --secondary: #3B82F6;
    --accent: #EC4899;
    --neon-purple: #A855F7;
    --green-accent: #10B981;
    --green-light: #34D399;
    
    /* Backgrounds */
    --bg-dark: #0A0118;
    --bg-darker: #050012;
    --bg-card: rgba(139, 92, 246, 0.08);
    
    /* Textos */
    --text-primary: #FFFFFF;
    --text-secondary: #C4B5FD;
    --text-muted: #9CA3AF;
    
    /* Glass effect LEVE (sem blur) */
    --glass-bg: rgba(139, 92, 246, 0.1);
    --glass-border: rgba(167, 139, 250, 0.2);
    
    /* Fontes */
    --font-display: 'Quicksand', sans-serif;
    --font-body: 'Poppins', sans-serif;
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-darker);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === BACKGROUND GRADIENTE ESTÁTICO (SEM ANIMAÇÃO PESADA) === */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, 
        var(--bg-darker) 0%, 
        var(--bg-dark) 25%,
        #1a0b2e 50%,
        var(--bg-dark) 75%,
        var(--bg-darker) 100%
    );
    /* Apenas GPU acceleration, sem animação custosa */
    transform: translateZ(0);
    will-change: auto;
}

/* === LAYOUT PRINCIPAL === */
.checkout-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.checkout-container {
    width: 100%;
    max-width: 500px;
    /* Animação de entrada simples */
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === HEADER === */
.checkout-header {
    text-align: center;
    margin-bottom: 32px;
}

.title-gradient {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* === FORMULÁRIO === */
.checkout-form {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 32px 24px;
    /* Evitar layout shift */
    contain: layout style paint;
}

.form-section {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* === INPUT FIELDS === */
.form-input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    background: rgba(10, 1, 24, 0.6);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-body);
    /* Transição apenas em propriedades baratas */
    transition: border-color 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* === SELECTOR BUTTONS (Plano e Dispositivo) === */
.selector-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-radius: 12px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    background: rgba(10, 1, 24, 0.6);
    color: var(--text-primary);
    font-family: var(--font-body);
    cursor: pointer;
    /* Transição otimizada */
    transition: border-color 0.15s ease, transform 0.15s ease;
    /* GPU acceleration */
    transform: translateZ(0);
    contain: layout style paint;
}

.selector-button:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.selector-button:active {
    transform: translateY(0);
}

.selector-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.selector-icon {
    font-size: 1.8rem;
}

.selector-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.selector-text {
    font-size: 1rem;
    color: var(--text-primary);
}

.selector-price {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.selector-arrow {
    font-size: 1.5rem;
    color: var(--primary);
}

/* === DETALHES DO PLANO INLINE === */
.plan-details-inline {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.plan-features-header {
    font-weight: 600;
    font-size: 1rem;
    color: var(--green-light);
    margin-bottom: 12px;
}

.plan-features-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plan-features-list li {
    font-size: 0.95rem;
    color: var(--text-primary);
    padding-left: 24px;
    position: relative;
}

.plan-features-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--green-accent);
    font-weight: 700;
}

.plan-features-list li.highlight {
    color: var(--green-light);
    font-weight: 500;
}

/* === SUBMIT BUTTON === */
.submit-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--green-accent), #059669);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    /* Transição otimizada */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    /* GPU acceleration */
    transform: translateZ(0);
    contain: layout style paint;
}

.submit-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(16, 185, 129, 0.4);
}

.submit-button:active {
    transform: translateY(-1px);
}

/* === BACK LINK === */
.back-link {
    display: block;
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--primary-light);
}

/* === MODAL (ULTRA OTIMIZADO) === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* Estado inicial: invisível e não interativo */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* Transição RÁPIDA (apenas opacity) */
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Backdrop simples (SEM BLUR!) */
.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* GPU acceleration */
    transform: translateZ(0);
}

/* Container do modal */
.modal-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    background: rgba(10, 1, 24, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* GPU acceleration */
    transform: translateZ(0) translateY(20px);
    /* Transição de entrada */
    transition: transform 0.15s ease;
    contain: layout style paint;
}

.modal.active .modal-container {
    transform: translateZ(0) translateY(0);
}

/* Header do modal */
.modal-header {
    position: relative;
    padding: 24px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    flex-shrink: 0;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    padding-right: 40px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Body do modal (scrollable) */
.modal-body {
    padding: 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Scrollbar customizada */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* === PLANS GRID === */
.plans-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 768px) {
    .plans-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Plan Card */
.plan-card {
    position: relative;
    background: rgba(139, 92, 246, 0.05);
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    /* Transição otimizada */
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    /* GPU acceleration */
    transform: translateZ(0);
    overflow: visible;
}

.plan-card:hover {
    transform: translateY(-4px);
    border-color: rgba(139, 92, 246, 0.5);
}

.plan-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.plan-card.featured {
    border-color: rgba(139, 92, 246, 0.4);
}

/* Plan Badge */
.plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    z-index: 100;
}

.plan-badge.basic {
    background: linear-gradient(135deg, #C0C0C0, #E8E8E8);
    color: #1a1a2e;
}

.plan-badge.popular {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.plan-badge.gold {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a2e;
}

/* Plan Content */
.plan-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    margin-top: 8px;
}

.plan-price {
    margin-bottom: 16px;
}

.price-value {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.price-period {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Plan Features */
.plan-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plan-features li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-left: 20px;
    position: relative;
}

.plan-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary-light);
}

.plan-features li.highlight {
    color: var(--green-light);
    font-weight: 500;
}

.plan-features li.highlight::before {
    color: var(--green-accent);
}

/* === DEVICES GRID === */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 480px) {
    .devices-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Device Card */
.device-card {
    background: rgba(139, 92, 246, 0.05);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    /* Transição otimizada */
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    /* GPU acceleration */
    transform: translateZ(0);
    contain: layout style paint;
}

.device-card:hover {
    transform: translateY(-4px);
    border-color: rgba(139, 92, 246, 0.5);
}

.device-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.device-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.device-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
    .checkout-container {
        padding: 0;
    }
    
    .checkout-form {
        padding: 24px 20px;
    }
    
    .title-gradient {
        font-size: 1.75rem;
    }
    
    .plans-grid {
        grid-template-columns: 1fr;
    }
}

/* === PERFORMANCE HINTS === */
/* Forçar GPU em elementos animados */
.submit-button,
.selector-button,
.plan-card,
.device-card,
.modal-container {
    backface-visibility: hidden;
    perspective: 1000px;
}
