/**
 * ONBOARDING STYLES - MOBILE FIRST APPROACH
 */

/* Container principal - Mobile First */
.onboarding-container {
    padding: 1rem;
    min-height: calc(100vh - 200px); /* Evita sobreposição do footer */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    z-index: 1;
}

.onboarding-card {
    max-width: 100%;
    margin: 0 auto 2rem auto; /* Adiciona margem inferior */
    border-radius: 0.5rem;
    overflow: hidden;
    background: white;
}

/* Tablet e maior */
@media (min-width: 768px) {
    .onboarding-container {
        padding: 1.5rem;
        min-height: calc(100vh - 150px);
    }
    
    .onboarding-card {
        max-width: 900px;
        border-radius: 1rem;
    }
}

/* Desktop */
@media (min-width: 1200px) {
    .onboarding-container {
        padding: 2rem 1rem;
        min-height: calc(100vh - 120px);
    }
    
    .onboarding-card {
        max-width: 1000px; /* Reduzido de 1200px para melhor proporção */
    }
    
    /* Otimização para planos com mais espaço disponível */
    #planCardsContainer .plan-card {
        min-width: 15rem;
        max-width: none;
    }
}

/* Stepper - Mobile First */
#stepper {
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.step-bar {
    height: 2px;
    background-color: #dee2e6;
    border-radius: 1px;
    margin: 0 0.25rem;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 20px;
}

.step-bar.active {
    background-color: #0d6efd;
}

.step-label {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.step-label.is-active {
    color: #0d6efd;
    font-weight: 600;
}

.step-label.is-done {
    color: #198754;
    font-weight: 600;
}

/* Tablet e maior */
@media (min-width: 768px) {
    #stepper {
        margin-bottom: 2rem;
        gap: 1rem;
    }
    
    .step-bar {
        margin: 0 0.5rem;
    }
    
    .step-label {
        font-size: 0.875rem;
    }
}

/* Step visibility - apenas o step ativo deve aparecer */
.step {
    display: none !important;
}

.step:not(.d-none) {
    display: block !important;
    width: 100% !important;
}

/* Step 2 - layout específico */
.step .mb-5, .step .mb-3 {
    display: block !important;
    width: 100% !important;
}

/* Override qualquer CSS que possa interferir */
#step2 * {
    box-sizing: border-box;
}

/* Plan selection visual feedback - com !important para garantir aplicação */
.plan-card.selected {
    border: 3px solid #0d6efd !important;
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.25) !important;
    transform: translateY(-2px) !important;
}

.plan-card.bg-primary.selected {
    border: 3px solid #fff !important;
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.5) !important;
}

/* Plan Cards - Layout responsivo mobile-first */
#planCardsContainer {
    width: 100%;
}

#planCardsContainer .col-lg-4 {
    margin-bottom: 1rem;
}

/* Mobile: 1 coluna */
@media (max-width: 767.98px) {
    #planCardsContainer .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .plan-card {
        margin-bottom: 1rem;
    }
}

/* Tablet: 2 colunas */
@media (min-width: 768px) and (max-width: 991.98px) {
    #planCardsContainer .col-lg-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Desktop: 3 colunas */
@media (min-width: 992px) {
    #planCardsContainer .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

/* Type Selection */
.type-selection {
    margin-bottom: 2rem;
}

.type-card {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    height: 100%;
}

.type-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1);
    border-color: var(--bs-primary);
}

.type-card.selected {
    border-color: var(--bs-primary);
    border-width: 3px;
    box-shadow: 0 0.5rem 1rem rgba(var(--bs-primary-rgb),0.25);
    transform: translateY(-2px);
}

.type-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background-color: #f8f9fa;
    color: #6c757d;
}

.type-card.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: transparent;
}

.type-card.disabled .card-body {
    position: relative;
}

.type-card.disabled .card-body::after {
    content: "Em breve";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(108, 117, 125, 0.9);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Plan Selection */
.plan-selection-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #dee2e6;
}

#planCardsContainer {
    margin-top: 1rem;
}

#planCardsContainer .plan-card {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
    height: 100%;
    min-width: 16rem; /* Reduzido de 18rem para melhor aproveitamento */
}

#planCardsContainer .plan-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

#planCardsContainer .plan-card.selected {
    border-color: #0d6efd;
    border-width: 3px;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.25);
}

#planCardsContainer .plan-card.bg-primary.selected {
    border-color: #fff;
    border-width: 3px;
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.5);
}

#planCardsContainer .plan-card[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.plan-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.plan-card.selected {
    border-color: #0d6efd;
    transform: translateY(-2px);
}

.plan-card.bg-primary.selected {
    border-color: #fff;
}

.plan-card[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Plan highlight badge */
.plan-card .badge-highlight {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(45deg, #ff6b6b, #ffa500);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
}

/* Form improvements */
.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.btn-primary {
    background: linear-gradient(45deg, #0d6efd, #6610f2);
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.3);
}

.btn-success {
    background: linear-gradient(45deg, #198754, #20c997);
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.select-plan {
    transition: all 0.3s ease;
}

/* Template Cards */
.template-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent !important;
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
}

.template-card.selected {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.2) !important;
}

.template-preview img {
    transition: all 0.3s ease;
}

.template-card:hover .template-preview img {
    transform: scale(1.05);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .onboarding-container {
        padding: 1rem 0.5rem;
    }
    
    .type-selection {
        flex-direction: column;
        gap: 1rem;
    }
    
    .type-selection .type-card {
        max-width: 100%;
    }
    
    #planCardsContainer {
        flex-direction: column;
        gap: 1rem;
    }
    
    #planCardsContainer .plan-card {
        max-width: 100%;
    }
    
    .onboarding-card .row.g-0 {
        flex-direction: column;
    }
    
    .step-label {
        display: none;
    }
    
    #stepper {
        justify-content: center;
    }
}

/* Fallback para navegadores sem flexbox */
.type-selection {
    display: block;
    overflow: hidden;
}

.type-selection .type-card {
    float: left;
    width: calc(50% - 0.75rem);
    margin-right: 1.5rem;
    margin-bottom: 1.5rem;
}

.type-selection .type-card:nth-child(even) {
    margin-right: 0;
}

/* Flexbox override */
@supports (display: flex) {
    .type-selection {
        display: flex;
        flex-wrap: wrap;
        gap: 1.5rem;
        margin-bottom: 2rem;
        justify-content: center;
    }
    
    .type-selection .type-card {
        float: none;
        width: auto;
        margin: 0;
        flex: 1;
        min-width: 200px;
        max-width: 300px;
    }
}

/* Loading state */
.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.page-loading.active {
    display: flex;
}

.page-loading-inner {
    text-align: center;
}

.page-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ====== Payment Options ====== */
.payment-option {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.payment-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: #dee2e6;
}

.payment-option.selected {
    border-color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.2);
}

.payment-option .card-body {
    padding: 1.5rem;
}

.payment-option i {
    transition: color 0.3s ease;
}

.payment-option.selected i {
    color: #0d6efd !important;
}

/* ====== Checkout Loading ====== */
#checkoutLoading {
    position: relative;
    min-height: 400px;
}

#checkoutLoading .page-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 1000;
}

#checkoutLoading .page-loading-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}