/* Variáveis de Design */
:root {

    /* Cores */
    --design-primary: {
            {
            cor_primaria
        }
    }

    ;

    --design-secondary: {
            {
            cor_secundaria
        }
    }

    ;

    --design-accent: {
            {
            cor_destaque
        }
    }

    ;

    --design-text: {
            {
            cor_texto
        }
    }

    ;

    --design-bg: {
            {
            cor_fundo
        }
    }

    ;

    --design-bg-alt: {
            {
            fundo_alternativo
        }
    }

    ;

    /* Tipografia */
    --design-font-heading: {
            {
            fonte_titulo
        }
    }

    ;

    --design-font-body: {
            {
            fonte_corpo
        }
    }

    ;

    /* Botões */
    --design-btn-bg: {
            {
            botao_cor_fundo
        }
    }

    ;

    --design-btn-text: {
            {
            botao_cor_texto
        }
    }

    ;

    --design-btn-border: {
            {
            botao_cor_borda
        }
    }

    ;

    --design-btn-hover-bg: {
            {
            botao_hover_cor_fundo
        }
    }

    ;

    --design-btn-hover-text: {
            {
            botao_hover_cor_texto
        }
    }

    ;

    --design-btn-hover-border: {
            {
            botao_hover_cor_borda
        }
    }

    ;

    /* Header */
    --design-header-bg: {
            {
            header_cor_fundo
        }
    }

    ;

    --design-header-text: {
            {
            header_cor_texto
        }
    }

    ;

    --design-header-hover: {
            {
            header_cor_texto_hover
        }
    }

    ;

    /* Footer */
    --design-footer-bg: {
            {
            footer_cor_fundo
        }
    }

    ;

    --design-footer-text: {
            {
            footer_cor_texto
        }
    }

    ;

    --design-footer-hover: {
            {
            footer_cor_texto_hover
        }
    }

    ;

    /* Hero */
    --design-hero-bg-url: url('');
    --design-hero-title: '';
    --design-hero-subtitle: '';
}

/* ============================================
   Elemento: Carrinho Sidebar - Estilos OTIMIZADOS
   Foco: Maximizar espaço para lista de produtos
   ============================================ */

/* Botão do carrinho no header */
.carrinho-sidebar-trigger {
    position: relative;
}

.carrinho-btn {
    position: relative;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: inherit;
}

.carrinho-btn:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.carrinho-badge {
    position: absolute;
    top: 0;
    right: 0;

    background: {
            {
            cor_primaria
        }
    }

    ;

    color: var(--design-bg, {
            {
            cor_fundo
        }
    });
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 0.2rem;
}

.carrinho-badge.has-items {
    display: flex;
}

/* ============================================
   SIDEBAR - Layout principal
   ============================================ */
.carrinho-sidebar {
    width: 380px !important;
    max-width: 100vw;
    background-color: #ffffff !important;
    color: #111827 !important;
}

/* Header compacto */
.carrinho-sidebar .offcanvas-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    background-color: #ffffff;
}

.carrinho-sidebar .offcanvas-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827 !important;
    display: flex;
    align-items: center;
}

.carrinho-sidebar .btn-close {
    padding: 0.5rem;
    filter: none;
    opacity: 0.5;
}

/* Body: layout flex para preencher tela */
.carrinho-sidebar .offcanvas-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #ffffff;
}

/* ============================================
   HEADER INFO - Contador inline compacto
   ============================================ */
.carrinho-header-info {
    padding: 0.5rem 1rem;
    background: #f9fafb !important;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.carrinho-item-count {
    font-size: 0.8rem;
    color: #6b7280 !important;
}

.carrinho-item-count span {
    font-weight: 700;
    color: #111827 !important;
}

/* ============================================
   LISTA DE PRODUTOS - Maximizar área
   ============================================ */
.carrinho-items-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    list-style: none;
    min-height: 0; /* crucial para flex overflow */
}

/* Scrollbar estilizada */
.carrinho-items-list::-webkit-scrollbar {
    width: 4px;
}

.carrinho-items-list::-webkit-scrollbar-track {
    background: transparent;
}

.carrinho-items-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.carrinho-items-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Estado vazio */
.carrinho-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: #9ca3af;
    text-align: center;
}

.carrinho-empty svg {
    margin-bottom: 0.75rem;
    opacity: 0.4;
    width: 40px;
    height: 40px;
}

.carrinho-empty p {
    margin: 0;
    font-size: 0.8125rem;
}

/* ============================================
   ITEM DO CARRINHO - Layout compacto
   ============================================ */
