/**
 * FOLHA DE ESTILOS CUSTOMIZADA - KUGULA E-COMMERCE
 * Complementa o Bootstrap 5 com a identidade visual da plataforma,
 * Dark Mode, micro-interações e UI refinada.
 * Versão: 5.1 (Padronização 4:3 para todas as imagens de produtos)
 * Última atualização: Junho 2026
 */

/* =======================================================
   1. VARIÁVEIS GLOBAIS E TIPOGRAFIA
   ======================================================= */
:root {
    --kugula-primary: #F25A00;
    --kugula-primary-hover: #FF5500;
    --kugula-dark: #000000;
    --kugula-light-bg: #f8f9fa;
    --transition-speed: 0.3s;
    --border-radius-sm: 6px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --card-image-height: 170px;
    --card-image-height-mobile: 140px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #ffffff;
    color: #212529;
    line-height: 1.6;
    overflow-x: hidden;
}

/* =======================================================
   2. OVERRIDES DAS CORES KUGULA SOBRE O BOOTSTRAP
   ======================================================= */
.text-primary {
    color: var(--kugula-primary) !important;
}
.bg-primary {
    background-color: var(--kugula-primary) !important;
}
.border-primary {
    border-color: var(--kugula-primary) !important;
}

.btn-primary {
    background-color: var(--kugula-primary) !important;
    border-color: var(--kugula-primary) !important;
    color: #ffffff !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--kugula-primary-hover) !important;
    border-color: var(--kugula-primary-hover) !important;
    box-shadow: 0 0 0 0.25rem rgba(242, 90, 0, 0.3) !important;
}

.btn-outline-primary {
    color: var(--kugula-primary) !important;
    border-color: var(--kugula-primary) !important;
}
.btn-outline-primary:hover {
    background-color: var(--kugula-primary) !important;
    color: #ffffff !important;
}

/* =======================================================
   3. SCROLLBAR PERSONALIZADA
   ======================================================= */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--kugula-primary);
}

/* =======================================================
   4. IMAGENS DOS CARDS (PRODUTOS) – PADRÃO 4:3 EM TODAS AS TELAS
   ======================================================= */
.card-img-top,
.card img,
.card-hover-effect img,
.produto-card .card-img-top,
.produto-card img {
    width: 100%;
    height: auto;               /* mantém a proporção */
    aspect-ratio: 4 / 3;        /* formato 4:3 (rectângulo quase quadrado) */
    object-fit: contain;        /* mostra a imagem inteira, sem cortes */
    background-color: var(--kugula-light-bg);
    padding: 0.25rem;
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
}

/* Imagens da página de detalhe (carrossel) – também herdam o padrão */
#galeriaProduto .carousel-item img,
.detalhe-galeria img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background-color: var(--kugula-light-bg);
    padding: 0.25rem;
    border-radius: var(--border-radius-md);
}

/* Ajuste para imagens únicas (sem carrossel) na detalhe */
.detalhe-imagem-unica {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background-color: var(--kugula-light-bg);
    padding: 0.25rem;
    border-radius: var(--border-radius-md);
    cursor: pointer;
}

/* =======================================================
   5. CARDS – ARREDONDADOS, COM SOMBRA SUAVE
   ======================================================= */
.card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius-md) !important;
    overflow: hidden;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
}
.card-body {
    border-radius: 0 0 var(--border-radius-md) var(--border-radius-md);
}

/* =======================================================
   6. MICRO-INTERAÇÕES (HOVER E TRANSIÇÕES)
   ======================================================= */
.btn,
a,
.nav-link {
    transition: all var(--transition-speed) ease-in-out;
}

.cursor-pointer {
    cursor: pointer;
}

/* =======================================================
   7. BARRA DE PESQUISA E SUGESTÕES (REFINADO)
   ======================================================= */
#caixaSugestoes {
    max-height: 360px;
    overflow-y: auto;
    border-radius: 0 0 var(--border-radius-md) var(--border-radius-md);
    background-color: #1e1e1e !important;
    border: 1px solid #333;
    border-top: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    padding: 4px 0;
}

#caixaSugestoes .dropdown-item {
    padding: 6px 14px !important;
    font-size: 0.85rem !important;
    color: #f0f0f0 !important;
    background-color: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
}
#caixaSugestoes .dropdown-item:last-child {
    border-bottom: none !important;
}

