/* ============================================================
    NEXUS - CARRINHO.CSS (Versão Final: Correção de Quebra)
   ============================================================ */

:root {
    --neon-green: #00e0b3;
    --dark-gray: #1a1a1a;
    --text-gray: #666;
    --border-color: #eee;
    --bg-light: #f4f7f6;
    --white: #ffffff;
    --error-red: #ff4d4d;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-light);
    font-family: 'Poppins', sans-serif;
    color: #333;
    margin: 0;
    line-height: 1.6;
    overflow-x: hidden; /* Garante que nada escape da tela */
}

/* --- HEADER --- */
.checkout-header {
    background: var(--white);
    padding: 15px 0;
    border-bottom: 2px solid var(--neon-green);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    font-weight: 900;
    font-size: 1.4rem;
    letter-spacing: -1px;
    color: #000;
    text-decoration: none;
}

.brand-logo span {
    font-size: 0.65rem;
    background: var(--neon-green);
    color: #000;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.btn-back {
    text-decoration: none;
    color: var(--text-gray);
    font-size: 0.75rem;
    font-weight: 700;
}

/* --- LAYOUT GRID --- */
.checkout-layout {
    max-width: 1100px;
    margin: 30px auto;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 25px;
    padding: 0 20px;
}

/* --- CARDS --- */
.step-card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f9f9f9;
}

.step-title {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-title i { color: var(--neon-green); }

/* --- ITEM DO CARRINHO (ESTRUTURA ROBUSTA) --- */
.cart-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.cart-item:last-child { border-bottom: none; }

.cart-item-img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #eee;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    min-width: 0; /* Impede o título de empurrar a tela */
}

.cart-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin: 0 0 5px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-tag {
    color: var(--neon-green);
    font-size: 11px;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--error-red);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    transition: 0.3s;
}

/* --- AÇÕES (PREÇO E QUANTIDADE) --- */
.item-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.quantity-control {
    display: flex;
    align-items: center;
    background: #000;
    border-radius: 8px;
    padding: 3px;
}

.btn-qty {
    background: transparent;
    border: none;
    color: var(--neon-green);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    width: 25px;
    height: 25px;
}

.qty-number {
    color: #fff;
    font-size: 0.85rem;
    width: 25px;
    text-align: center;
    font-weight: 700;
}

.price-subtotal {
    font-weight: 800;
    font-size: 1.1rem;
    color: #000;
    min-width: 90px;
    text-align: right;
}

/* --- RESUMO LATERAL --- */
.summary-card {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    position: sticky;
    top: 25px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.summary-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: #000;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.summary-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px dashed #eee;
    font-size: 1.3rem;
    font-weight: 800;
    display: flex;
    justify-content: space-between;
    color: #000;
}

.btn-main {
    width: 100%;
    background: #000;
    color: #fff;
    border: none;
    padding: 18px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 25px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.security-badge {
    margin-top: 20px;
    text-align: center;
    font-size: 0.75rem;
    color: #aaa;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.security-badge i { color: var(--neon-green); }

/* --- RODAPÉ --- */
.checkout-footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-gray);
    font-size: 0.75rem;
}

/* ============================================================
    RESPONSIVIDADE (O SEGREDO ESTÁ AQUI)
   ============================================================ */

@media (max-width: 950px) {
    .checkout-layout {
        grid-template-columns: 1fr;
    }
    .summary-card {
        position: static;
    }
}

@media (max-width: 600px) {
    /* Mudamos o item do carrinho para permitir quebras */
    .cart-item {
        flex-wrap: wrap; /* Permite que os itens "pulem" para baixo */
        gap: 10px;
        align-items: flex-start;
    }

    .cart-item-img {
        width: 65px;
        height: 65px;
    }

    /* Ocupa o resto da linha superior */
    .cart-item-info {
        flex: 1; 
    }

    /* Forçamos os botões e o preço a irem para uma NOVA LINHA */
    .item-actions {
        width: 100%; /* Ocupa a largura toda abaixo do título */
        justify-content: space-between; /* Quantidade na esquerda, preço na direita */
        margin-top: 10px;
        background: #f9f9f9;
        padding: 10px;
        border-radius: 8px;
    }

    .price-subtotal {
        font-size: 1rem;
        min-width: auto;
    }

    .cart-item-title {
        white-space: normal; /* No mobile, permite quebrar em 2 linhas se necessário */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        font-size: 0.85rem;
    }
    
    /* Ajuste no botão de remover para não sumir */
    .btn-remove {
        margin-top: 5px;
    }
}

@keyframes spin { to { transform: rotate(360deg); } }
.fa-spin { animation: spin 1s linear infinite; }