.carrinho-item {
    display: flex;
    gap: 0.625rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid #f3f4f6;
    align-items: flex-start;
}

.carrinho-item:last-child {
    border-bottom: none;
}

/* Imagem reduzida */
.carrinho-item-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 0.375rem;
    flex-shrink: 0;
    background: #f3f4f6;
}

.carrinho-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.carrinho-item-name {
    font-weight: 600;
    color: #111827 !important;
    font-size: 0.8125rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.carrinho-item-variant {
    font-size: 0.6875rem;
    color: #6b7280;
}

/* Indicador de quantidade mínima */
.carrinho-item-qtd-minima {
    font-size: 0.625rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    display: inline-block;
    width: fit-content;
}

.carrinho-item-qtd-minima.alerta {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    font-weight: 600;
}

/* Item com alerta de quantidade insuficiente */
.carrinho-item.carrinho-item-alerta {
    background: #fffbeb;
    border-left: 2px solid #f59e0b;
    margin-left: -0.125rem;
    padding-left: 0.5rem;
}

/* Controles: quantidade e preço na mesma linha */
.carrinho-item-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.125rem;
}

.carrinho-item-quantity {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.carrinho-quantity-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;

    color: var(--design-primary, {
            {
            cor_primaria
        }
    });
    transition: all 0.15s;
}

.carrinho-quantity-btn:hover {
    background: var(--design-primary, {
            {
            cor_primaria
        }
    });
    color: #fff;
}

.carrinho-item-quantity span {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 0.8125rem;
    color: #0f172a !important;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    padding: 0.125rem 0;
    line-height: 26px;
}

.carrinho-item-price {
    font-weight: 700;
    color: #111827 !important;
    font-size: 0.8125rem;
    white-space: nowrap;
}

/* Botão remover - compacto */
.carrinho-item-remove {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #d1d5db;
    transition: all 0.2s;
    align-self: flex-start;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.carrinho-item-remove:hover {
    color: #ef4444;
    transform: scale(1.1);
}

.carrinho-item-remove svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   SEÇÃO DE FRETE - Colapsável e compacta
   ============================================ */
.carrinho-frete-section {
    border-top: 1px solid #e5e7eb;
    padding: 0.5rem 1rem;
    background: #fafbfc !important;
    flex-shrink: 0;
}

.carrinho-frete-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    color: #374151 !important;
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
}

.carrinho-frete-header svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.carrinho-frete-input {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 0.375rem;
}

.frete-cep-input {
    flex: 1;
    padding: 0.375rem 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
    transition: all 0.2s;
}

