/* ==========================================================================
   1. CONFIGURAÇÕES GERAIS (RESET E IDENTIDADE)
   ========================================================================== */

/* Reset de espaçamentos e remoção do padding superior padrão do Bootstrap */
body {
    margin: 0;
    padding: 0 !important; /* Remove qualquer espaço forçado no topo */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}


/* Variáveis de cores oficiais da Jhap Store */
:root {
    --roxo-principal: #9540C5;
    --roxo-secundario: #845ABE;
    --roxo-escuro: #6D62B1;
    --azul-escuro: #556DA2;
    --fundo: #EEEEEE;
    --branco: #FFFFFF;
}

/* Reutilização de cores do painel administrativo no cliente */
body {
    background-color: var(--fundo) !important;
    padding-top: 100px;
    font-family: 'Poppins', sans-serif;
}

/* Utilitários de cor e fundo baseados na marca */
.bg-jhap { background-color: var(--roxo-principal) !important; }
.text-jhap { color: var(--roxo-principal) !important; }
.text-roxo-jhap, .preco, .resultado-frete span, h2.fw-bold {
    color: var(--roxo-principal) !important;
}

/* ==========================================================================
   2. BARRA DE NAVEGAÇÃO (NAVBAR)
   ========================================================================== */

/* Estilização da Navbar principal com efeito de desfoque (Blur) */
.navbar-loja {
    background-color: rgba(149, 64, 197, 0.85) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1100;
    height: 80px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Link da logo na navbar */
.navbar-brand {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-right: 0;
    display: flex;
    align-items: center;
    height: 80px; 
}

/* Tamanho da imagem da logo na barra superior */
.navbar-brand img {
    height: 120px;
    width: auto;
    transition: transform 0.3s ease;
}

/* Ícones de Login e Carrinho */
.nav-icons-loja {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: 0.3s;
    white-space: nowrap;
}

.nav-icons-loja:hover { color: rgba(255,255,255,0.8); }

/* Conteúdo do Menu Lateral (Offcanvas) */
.nav-link-custom {
    color: white !important;
    padding: 1rem 1.5rem;
    display: block;
    text-decoration: none;
}
.nav-link-custom:hover { background-color: rgba(255, 255, 255, 0.1); }

/* Barra de pesquisa centralizada */
.busca-container {
    width: 100%;
    max-width: 500px;
}

.input-busca {
    border-radius: 25px;
    padding: 10px 20px;
    border: none;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Menu Dropdown do usuário (Yuri) */
.dropdown-item.active {
    background-color: var(--roxo-principal) !important;
    color: white !important;
}

.dropdown-menu {
    border-radius: 20px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.dropdown-item {
    border-radius: 12px;
    transition: 0.2s;
}

.dropdown-item:hover {
    background-color: #f3ebff;
    color: var(--roxo-principal);
}

/* ==========================================================================
   3. PÁGINA INICIAL (HOME) - BANNER E VITRINE
   ========================================================================== */

/* Banner Hero com efeito Parallax (imagem fixa ao fundo) */
.hero-full {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; 
    align-items: center;
    position: relative;
    padding-bottom: 80px; 
    background-image: url('/img/banner-desktop.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* Slogan centralizado no banner */
.hero-content {
    width: 100%;
    text-align: center;
}

.hero-content h1 {
    color: white;
    font-size: clamp(2rem, 5vw, 3.8rem);
    font-weight: 700;
    text-shadow: 0 4px 15px rgba(0,0,0,0.8);
    margin: 0;
    text-align: center;
}

/* Títulos das seções de produtos */
.titulo-secao {
    color: var(--roxo-principal);
    font-weight: 700;
    text-align: center;
    margin-bottom: 40px;
}

/* Estilo geral das setas e container do Swiper (Carrossel) */
.swiper {
    width: 100%;
    padding: 20px 10px 50px 10px !important;
}

.swiper-button-next, .swiper-button-prev {
    color: var(--roxo-principal) !important;
    transform: scale(0.7);
}

.swiper-produtos .swiper-slide {
    height: auto;
    display: flex;
}

/* Cards de produtos na vitrine */
.card-produto {
    background: white;
    border-radius: 25px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.card-produto:hover { transform: translateY(-5px); }

.img-produto-vitrine {
    width: 100%;
    height: 180px;
    object-fit: contain;
    margin-bottom: 10px;
}

/* Botões das marcas (fornecedores) */
.btn-marca {
    background: white;
    border: 2px solid transparent;
    border-radius: 20px;
    padding: 15px;
    width: 100%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-marca:hover {
    border-color: var(--roxo-principal);
    transform: translateY(-5px);
    background: #fdfaff;
}

.btn-marca img {
    max-height: 50px;
    width: auto;
    filter: grayscale(1);
    opacity: 0.7;
    transition: 0.3s;
}

.btn-marca:hover img {
    filter: grayscale(0);
    opacity: 1;
}

/* Botões de compra dentro dos cards da vitrine */
.btn-comprar, 
.card-produto .btn-secondary {
    height: 48px; 
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-weight: 600;
    margin-top: 15px;
    border: none;
    width: 100%;
    text-decoration: none;
    transition: 0.3s;
}

.btn-comprar {
    background-color: var(--roxo-principal);
    color: white !important;
}

.btn-comprar:hover {
    background-color: var(--roxo-secundario);
    transform: scale(1.02);
}

.card-produto .btn-secondary {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

.btn-comprar i {
    margin-right: 8px;
    font-size: 1.1rem;
}

/* Flag de produto esgotado (fita vermelha) */
.badge-esgotado {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%) rotate(-5deg);
    background-color: #FF4D4D;
    color: white;
    font-size: 0.7rem;
    padding: 5px 15px;
    border-radius: 10px;
    font-weight: 700;
    z-index: 5;
    white-space: nowrap;
}

/* ==========================================================================
   4. PÁGINA DE PRODUTO INDIVIDUAL (DETALHES)
   ========================================================================== */

/* Card de destaque para a imagem principal do produto */
.card-foto-principal {
    background-color: var(--branco) !important;
    border-radius: 35px !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.08) !important;
    height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Ajuste da imagem principal para ocupar 90% do card */
#main-img {
    width: 90%;  
    height: 90%; 
    object-fit: contain;
}

/* Miniaturas da galeria abaixo da foto principal */
.galeria-miniaturas {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.miniatura {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 20px; 
    padding: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: 0.3s;
    object-fit: contain;
}

.miniatura.active {
    border-color: var(--roxo-principal);
    transform: scale(1.05);
}

/* Container de botões de sabores (Variações) */
.variacao-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
}

/* Botões de seleção de sabor */
.chip-sabor {
    position: relative;
    background: white;
    border: 1.5px solid #ddd;
    border-radius: 12px;
    padding: 10px 20px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    transition: 0.3s;
    min-width: 90px;
    text-align: center;
}

.chip-sabor:hover { border-color: var(--roxo-principal); }
.chip-sabor.selected {
    background-color: var(--roxo-principal);
    color: white;
    border-color: var(--roxo-principal);
    box-shadow: 0 4px 12px rgba(149, 64, 197, 0.3);
}

/* Estado esgotado dos sabores individuais */
.chip-sabor.esgotado {
    background-color: #f5f5f5;
    color: #bbb;
    border-color: #eee;
    cursor: not-allowed;
    opacity: 0.8;
}

.chip-sabor.esgotado::after {
    content: "Esgotado";
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #FF4D4D;
    color: white;
    font-size: 0.55rem;
    padding: 1px 6px;
    border-radius: 5px;
    font-weight: 800;
}

/* Calculadora de frete integrada na página */
.frete-box {
    background: #F8F9FA;
    border-radius: 20px;
    padding: 25px;
    margin-top: 30px;
}

.btn-jhap-filled {
    background-color: var(--roxo-principal);
    color: white;
    border-radius: 20px;
    border: none;
    padding: 8px 25px;
    transition: 0.3s;
}

.btn-jhap-filled:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.frete-input-group { max-width: 350px; }

.resultado-frete {
    background: white;
    border-radius: 15px;
    padding: 15px;
    margin-top: 15px;
    border: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resultado-frete.active {
    border-color: var(--roxo-principal) !important;
    border-width: 2px !important;
    background-color: #fdfaff !important; /* Leve fundo roxo para indicar seleção */
}
/* Botão de "Acesse mais informações" */
.btn-info-link {
    background-color: var(--branco);
    color: var(--roxo-principal);
    border: none;
    border-radius: 12px;
    padding: 5px 15px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: 0.3s;
}

.btn-info-link:hover { background-color: #e2e2e2; }

/* Seletores de quantidade (Redondos e Coloridos) */
.btn-qtd {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: 0.3s;
}

.btn-qtd-menos { background-color: var(--azul-escuro); }
.btn-qtd-mais { background-color: var(--roxo-principal); }
.btn-qtd:hover { transform: scale(1.1); opacity: 0.9; }

/* Botões principais de ação da página de produto */
.btn-acao-produto {
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    font-weight: 600;
    transition: 0.3s;
}

.btn-comprar-prod {
    background-color: var(--roxo-principal);
    border: none;
    color: white;
}

.btn-add-carrinho-prod {
    border: 2px solid var(--roxo-principal);
    color: var(--roxo-principal);
}

.btn-add-carrinho-prod:hover {
    background-color: var(--roxo-principal);
    color: white;
}

/* Lógica de expansão da descrição ("Ver mais") */
.desc-container {
    position: relative;
    max-height: 100px; /* Começa fechado */
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.desc-container.expandido {
    max-height: 2000px; /* Abre totalmente */
}

.btn-ver-mais {
    color: var(--roxo-principal);
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    display: inline-block;
    margin-top: 5px;
}

/* ==========================================================================
   5. TELA DE CARRINHO E CHECKOUT
   ========================================================================== */

/* Fundo cinza para destaque dos cards brancos */
.bg-carrinho { background-color: #EEEEEE; min-height: 100vh; }

/* Cabeçalho da lista de itens no carrinho */
.card-header-cart {
    background: white;
    border-radius: 15px;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Item individual no carrinho */
.item-carrinho {
    background: white;
    border-radius: 25px;
    padding: 20px;
    display: flex;
    align-items: center;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* Ícone de remoção (Lixeira) */
.btn-remove-item {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #FF001B;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.3s;
}

/* Estilização da imagem dentro do carrinho */
.img-cart {
    width: 100px;
    height: 100px;
    object-fit: contain;
    background: #f9f9f9;
    border-radius: 15px;
    margin: 0 20px;
}

/* Checkbox circular oficial da loja */
.form-check-input {
    width: 22px;
    height: 22px;
    cursor: pointer;
    border: 2px solid #ddd;
}
.form-check-input:checked {
    background-color: var(--roxo-principal);
    border-color: var(--roxo-principal);
}

/* Botões +/- no carrinho */
.btn-qtd-cart {
    width: 30px;
    height: 30px;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: white;
    font-size: 1rem;
    transition: 0.2s;
}
.btn-menos { background-color: var(--azul-escuro); }
.btn-mais { background-color: var(--roxo-principal); }

/* Sidebar lateral de finalização de compra */
.checkout-card {
    background: white;
    border-radius: 30px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.checkout-card h5 {
    color: var(--roxo-principal);
    font-weight: 700;
    margin-bottom: 20px;
}

.input-entrega {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 0.9rem;
    width: 100%;
}

/* Exibição do endereço formatado */
.address-display {
    border: 1px solid #ddd;
    border-radius: 15px;
    padding: 12px 40px 12px 15px;
    font-size: 0.85rem;
    position: relative;
    margin-top: 15px;
    color: #444;
}

.icon-edit-address {
    position: absolute;
    right: 12px;
    bottom: 10px;
    color: var(--roxo-principal);
    cursor: pointer;
}

/* Opções de seleção de frete (SEDEX/PAC/Motoboy) */
.frete-sel {
    border: 1px solid #eee;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.3s;
}
.frete-sel.active { border: 2px solid #007BFF; }

/* Botão final de checkout */
.btn-finalizar-compra {
    background-color: var(--roxo-principal);
    color: white !important;
    width: 100%;
    padding: 15px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.3rem;
    border: none;
    transition: 0.3s;
    text-decoration: none;
    display: block;
    text-align: center;
}

.btn-finalizar-compra:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* --- ALERTA DE VOLUME EXCEDIDO --- */
.alerta-frete-limite {
    background-color: #FFF9E6;
    border: 1px solid #FFE58F;
    color: #856404;
    padding: 15px;
    border-radius: 15px;
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
}

.alerta-frete-limite i {
    font-size: 1.2rem;
    color: #FFB300;
}

/* ==========================================================================
   6. TELAS DE PERFIL E DETALHES DO PEDIDO
   ========================================================================== */

/* Estilo unificado para os cards brancos da área do cliente */
.card-jhap {
    background-color: #FFFFFF !important;
    border-radius: 35px !important;
    border: none !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05) !important;
}

/* Card superior de foto no detalhamento de um pedido realizado */
.card-foto-detalhe {
    background-color: #FFFFFF !important;
    border-radius: 35px !important;
    padding: 20px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
    border: none !important;
    width: 100%;
    display: flex;
    align-items: center;
}

/* Divisória interna que aparece apenas no celular */
.divisor-mobile {
    border-top: 1px solid #E0E0E0 !important;
    margin-top: 15px;
    padding-top: 15px;
}

/* Labels e Inputs da tela de perfil (edição de dados) */
.label-perfil {
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: 8px;
    display: block;
    color: #000;
}

.input-perfil-edit {
    background-color: #D9D9D9; 
    border: 2px solid transparent;
    border-radius: 15px;
    padding: 12px 20px;
    width: 100%;
    color: #333;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
}

.input-perfil-edit:not([readonly]) {
    background-color: #FFFFFF;
    border-color: var(--roxo-principal);
}

.btn-edit-info {
    background: transparent;
    border: none;
    font-weight: 600;
    font-size: 1.1rem;
    color: #000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.btn-edit-info:hover { color: var(--roxo-principal); }

/* Alertas de atualização na lista de pedidos */
.alerta-entrega {
    color: var(--roxo-principal);
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-mais-info {
    border: 1.5px solid #ddd;
    color: var(--roxo-principal);
    background: white;
    border-radius: 15px;
    padding: 8px 20px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: 0.3s;
    text-decoration: none;
}

/* Status final da entrega (Página de detalhe) */
.status-chegou {
    color: var(--roxo-principal);
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 15px;
}

/* ==========================================================================
   7. REGRAS DE RESPONSIVIDADE (MOBILE E TABLET)
   ========================================================================== */

/* Ajustes para telas médias e pequenas (Tablets e Celulares) */
@media (max-width: 991px) {
    .hero-full {
        background-image: url('/img/banner-mobile.png');
        background-attachment: fixed; 
        padding-bottom: 60px;
    }

    .navbar-loja { height: 110px !important; }

    /* Centralização da logo no mobile */
    .mobile-logo-wrapper {
            position: absolute;
            left: 50%;
            top: 0; /* 👈 Ajuste fino para subir a logo */
            transform: translateX(-50%);
            height: 60px;
            display: flex;
            align-items: center;
            z-index: 10;
        }

  .mobile-logo-wrapper img {
            height: 65px !important; /* Tamanho da logo no mobile */
        }

    /* Correção de vazamento lateral nas margens do Bootstrap */
    main.container {
        padding-left: 15px !important;
        padding-right: 15px !important;
        overflow-x: hidden;
    }

    .row.g-5 {
        --bs-gutter-x: 1rem;
        margin-right: 0;
        margin-left: 0;
    }

    .card-foto-principal { height: 350px; }
}

/* Regra para remover divisórias em telas grandes */
@media (min-width: 768px) {
    .divisor-mobile {
        border-top: none !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}

/* Ajustes para telas pequenas (Celulares) */
@media (max-width: 768px) {
    .img-produto-vitrine { height: 140px; }
    .card-produto { padding: 15px; }
}

/* Ajustes específicos para o card de detalhe do pedido e carrinho no celular */
@media (max-width: 576px) {
    .card-foto-detalhe {
        padding: 20px !important;
        flex-direction: column !important;
        text-align: center;
    }

    .card-foto-detalhe .row {
        flex-direction: column !important;
        gap: 15px;
    }

    .box-img-detalhe {
        width: 150px !important;
        height: 150px !important;
        margin: 0 auto;
    }

    .resumo-pagamento-container {
        border-top: 1px solid #eee;
        padding-top: 20px;
        margin-top: 20px;
    }

    .preco-linha {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
        font-size: 0.95rem;
    }

    .preco-linha.total {
        margin-top: 15px;
        padding-top: 15px;
        border-top: 2px dashed #ddd;
        font-size: 1.3rem;
        font-weight: 800;
        color: var(--roxo-principal);
    }

    /* Correção de preço estourando no card do carrinho */
    .item-carrinho {
        padding: 12px !important;
        gap: 8px !important;
        align-items: flex-start;
    }

    .img-cart {
        width: 65px !important;
        height: 65px !important;
        margin: 0 5px !important;
    }

    .item-carrinho h6 {
        font-size: 0.9rem !important;
        max-width: 140px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .item-carrinho h4 {
        font-size: 1.1rem !important;
        margin-top: 5px !important;
        white-space: nowrap;
    }

    .btn-remove-item {
        position: absolute !important;
        top: 10px !important;
        right: 10px !important;
        font-size: 1.1rem !important;
    }

    .item-carrinho .text-end {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        height: 70px;
    }

      /* Garante que o container de quantidade não quebre linha */
    .item-carrinho .d-flex.align-items-center {
        flex-wrap: nowrap !important;
    }

     /* Fixa o tamanho dos botões redondos para eles não "encolherem" */
    .btn-qtd-cart {
        width: 28px !important;
        height: 28px !important;
        flex-shrink: 0 !important; /* Impede que o botão seja esmagado */
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 1rem !important;
        padding: 0 !important;
    }

    /* Fixa a largura do campo de número */
    .input-estoque.border {
        width: 35px !important;
        height: 28px !important;
        font-size: 0.85rem !important;
        text-align: center;
        padding: 0 !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }
}