/* ===================================
   CHECKOUT STEPS - SISTEMA DE ETAPAS
   Minimal Club - CSS específico do checkout
   =================================== */

/* CRÍTICO: Esconder todas as etapas por padrão */
.checkout-step {
    display: none !important;
}

/* Mostrar apenas a etapa ativa */
.checkout-step.active {
    display: block !important;
    animation: fadeIn 0.3s ease;
}

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

/* ===================================
   PROGRESS BAR
   =================================== */
.checkout-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.progress-step.active,
.progress-step.completed {
    opacity: 1;
}

.progress-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-bg-alt, #f5f5f5);
    border: 2px solid var(--color-border, #ddd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--color-text-secondary, #999);
    transition: all 0.3s ease;
}

.progress-step.active .progress-number {
    background: var(--color-primary, #000);
    color: white;
    border-color: var(--color-primary, #000);
}

.progress-step.completed .progress-number {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.progress-step.completed .progress-number::after {
    content: '✓';
    position: absolute;
    font-size: 1.2rem;
}

.progress-step.completed .progress-number {
    font-size: 0;
}

.progress-label {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    text-align: center;
    color: var(--color-text-secondary, #666);
}

.progress-step.active .progress-label,
.progress-step.completed .progress-label {
    color: var(--color-text, #000);
    font-weight: 500;
}

.progress-line {
    flex: 1;
    height: 2px;
    background: var(--color-border, #ddd);
    margin: 0 1rem;
    position: relative;
    top: -10px;
}

.progress-step.completed + .progress-line {
    background: #4CAF50;
}

/* ===================================
   NAVEGAÇÃO E FORMULÁRIO
   =================================== */
.step-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border, #eee);
}

.step-navigation button {
    min-width: 140px;
}

.step-icon {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

/* Mensagens de erro */
.error-message {
    color: #f44336;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
    min-height: 1.2rem;
}

.form-group input.error,
.form-group select.error {
    border-color: #f44336;
}

/* Botão Ghost */
.btn-ghost {
    background: transparent;
    color: var(--color-text, #333);
    border: 1px solid var(--color-border, #ddd);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--color-bg-alt, #f5f5f5);
}

.btn-ghost:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ===================================
   REVISÃO DOS DADOS
   =================================== */
.review-section {
    background: var(--color-bg-alt, #f9f9f9);
    padding: 1.5rem;
    border-radius: var(--border-radius, 8px);
    margin-bottom: 1.5rem;
}

.review-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.review-content {
    margin-top: 1.5rem;
}

.review-block {
    margin-bottom: 1.5rem;
}

.review-block:last-child {
    margin-bottom: 0;
}

.review-block h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--color-text-secondary, #666);
    margin-bottom: 0.5rem;
}

.review-data {
    line-height: 1.6;
    color: var(--color-text, #333);
}

/* ===================================
   RESUMO DO PEDIDO
   =================================== */
.summary-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border, #eee);
}

.summary-toggle-icon {
    display: none;
    transition: transform 0.3s ease;
}

.summary-content {
    margin-top: 1rem;
}

.summary-security {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border, #eee);
    color: var(--color-text-secondary, #666);
    font-size: 0.875rem;
}

/* Shipping Options melhoradas */
.shipping-option {
    cursor: pointer;
    transition: all 0.3s ease;
}

.shipping-option:hover {
    border-color: var(--color-primary, #000);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.shipping-option input[type="radio"]:checked + .shipping-info {
    font-weight: 500;
}

/* Loading State */
.checkout-step.loading {
    pointer-events: none;
    opacity: 0.6;
}

.checkout-step.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid var(--color-border, #ddd);
    border-top-color: var(--color-primary, #000);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===================================
   MOBILE RESPONSIVO
   =================================== */
@media (max-width: 767px) {
    /* Progress Bar Mobile */
    .checkout-progress {
        margin-bottom: 2rem;
    }

    .progress-number {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    .progress-label {
        font-size: 0.75rem;
        max-width: 80px;
    }

    .progress-line {
        margin: 0 0.5rem;
    }

    /* Grid Mobile */
    .checkout-grid {
        grid-template-columns: 1fr;
    }

    /* Resumo Colapsável */
    .checkout-summary {
        order: -1; /* Move summary to top on mobile */
        margin-bottom: 2rem;
    }

    .summary-toggle-icon {
        display: block;
    }

    .summary-header {
        padding: 1rem;
        margin: -1rem -1rem 0 -1rem;
        background: var(--color-bg, #fff);
        position: sticky;
        top: 60px;
        z-index: 10;
        border-bottom: 2px solid var(--color-border, #eee);
    }

    /* Header clicável mobile */
    .summary-header {
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
        transition: background-color 0.2s ease;
    }

    .summary-header:hover {
        background-color: rgba(0,0,0,0.02);
    }

    .summary-header:active {
        background-color: rgba(0,0,0,0.05);
    }

    /* Ícone toggle visível */
    .summary-toggle-icon {
        display: inline-block;
        font-weight: bold;
        transition: transform 0.3s ease;
    }

    /* Estado inicial - conteúdo escondido */
    #summaryContent {
        display: none;
        animation: slideDown 0.3s ease;
    }

    /* Estado expandido - conteúdo visível */
    #summaryContent.expanded {
        display: block !important;
    }

    /* Animação de abertura */
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Visual feedback no ícone */
    .summary-header h2 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        margin: 0;
    }

    /* Review Mobile */
    .review-content {
        display: none;
    }

    .review-content.expanded {
        display: block !important;
    }

    /* Navegação Mobile */
    .step-navigation {
        flex-direction: column;
    }

    .step-navigation button {
        width: 100%;
    }

    /* Desktop only */
    .mobile-only {
        display: inline-block !important;
    }

    /* Ícone toggle melhorado */
    .summary-toggle-icon.mobile-only {
        background: var(--color-primary, #000);
        color: white;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        line-height: 1;
        transition: transform 0.3s ease;
    }

    .summary-header:active .summary-toggle-icon {
        transform: scale(0.95);
    }
}

/* Desktop */
@media (min-width: 768px) {
    .checkout-step {
        min-height: 400px;
    }

    /* Keep summary visible and fixed height */
    .checkout-summary {
        position: sticky;
        top: 80px;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    /* Hide mobile-only elements */
    .mobile-only {
        display: none !important;
    }

    .summary-header {
        cursor: default;
    }

    .review-toggle {
        cursor: default;
    }

    .toggle-icon {
        display: none;
    }

    /* Review sempre visível no desktop */
    .review-content {
        display: block !important;
    }
}