.frete-cep-input:focus {
    outline: none;
    border-color: var(--design-primary, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
}

.frete-calcular-btn {
    padding: 0.375rem 0.75rem;
    background: var(--design-primary, #3b82f6);
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.frete-calcular-btn:hover {
    background: var(--design-secondary, #2563eb);
}

.carrinho-frete-loading {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    color: #6b7280;
}

.loading-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--design-primary, #3b82f6);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.carrinho-frete-resultados {
    margin-top: 0.25rem;
    max-height: 100px;
    overflow-y: auto;
}

.frete-opcao {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.75rem;
}

.frete-opcao:hover {
    border-color: var(--design-primary, #3b82f6);
    background: #f0f9ff;
}

.frete-opcao.selecionada {
    border-color: var(--design-primary, #3b82f6);
    background: #eff6ff;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.1);
}

.frete-opcao-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.frete-opcao-nome {
    font-weight: 600;
    color: #111827;
    font-size: 0.75rem;
}

.frete-opcao-prazo {
    font-size: 0.625rem;
    color: #6b7280;
}

.frete-opcao-preco {
    font-weight: 700;
    color: #059669;
    font-size: 0.8125rem;
}

.frete-opcao-preco.gratis {
    color: #10b981;
}

.frete-erro {
    padding: 0.375rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.25rem;
    color: #dc2626;
    font-size: 0.6875rem;
}

/* ============================================
   FOOTER - Ultra compacto
   ============================================ */
.carrinho-footer {
    border-top: 2px solid #e5e7eb;
    padding: 0.75rem 1rem;
    background: #f9fafb !important;
    color: #374151 !important;
    flex-shrink: 0;
}

.carrinho-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    font-size: 0.8125rem;
}

.carrinho-subtotal-label {
    font-weight: 500;
    color: #6b7280 !important;
}

.carrinho-subtotal-value {
    font-weight: 600;
    color: #374151 !important;
}

.carrinho-frete-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    font-size: 0.8125rem;
}

.carrinho-frete-label {
    font-weight: 500;
    color: #6b7280 !important;
}

.carrinho-frete-value {
    font-weight: 600;
    color: #059669 !important;
}

.carrinho-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.625rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
    font-size: 1rem;
}

.carrinho-total-label {
    font-weight: 600;
    color: #374151 !important;
}

.carrinho-total-value {
    font-weight: 800;
    color: #111827 !important;
    font-size: 1.25rem;
}

/* ============================================
   BOTÃO FINALIZAR COMPRA (CHECKOUT NATIVO)
   ============================================ */
.carrinho-finalizar-btn {
    width: 100%;
    padding: 0.625rem;

    background: var(--design-primary, {
            {
            cor_primaria
        }
    });
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-bottom: 0;
}

.carrinho-finalizar-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px -2px rgba(0, 0, 0, 0.12);
}

.carrinho-finalizar-btn:active {
    transform: translateY(0);
}

.carrinho-finalizar-btn:disabled,
.carrinho-finalizar-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.carrinho-finalizar-btn svg {
    width: 16px;
    height: 16px;
    margin-right: 0.375rem;
}

/* ============================================
   BOTÃO WHATSAPP (SECUNDÁRIO) - Compacto
   ============================================ */
.carrinho-whatsapp-btn {
    background: #25d366 !important;
    color: white !important;
}

.carrinho-whatsapp-btn:hover {
    background: #20ba5a !important;
}

.carrinho-checkout-btn {
    width: 100%;
    padding: 0.625rem;

    background: var(--design-btn-bg, {
            {
            botao_cor_fundo
        }
    });
    color: var(--design-primary, white);
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.carrinho-checkout-btn:hover {
    background: var(--design-btn-hover-bg, {
            {
            botao_hover_cor_fundo
        }
    });
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.carrinho-checkout-btn:active {
    transform: translateY(0);
}

.carrinho-checkout-btn svg {
    width: 16px;
    height: 16px;
    margin-right: 0.375rem;
}

/* Divisor "ou" compacto */
.carrinho-divisor {
    margin: 0.375rem 0 !important;
}

/* ============================================
   RESPONSIVO
   ============================================ */
@media (max-width: 768px) {
    .carrinho-sidebar {
        width: 100% !important;
    }

    .carrinho-item-image {
        width: 48px;
        height: 48px;
    }

    .carrinho-total-value {
        font-size: 1.125rem;
    }
}

/* Telas muito pequenas (notebook) */
@media (max-height: 700px) {
    .carrinho-sidebar .offcanvas-header {
        padding: 0.5rem 0.75rem;
    }
    
    .carrinho-header-info {
        padding: 0.375rem 0.75rem;
    }
    
    .carrinho-items-list {
        padding: 0.375rem 0.75rem;
    }
    
    .carrinho-item {
        padding: 0.5rem 0;
        gap: 0.5rem;
    }
    
    .carrinho-item-image {
        width: 48px;
        height: 48px;
    }
    
    .carrinho-footer {
        padding: 0.5rem 0.75rem;
    }
    
    .carrinho-total {
        margin-bottom: 0.375rem;
        padding-top: 0.375rem;
    }
    
    .carrinho-finalizar-btn,
    .carrinho-checkout-btn {
        padding: 0.5rem;
        font-size: 0.8125rem;
    }
    
    .carrinho-frete-section {
        padding: 0.375rem 0.75rem;
    }
}

/* ============================================
   ALERTAS DE VALIDAÇÃO (Quantidade/Valor Mínimo)
   ============================================ */
.carrinho-alerta-minimo {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
}

.alerta-valor-minimo {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
    border: 1px solid #f59e0b;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
}

.alerta-valor-minimo .alerta-icone {
    font-size: 1rem;
    flex-shrink: 0;
}

.alerta-valor-minimo .alerta-texto {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.alerta-valor-minimo .alerta-texto strong {
    color: #92400e;
    font-size: 0.8125rem;
}

.alerta-valor-minimo .alerta-texto span {
    color: #b45309;
    font-size: 0.6875rem;
}

.alerta-quantidade-minima {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.25rem;
    color: #dc2626;
    font-size: 0.6875rem;
    margin-top: 0.25rem;
}

.alerta-quantidade-minima .alerta-icone {
    flex-shrink: 0;
}

/* Botão desabilitado por validação */
.carrinho-checkout-btn.disabled,
.carrinho-finalizar-btn.disabled {
    background: #d1d5db !important;
    color: #9ca3af !important;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.7;
}

.carrinho-checkout-btn.disabled:hover,
.carrinho-finalizar-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}