/* =========================================
   1. VARIÁVEIS E RESET GLOBAL — Conheciência
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* PALETA — visual moderno e limpo */
    --blue-navy: #0f172a;
    --blue-primary: #2563eb;
    --blue-hover: #1d4ed8;
    --blue-light: #eff6ff;
    --red-alert: #ef4444;
    --green-success: #10b981;
    --bg-body: #f1f5f9;
    --white: #ffffff;
    --gray-border: #e2e8f0;
    --text-gray: #64748b;
    --text-dark: #0f172a;

    /* Bordas mais suaves (visual moderno) */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Marca Conheciência */
.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    font-weight: 800;
    background: var(--blue-navy);
    color: var(--white);
    border-radius: 50%;
    margin-right: 0.5rem;
    letter-spacing: -0.02em;
}
.logo-mark-inline {
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.site-title { letter-spacing: -0.02em; }
.brand-link { transition: opacity 0.2s, transform 0.2s; text-decoration: none !important; }
.brand-link:hover { opacity: 0.9; }
.footer-tagline { font-size: 0.75rem; opacity: 0.9; }

/* Botão painel Admin — único padrão visual (como no index) */
.btn-admin-panel {
    border-radius: 6px;
    text-decoration: none !important;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

ul {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* Container Centralizado */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* =========================================
   2. HEADER E NAVEGAÇÃO
   ========================================= */
.top-bar {
    background-color: var(--blue-navy);
    color: var(--white);
    font-size: 0.75rem;
    text-align: center;
    padding: 8px 0;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.main-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
    backdrop-filter: saturate(180%) blur(8px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Tablet: manter pesquisa e botões (Pedidos, Carrinho) na mesma linha */
@media (min-width: 768px) {
    .header-actions-row {
        flex-wrap: nowrap;
    }
    .header-nav-col {
        min-width: 0; /* permite flex shrink se necessário */
    }
}

/* Logo */
.brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-circle {
    width: 45px;
    height: 45px;
    background: var(--blue-navy);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 1.2rem;
}

.titles h1 {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--blue-navy);
}

/* Busca e Categorias */
.search-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 600px;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.filter-trigger {
    background: var(--blue-navy);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    padding: 0 20px;
    height: 45px;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

#search-input {
    flex: 1;
    height: 45px;
    border: 2px solid var(--blue-navy);
    padding: 0 16px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#search-input:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}
.form-control:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

#search-btn {
    background: var(--blue-primary);
    color: var(--white);
    border: none;
    height: 45px;
    width: 50px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 1rem;
    transition: background 0.2s, transform 0.2s;
}

#search-btn:hover {
    background: var(--blue-hover);
}

/* Menu Dropdown */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-top: 3px solid var(--blue-navy);
    width: 250px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 5px 0;
}

.dropdown-menu.show {
    display: block;
    animation: slideDown 0.2s ease;
}

/* Mobile: dropdown de categorias com scroll para não ficar atrás do footer */
@media (max-width: 767.98px) {
    .main-header .dropdown-menu {
        max-height: min(70vh, 400px);
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        scrollbar-width: thin;
        -ms-overflow-style: none;
    }
    .main-header .dropdown-menu::-webkit-scrollbar {
        width: 6px;
    }
    .main-header .dropdown-menu::-webkit-scrollbar-track {
        background: var(--gray-border);
        border-radius: 3px;
    }
    .main-header .dropdown-menu::-webkit-scrollbar-thumb {
        background: var(--blue-navy);
        border-radius: 3px;
    }
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--blue-navy);
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-item:hover {
    background: var(--blue-light);
    color: var(--blue-primary);
    padding-left: 25px;
}

.dropdown-item.active {
    background: var(--blue-light);
    font-weight: bold;
}

/* Ações do Usuário */
.nav-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.btn-header-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--blue-navy);
}

.cart-icon-container {
    position: relative;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--blue-navy);
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--red-alert);
    color: var(--white);
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================
   3. PRODUTOS (CARDS)
   ========================================= */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
    padding-bottom: 50px;
}

.product-card {
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.2s;
    box-shadow: var(--shadow-card);
}

.product-card:hover {
    transform: translateY(-6px);
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: var(--shadow-lg);
}