#caixaSugestoes .dropdown-item:hover {
    background-color: #2c2c2c !important;
    color: #ffffff !important;
}

#caixaSugestoes .dropdown-item img {
    width: 36px !important;
    height: 36px !important;
    object-fit: cover !important;
    border-radius: var(--border-radius-sm);
    background-color: #2a2a2a;
    flex-shrink: 0;
}

#caixaSugestoes .dropdown-item h6 {
    font-size: 0.85rem !important;
    margin-bottom: 0 !important;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#caixaSugestoes .dropdown-item .text-muted {
    color: #a0a0a0 !important;
    font-size: 0.75rem !important;
}
#caixaSugestoes .dropdown-item .text-muted strong {
    color: var(--kugula-primary) !important;
}

#caixaSugestoes .dropdown-item:hover .text-muted {
    color: #d0d0d0 !important;
}

/* Botão "Ver todos os resultados" */
#caixaSugestoes .dropdown-item:last-child {
    background-color: var(--kugula-primary) !important;
    color: #fff !important;
    font-weight: 700;
    text-align: center;
    justify-content: center;
    border-radius: 0 0 var(--border-radius-md) var(--border-radius-md);
    padding: 10px !important;
    font-size: 0.9rem !important;
}
#caixaSugestoes .dropdown-item:last-child:hover {
    background-color: var(--kugula-primary-hover) !important;
    color: #fff !important;
}

#caixaSugestoes::-webkit-scrollbar {
    width: 4px;
}
#caixaSugestoes::-webkit-scrollbar-track {
    background: #1e1e1e;
}
#caixaSugestoes::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 10px;
}
#caixaSugestoes::-webkit-scrollbar-thumb:hover {
    background: var(--kugula-primary);
}

/* =======================================================
   8. DARK MODE (MODO ESCURO)
   ======================================================= */
body.dark-mode {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}
body.dark-mode .bg-light,
body.dark-mode .bg-white {
    background-color: #1a1a1a !important;
}
body.dark-mode .card {
    background-color: #1a1a1a !important;
    border-color: #2a2a2a !important;
}
body.dark-mode .text-dark {
    color: #f0f0f0 !important;
}
body.dark-mode .text-muted {
    color: #999 !important;
}
body.dark-mode .border,
body.dark-mode .border-bottom,
body.dark-mode .border-top,
body.dark-mode .border-end {
    border-color: #2a2a2a !important;
}
body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #222 !important;
    border-color: #333 !important;
    color: #f0f0f0 !important;
}
body.dark-mode .form-control:focus {
    background-color: #2a2a2a !important;
    border-color: var(--kugula-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(242, 90, 0, 0.2) !important;
}
body.dark-mode .table {
    color: #e0e0e0;
}
body.dark-mode .table-light {
    background-color: #222 !important;
}
body.dark-mode .table-light th {
    background-color: #2a2a2a !important;
    color: #e0e0e0 !important;
}
body.dark-mode .table-hover tbody tr:hover {
    background-color: #2a2a2a !important;
    color: #fff;
}
body.dark-mode .card-img-top,
body.dark-mode .card img {
    background-color: #222 !important;
}
body.dark-mode #caixaSugestoes {
    background-color: #1a1a1a !important;
    border-color: #333 !important;
}
body.dark-mode #caixaSugestoes .dropdown-item {
    color: #e0e0e0 !important;
}
body.dark-mode #caixaSugestoes .dropdown-item:hover {
    background-color: #2a2a2a !important;
}
body.dark-mode #caixaSugestoes .dropdown-item .text-muted {
    color: #888 !important;
}
body.dark-mode .lojista-page .lojista-card .card-body {
    background-color: #1a1a1a !important;
}
body.dark-mode .lojista-page .lojista-card .card-body .badge.bg-light {
    background-color: #2a2a2a !important;
    color: #e0e0e0 !important;
}
body.dark-mode .lojista-logo-wrapper {
    background: #1a1a1a !important;
}
body.dark-mode .logo-placeholder {
    background: #2a2a2a !important;
    color: #666 !important;
}

/* =======================================================
   9. COMPONENTES ESPECÍFICOS E RESPONSIVIDADE
   ======================================================= */
.bg-primary.text-white {
    box-shadow: 0 2px 8px rgba(242, 90, 0, 0.3);
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #999;
}

