/* =======================================================
   ESTILOS GERAIS DA PÁGINA DE CARRINHO (FLLUMEN)
   ======================================================= */
body { font-family: 'Open Sans', sans-serif; margin: 0; padding: 0; background-color: #fafafa; color: #333; }

/* Classe utilitária para esconder elementos (USADA PELO JS) */
.escondido { display: none !important; }

/* --- Tela de Loading Inicial (Full Screen) --- */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    
    /* A MÁGICA DA TRANSPARÊNCIA: 80% visível, 20% transparente */
    background-color: rgba(250, 250, 250, 0.8); 
    
    /* EFEITO PREMIUM: Dá um leve desfoque no site lá atrás */
    backdrop-filter: blur(3px); 
    
    z-index: 9999; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease; 
}

.loading-overlay.escondido {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.loading-overlay p {
    margin-top: 20px; font-family: 'Barlow Condensed', sans-serif; font-size: 26px; color: #333; font-weight: 800; letter-spacing: 1px;
}

/* --- Cabeçalho --- */
.header-carrinho { background-color: #fff; padding: 20px; text-align: center; border-bottom: 1px solid #eee; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 40px;}
.header-carrinho h1 { font-family: 'Barlow Condensed', sans-serif; color: #e30613; margin: 0; font-size: 32px; letter-spacing: 1px; }
.header-carrinho a { text-decoration: none; color: inherit; }

.container-carrinho { max-width: 1100px; margin: 0 auto; padding: 0 20px 60px 20px; }

/* --- Carrinho Vazio --- */
.area-carrinho-vazio { text-align: left; padding: 40px; background: #fff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.03); }
.area-carrinho-vazio h2, .titulo-secao { font-family: 'Barlow Condensed', sans-serif; font-size: 36px; margin-top: 0; margin-bottom: 20px; color: #333;}
.area-carrinho-vazio a { display: inline-block; margin-top: 20px; color: #e30613; font-weight: bold; text-decoration: none; border: 2px solid #e30613; padding: 10px 25px; border-radius: 30px; transition: all 0.3s; }
.area-carrinho-vazio a:hover { background-color: #e30613; color: white; }

/* --- Tabela de Produtos --- */
.tabela-carrinho { width: 100%; border-collapse: collapse; margin-bottom: 30px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.03); border-radius: 8px; overflow: hidden; }
.tabela-carrinho th { text-align: center; padding: 15px; font-size: 14px; color: #666; border-bottom: 1px dashed #ddd; font-weight: 600; text-transform: uppercase; background: #f9f9f9;}
.tabela-carrinho td { padding: 20px 15px; text-align: center; vertical-align: middle; border-bottom: 1px dashed #ddd;}
.tabela-carrinho tr:last-child td { border-bottom: none; }

.col-item { text-align: left !important; display: flex; align-items: center; gap: 20px; }
.img-carrinho-tabela { width: 60px; height: 90px; object-fit: cover; border-radius: 4px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.titulo-livro-tabela { font-family: 'Barlow Condensed', sans-serif; font-size: 20px; font-weight: 800; text-transform: uppercase; color: #333; }
.preco-unitario-tabela { font-weight: 600; color: #555; }
.preco-subtotal-tabela { font-weight: 800; color: #e30613; font-size: 16px; }

/* Controles de Qtd na Tabela */
.qtd-box { display: flex; align-items: center; justify-content: center; gap: 8px; }
.qtd-box button { background-color: #e30613; color: white; border: none; width: 28px; height: 28px; border-radius: 50%; font-size: 14px; cursor: pointer; display: flex; justify-content: center; align-items: center; transition: transform 0.1s; }
.qtd-box button:active { transform: scale(0.9); }
.qtd-box input { width: 45px; height: 35px; text-align: center; border: 1px solid #ccc; font-weight: bold; border-radius: 4px; font-size: 16px; outline: none;}
.btn-lixeira-tabela { background: none; border: none; color: #888; font-size: 20px; cursor: pointer; transition: color 0.2s; }
.btn-lixeira-tabela:hover { color: #e30613; }

/* --- Grid Inferior (Entrega, Cupom, Resumo) --- */
.carrinho-footer-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; align-items: start;}
.box-cinza { background-color: #f1f1f1; padding: 25px; border-radius: 4px; border: 1px solid #e0e0e0; }
.box-cinza h4 { margin: 0 0 20px 0; font-size: 16px; text-align: center; color: #333; font-weight: 800; }

/* Inputs Padrões */
.input-group { display: flex; }
.input-padrao { flex: 1; padding: 12px 15px; border: 1px solid #ccc; border-radius: 4px 0 0 4px; font-size: 15px; outline: none; }
.btn-lateral { background: white; border: 1px solid #ccc; border-left: none; color: #e30613; padding: 0 20px; cursor: pointer; border-radius: 0 4px 4px 0; font-size: 16px; transition: background 0.2s;}
.btn-lateral:hover { background: #f9f9f9; }
.msg-cupom { font-size: 13px; margin-top: 10px; font-weight: bold; }

/* --- Frete (Fora da Caixa Cinza) --- */
.area-frete-resultado { margin-top: 20px; text-align: left; }
.titulo-correios { font-size: 12px; font-weight: 800; color: #333; margin: 0 0 10px 0; text-transform: capitalize; }
.lista-fretes { display: flex; flex-direction: column; gap: 10px; }
.opcao-frete { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 15px; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; transition: border-color 0.2s; }
.opcao-frete:hover { border-color: #e30613; }
.opcao-frete input { margin-right: 10px; accent-color: #e30613; }
.nome-frete-opcao { font-size: 14px; color: #555; }
.valor-frete-opcao { font-weight: 800; color: #333; font-size: 14px;}

/* --- Loading (A Bolinha Perfeita do Print) --- */
.loading-spinner { 
    width: 20px; 
    height: 20px; 
    border: 3px solid #fad4d6; /* Vermelho clarinho de fundo */
    border-top-color: #e30613; /* Vermelho forte girando */
    border-radius: 50%; 
    animation: spin 1s linear infinite; 
    display: inline-block; 
    vertical-align: middle;
}
.loading-spinner.gigante {
    width: 60px; height: 60px; border-width: 6px;
}
.area-frete-resultado .loading-spinner {
    margin: 20px auto;
    display: block;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Resumo Final --- */
.linha-resumo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 14px; color: #666; }
.linha-resumo .valor-normal { font-weight: 600; color: #555; }
.linha-resumo .nome-frete-lateral { max-width: 65%; font-size: 12px; color: #888; }

.linha-resumo.total { margin-top: 15px; padding-top: 15px; border-top: 1px solid #ddd; display: flex; justify-content: space-between; align-items: center;}
.linha-resumo.total .label-total { color: #333; font-size: 14px; font-weight: 600;}
#resumoTotalGeral { color: #333; font-size: 18px; font-weight: 800; } /* Preto e elegante igual ao print */

.btn-finalizar { width: 100%; padding: 15px; background: #e30613; color: white; font-family: 'Open Sans', sans-serif; font-weight: 800; border: none; border-radius: 30px; cursor: pointer; font-size: 16px; margin-top: 20px; transition: background 0.3s; text-transform: uppercase;}
.btn-finalizar:hover { background: #b00000; }

/* --- Cortina de Loading da Caixa de Resumo --- */
.loading-resumo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(241, 241, 241, 0.7); /* O mesmo cinza do fundo, mas transparente */
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: opacity 0.2s;
}

/* Garante que a bolinha dessa cortina fique um pouco maior */
.loading-resumo-overlay .loading-spinner {
    width: 35px;
    height: 35px;
    border-width: 4px;
}

/* --- Botões Abaixo da Tabela (< Continuar Comprando) --- */
.acoes-tabela-carrinho {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px; /* Dá um respiro antes do bloco de Frete */
}

.btn-acao-tabela {
    background-color: #4a4a4a; /* O cinza escuro exato do seu print */
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 30px;
    font-family: 'Open Sans', sans-serif;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.btn-acao-tabela:hover {
    background-color: #e30613; /* Fica vermelho ao passar o mouse */
}


/* =======================================================
   RESPONSIVO (Celulares e Tablets)
   ======================================================= */
@media (max-width: 800px) {
    .carrinho-footer-grid { grid-template-columns: 1fr; }
    .tabela-carrinho th { display: none; }
    .tabela-carrinho td { display: block; text-align: right; border-bottom: none; padding: 10px 15px;}
    .tabela-carrinho tr { border-bottom: 1px dashed #ddd; display: block; padding: 10px 0;}
    .col-item { text-align: left !important; }
    .qtd-box { justify-content: flex-end; }
    
    /* A regra do celular para os botões fica AQUI DENTRO */
    .acoes-tabela-carrinho {
        flex-direction: column;
        gap: 15px;
    }
    .btn-acao-tabela {
        width: 100%;
        justify-content: center;
    }
}