.offer-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--red-alert);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    z-index: 10;
    pointer-events: none;
}

.product-image {
    width: 100%;
    height: 200px;
    background: #f1f5f9;
    position: relative;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
}

.card-body h3 {
    font-size: 1rem;
    color: var(--blue-navy);
    margin: 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
}

.card-body h3:hover {
    color: var(--blue-primary);
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 15px;
}

.price-old {
    text-decoration: line-through;
    color: #94a3b8;
    font-size: 0.85rem;
}

.price-new {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--blue-navy);
}

/* Botões Universais — visual moderno */
.btn-buy,
.btn-primary {
    background: var(--blue-primary);
    color: var(--white);
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.btn-buy { width: 100%; text-transform: uppercase; letter-spacing: 0.5px; }

.btn-buy:hover,
.btn-primary:hover {
    background: var(--blue-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-buy:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.btn-full {
    width: 100%;
    padding: 15px;
}

/* =========================================
   4. MODAIS (GERAL)
   ========================================= */
.modal-overlay,
.cart-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    z-index: 2000;
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

/* Modal Carrinho (Slide) */
.cart-modal-overlay {
    justify-content: flex-end;
}

.cart-modal {
    background: var(--white);
    width: 100%;
    max-width: 420px;
    height: 100%;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.3s ease;
}

/* Modal Produto / Sugestão (Pop-up) */
.modal-content {
    background: var(--white);
    width: 90%;
    max-width: 900px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    animation: zoomIn 0.3s ease;
    border: 1px solid var(--gray-border);
}

/* Grid do Modal de Detalhes */
.modal-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}

.modal-image-container {
    background: #f1f5f9;
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.modal-image-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.modal-info {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-tag {
    background: var(--blue-light);
    color: var(--blue-primary);
    padding: 5px 12px;
    border-radius: 6px;
    font-weight: 700;
    align-self: flex-start;
    margin-bottom: 10px;
    font-size: 0.8rem;
}

.modal-info h2 {
    font-size: 1.8rem;
    line-height: 1.2;
    margin-bottom: 15px;
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--white);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 1px solid var(--gray-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
}

.close-modal-btn:hover {
    color: var(--red-alert);
    border-color: var(--red-alert);
}

/* =========================================
   5. FORMULÁRIOS E AUTH (LOGIN/CADASTRO)
   ========================================= */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.auth-box {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: #f8fafc;
}

.form-group input:focus {
    border-color: var(--blue-primary);
    background: var(--white);
}

/* =========================================
   6. ADMIN (Tabelas e Listas)
   ========================================= */
.admin-wrapper {
    max-width: 900px;
    margin: 30px auto;
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.product-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 35px;
    height: 35px;
    border-radius: 6px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.edit-btn {
    background: var(--blue-light);
    color: var(--blue-primary);
}

.edit-btn:hover {
    background: var(--blue-navy);
    color: var(--white);
}

.delete-btn {
    background: #fee2e2;
    color: var(--red-alert);
}

.delete-btn:hover {
    background: var(--red-alert);
    color: var(--white);
}

/* Checkbox Grid (Categorias) */
.category-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    background: #f8fafc;
    padding: 15px;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

/* =========================================
   7. FOOTER E MOBILE (ATUALIZADO)
   ========================================= */
.main-footer {
    background: var(--white);
    padding: 30px;
    text-align: center;
    margin-top: auto;
    border-top: 1px solid var(--gray-border);
    font-size: 0.85rem;
}

/* O Bootstrap cuida do posicionamento (fixed-bottom), 
   aqui cuidamos apenas da beleza dos ícones */
.nav-item-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    /* Letra pequena */
    color: #64748b;
    /* Cinza inativo */
    text-decoration: none !important;
    transition: color 0.2s;
}

.nav-item-mobile:hover {
    color: var(--blue-navy);
}

.nav-item-mobile.active {
    color: var(--blue-primary);
    font-weight: 700;
}

/* Input group da busca — cantos arredondados no dropdown */
.input-group .btn.dropdown-toggle {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

/* Modal de Sugestão (Centralizado) */
#suggestion-modal .modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    /* Largura máxima */
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: zoomIn 0.3s ease;
    text-align: center;
}

/* ========================================= */
/* AJUSTES MOBILE: CATEGORIAS E MODAL        */
/* ========================================= */

/* Scroll horizontal de categorias no mobile — suave, barra escondida */
.categories-scroll-mobile {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.categories-scroll-mobile::-webkit-scrollbar {
    display: none;
}
.categories-scroll-item {
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Badges de categoria nos cards (clicáveis, tamanho/alinhamento padronizados) */
.product-category-badge {
    display: inline-block;
    font-size: 0.75rem !important;
    text-align: center;
    transition: background-color 0.2s, color 0.2s;
}
.product-category-badge:hover {
    background-color: var(--blue-light) !important;
    color: var(--blue-primary) !important;
}

/* ========================================= */
/* FIX ESTRUTURAL DO MODAL CUSTOMIZADO (MOBILE) */
/* ========================================= */
@media (max-width: 768px) {
    /* 1. Muta o container pai para flex column */
    .modal-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important; /* Espaçamento entre a foto e o texto */
    }

    /* 2. Força os nós filhos a ocuparem 100% do viewport interno */
    .modal-image-container,
    .modal-info {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        padding: 0 !important;
    }

    /* 3. Ajusta o contêiner da imagem para não explodir a altura da tela */
    .modal-image-container {
        min-height: 250px !important;
        height: auto !important;
        background: transparent !important;
    }

    /* 4. Trava as dimensões do node da imagem para aspect-ratio correto */
    #pm-img {
        width: 100% !important;
        max-height: 250px !important;
        object-fit: contain !important; /* Impede a distorção do *box model* */
    }

    /* 5. Ajustes de tipografia e botões para UX Mobile */
    .modal-info {
        display: flex;
        flex-direction: column;
        align-items: center; /* Centraliza o conteúdo textual */
        text-align: center;
    }

    #pm-desc {
        text-align: justify;
        margin: 15px;
    }

    /* Ajuste fino do botão de fechar */
    .close-modal-btn {
        top: 10px !important;
        right: 15px !important;
        z-index: 1050 !important;
    }
}

/* Animação de entrada suave */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Garante espaço no final da página para o menu não tapar o conteúdo */
@media (max-width: 768px) {
    body {
        padding-bottom: 70px;
    }

    .main-footer {
        padding-bottom: 90px;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}
/* Força a barra de pesquisa inteira a ter a mesma altura */
#search-input, 
#search-btn {
    height: 45px; /* Você pode aumentar ou diminuir esse valor para deixar a barra mais gordinha ou fina */
    padding-top: 0;
    padding-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ajusta as bordas para não ficarem duplicadas ou quebradas no meio */
#search-btn {
    border-top-right-radius: 6px !important;
    border-bottom-right-radius: 6px !important;
}

/* =========================================
   Cookies Consent (LGPD) — banner fixo
   ========================================= */
.cookie-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    background: rgba(15, 23, 42, 0.92);
    color: #ffffff;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px) saturate(160%);
    padding: 14px 16px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.cookie-consent-banner--hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.cookie-consent-banner .cc-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.cookie-consent-banner .cc-title {
    font-weight: 900;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.cookie-consent-banner .cc-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.86);
    line-height: 1.35;
}

.cookie-consent-banner .cc-mini-links {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cookie-consent-banner .cc-link {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.cookie-consent-banner .cc-sep {
    opacity: 0.35;
}

.cookie-consent-banner .cc-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cookie-consent-banner .cc-btn {
    border-radius: 999px;
    padding: 9px 14px;
    font-weight: 900;
    font-size: 0.86rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.cookie-consent-banner .cc-btn-accept {
    background: #2563eb;
    border-color: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

.cookie-consent-banner .cc-btn-accept:hover {
    background: #1d4ed8;
}

.cookie-consent-banner .cc-btn-understand {
    background: transparent;
    color: #fff;
}

.cookie-consent-banner .cc-btn-understand:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.cookie-consent-visible {
    padding-bottom: 110px !important;
}

@media (max-width: 767.98px) {
    .cookie-consent-banner .cc-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .cookie-consent-banner .cc-actions {
        width: 100%;
        justify-content: flex-start;
    }

    body.cookie-consent-visible {
        padding-bottom: 160px !important;
    }
}