.badge.bg-warning.text-dark {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.card .form-check-label {
    font-weight: 400;
}
.card .form-check-input:checked {
    background-color: var(--kugula-primary);
    border-color: var(--kugula-primary);
}

/* =======================================================
   10. UTILITÁRIOS ADICIONAIS
   ======================================================= */
.shadow-hover {
    transition: box-shadow var(--transition-speed) ease;
}
.shadow-hover:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12) !important;
}

.rounded-4 {
    border-radius: var(--border-radius-lg) !important;
}
.rounded-3 {
    border-radius: var(--border-radius-md) !important;
}
.rounded-2 {
    border-radius: var(--border-radius-sm) !important;
}

a.text-dark:hover {
    color: var(--kugula-primary) !important;
}

footer a.text-muted:hover {
    color: var(--kugula-primary) !important;
}

/* =======================================================
   11. CORREÇÃO DE BADGES (base)
   ======================================================= */
.badge {
    text-transform: none !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
}

/* Badges de status (NOVO, REPOSTO, ESGOTADO, etc.) */
.badge.bg-primary,
.badge.bg-success,
.badge.bg-danger,
.badge.bg-warning {
    font-size: 0.6rem !important;
    padding: 0.2rem 0.5rem !important;
    line-height: 1.2 !important;
}

/* =======================================================
   12. BADGES DINÂMICOS – ORGANIZAÇÃO AUTOMATIZADA
   ======================================================= */

/* CONTAINER DO LADO ESQUERDO (status) */
.badge-container-left {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px;
    pointer-events: none;
    max-width: 70%;
}

/* CONTAINER DO LADO DIREITO (classificação + desconto) */
.badge-container-right {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 4px;
    pointer-events: none;
    max-width: 60%;
}

/* Badge de classificação (⭐ 4.5) */
.rating-badge {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
    white-space: nowrap;
}
.rating-badge .star {
    color: #ffc107;
    font-size: 0.75rem;
    line-height: 1;
}
.rating-badge .total {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.55rem;
    margin-left: 1px;
}

/* Badge de desconto (-X%) */
.discount-badge {
    background: #dc3545;
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
    white-space: nowrap;
}

/* Badges de status (NOVO, REPOSTO, ESGOTADO, etc.) - classe auxiliar */
.badge-status {
    font-size: 0.6rem !important;
    padding: 0.2rem 0.5rem !important;
    line-height: 1.2 !important;
    font-weight: 600 !important;
    text-transform: none !important;
    white-space: nowrap !important;
}

/* Selo de verificação (ícone) */
.badge-verified {
    background: transparent !important;
    padding: 0 !important;
    font-size: 1.2rem !important;
    color: #28a745 !important;
    text-shadow: 0 0 4px rgba(0,0,0,0.3) !important;
    line-height: 1 !important;
}

/* =======================================================
   13. RESPONSIVIDADE DOS BADGES
   ======================================================= */
@media (max-width: 575.98px) {
    .badge-container-left {
        top: 4px;
        left: 4px;
        gap: 3px;
        max-width: 75%;
    }
    .badge-container-right {
        top: 4px;
        right: 4px;
        gap: 3px;
        max-width: 70%;
    }
    .rating-badge {
        font-size: 0.6rem;
        padding: 1px 6px;
    }
    .rating-badge .star {
        font-size: 0.65rem;
    }
    .rating-badge .total {
        font-size: 0.5rem;
    }
    .discount-badge {
        font-size: 0.6rem;
        padding: 1px 6px;
    }
    .badge-status {
        font-size: 0.5rem !important;
        padding: 0.15rem 0.4rem !important;
    }
    .badge-verified {
        font-size: 1rem !important;
    }
}

/* =======================================================
   14. PÁGINA DO LOJISTA – DESIGN SÓLIDO (LOGO FLUTUANTE)
   ======================================================= */

/* Fundo da página */
.lojista-page {
    background-color: #f4f6f8 !important;
    padding-bottom: 2rem;
}

/* O card principal blindado */
.lojista-page .lojista-card {
    margin-top: 0 !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
    border-radius: var(--border-radius-md) !important;
    overflow: hidden !important;
    background: #ffffff;
}

/* Banner */
.lojista-banner-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
    background: linear-gradient(135deg, var(--kugula-primary), #000000);
    overflow: hidden;
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
}

.lojista-banner-wrapper .banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
}

/* Card-body com flex para logo + informações */
.lojista-page .lojista-card .card-body {
    padding: 1.5rem 1.5rem 1.5rem 1.5rem !important;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    background-color: #ffffff;
    border-radius: 0 0 var(--border-radius-md) var(--border-radius-md);
}

/* Logo flutuante (metade no banner, metade no card) */
.lojista-logo-wrapper {
    flex: 0 0 110px;
    width: 110px;
    height: 110px;
    margin-top: -70px;          /* sobe para sobrepor a borda do banner */
    border-radius: 50%;
    background: #ffffff;
    padding: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    z-index: 5;
    position: relative;
}

.lojista-logo-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.logo-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #aaa;
}

/* Container das informações (texto + botões) */
.lojista-info-wrapper {
    flex: 1 1 0;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Responsividade do cabeçalho do lojista */
@media (max-width: 767.98px) {
    .lojista-banner-wrapper {
        height: 160px;
    }

    .lojista-page .lojista-card .card-body {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.5rem 1rem !important;
    }

    .lojista-logo-wrapper {
        flex: 0 0 85px;
        width: 85px;
        height: 85px;
        margin-top: -55px;
    }

    .lojista-info-wrapper {
        align-items: center;
        text-align: center;
    }

    .lojista-info-wrapper .d-flex {
        justify-content: center !important;
    }
}

/* =======================================================
   15. RESPONSIVIDADE – MOBILE E TABLET
   ======================================================= */
@media (max-width: 767.98px) {
    .navbar-nav {
        flex-direction: row !important;
        justify-content: center;
        gap: 10px;
        padding-top: 8px;
    }
    #pesquisaDinamica {
        border-radius: var(--border-radius-sm);
        margin-bottom: 0.5rem;
    }
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    #caixaSugestoes {
        max-height: 280px;
        top: calc(100% + 2px) !important;
        left: 0 !important;
        width: 100% !important;
    }
    #caixaSugestoes .dropdown-item {
        padding: 5px 12px !important;
        font-size: 0.8rem !important;
        min-height: 40px;
    }
    #caixaSugestoes .dropdown-item img {
        width: 30px !important;
        height: 30px !important;
    }
    #caixaSugestoes .dropdown-item h6 {
        font-size: 0.8rem !important;
        margin-bottom: 0 !important;
        font-weight: 600;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #caixaSugestoes .dropdown-item .text-muted {
        color: #a0a0a0 !important;
        font-size: 0.75rem !important;
    }
    #caixaSugestoes .dropdown-item .text-muted strong {
        color: var(--kugula-primary) !important;
    }

    #caixaSugestoes .dropdown-item:hover .text-muted {
        color: #d0d0d0 !important;
    }

    /* Botão "Ver todos os resultados" */
    #caixaSugestoes .dropdown-item:last-child {
        background-color: var(--kugula-primary) !important;
        color: #fff !important;
        font-weight: 700;
        text-align: center;
        justify-content: center;
        border-radius: 0 0 var(--border-radius-md) var(--border-radius-md);
        padding: 10px !important;
        font-size: 0.9rem !important;
    }
    #caixaSugestoes .dropdown-item:last-child:hover {
        background-color: var(--kugula-primary-hover) !important;
        color: #fff !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    #caixaSugestoes {
        max-height: 320px;
    }
}

/* =======================================================
   16. PÁGINA DE DETALHES – AJUSTES ADICIONAIS
   ======================================================= */
/* A imagem única (sem carrossel) já está coberta pela regra .detalhe-imagem-unica */
/* O carrossel também já está coberto pela regra #galeriaProduto .carousel-item img */
/* Garantir que o fundo da galeria seja claro */
#galeriaProduto .carousel-item {
    background: var(--kugula-light-bg);
    text-align: center;
}
#galeriaProduto .carousel-item img {
    display: block;
    margin: 0 auto;
}

/* =======================================================
   17. LIGHTBOX – EXPANSÃO DE IMAGENS (modal)
   ======================================================= */
#modalImagem .modal-dialog {
    max-width: 95vw;
    margin: 0 auto;
}
#modalImagem .modal-content {
    background: transparent !important;
    border: none !important;
}
#modalImagem .btn-close-white {
    z-index: 20;
}
#modalImagem img {
    max-height: 90vh;
    width: 100%;
    object-fit: contain;
    background-color: #000;
    border-radius: var(--border-radius-md);
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
}