/* ==========================================================================
   1. FONTES E VARIÁVEIS GLOBAIS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@200&family=Chivo:wght@300&display=swap');

@font-face {
    font-family: '--font-corpo';
    src: url("../fonts/JosefinSans-ExtraLight.89ff54970666.ttf") format('opentype');
}
@font-face {
    font-family: '--font-logo';
    src: url("../fonts/Vanitas-Bold.8f9ee86d31ed.otf") format('opentype');
}
@font-face {
    font-family: '--font-valor';
    src: url("../fonts/Chivo-Light.835a07fa0086.ttf") format('opentype');
}

:root {
    --font-family-corpo: --font-corpo, sans-serif;
    --font-family-logo: --font-logo, sans-serif;
    --font-family-valor: --font-valor, sans-serif;

    --font-size-logo: 2.5rem;
    --font-size-biggest: 1.6rem;
    --font-size-big: 1.2rem;
    --font-size-normal: 1rem;
    --font-size-small: 0.8rem;

    --color-background-light: #ffffff;
    --color-background-secondary: #f4f4f4;
    --color-text-primary: #1c1c1c;
    --color-text-secondary: #555555;
    --color-border: #eeeeee;
    --color-text: #333333;
    --color-primary: #dad9d6;
    --color-white: #ffffff;
    
    --shadow-color: rgba(0, 0, 0, 0.08);

    /* Variáveis do App Admin (Sidebar Reestruturada) */
    --sidebar-width-collapsed: 70px;
    --sidebar-width-expanded: 260px;
    --sidebar-bg-color: #f7f7f7;
    --sidebar-text-color: #1c1c1c;
    --sidebar-hover-color: #e9e9e9;
    --sidebar-border-color: #dddddd;
    --header-height: 70px;
}

/* ==========================================================================
   2. ESTILOS BASE (BODY)
   ========================================================================== */

body {
    margin: 0;
    padding-top: 0;
    font-family: var(--font-family-corpo);
    background-color: #f4f7f6;
}

/* ==========================================================================
   3. SITE PÚBLICO: HEADER E NAVEGAÇÃO PRINCIPAL (MANTIDO)
   ========================================================================== */

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--color-background-light);
    box-shadow: 0 2px 5px var(--shadow-color);
    z-index: 1000;
    padding: 0;
}

.main-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    height: 100px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-left .nav-menu {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2.5rem;
}

.nav-left a {
    text-decoration: none;
    color: var(--color-text-primary);
    font-size: var(--font-size-normal);
    letter-spacing: 0.5px;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: var(--font-size-biggest);
    color: var(--color-text-primary);
    cursor: pointer;
    z-index: 1002;
}

.nav-center {
    text-align: center;
}

.logo-text {
    font-family: var(--font-family-logo);
    font-size: var(--font-size-logo);
    font-weight: 400;
    letter-spacing: 5px;
    text-decoration: none;
    color: var(--color-text-primary);
}

.nav-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.nav-right a {
    color: var(--color-text-primary);
    font-size: var(--font-size-biggest);
}

.dropdown {
    position: relative;
}

.dropdown .fa-chevron-down {
    font-size: var(--font-size-small);
    margin-left: 5px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--color-background-light);
    list-style: none;
    padding: 1rem;
    margin: 0;
    border-radius: 4px;
    box-shadow: 0 4px 12px var(--shadow-color);
    width: 220px;
    z-index: 1001;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu li {
    padding: 0.5rem 0;
}

.nav-left .nav-menu a,
.nav-right a {
    transition: transform 0.2s ease-in-out;
    display: inline-block;
}

.cart-container {
    position: relative;
    display: inline-block;
    color: var(--color-text-primary);
    transition: transform 0.2s ease-in-out;
}

.cart-item-count {
    position: absolute;
    top: 0px;
    right: -5px;
    background-color: var(--color-primary);
    color: var(--color-white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    display: none;
    justify-content: center;
    align-items: center;
    line-height: 20px;
}

header .cart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    line-height: 0;
    padding: 0;
}

header .cart-container svg {
    display: block;
    width: 35px;
    height: 35px;
}

.main-nav .dropdown-toggle::after {
    display: none !important;
}

/* ==========================================================================
   4. APP ADMIN: LAYOUT E SIDEBAR (REESTRUTURADO)
   ========================================================================== */

.app-container {
    display: grid;
    grid-template-columns: var(--sidebar-width-collapsed) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    height: 100vh;
    transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-container.sidebar-expanded {
    grid-template-columns: var(--sidebar-width-expanded) 1fr;
}

.app-header {
    grid-area: header;
    height: var(--header-height);
    background-color: #ffffff;
    border-bottom: 1px solid var(--sidebar-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.app-logo {
    max-height: 45px; /* Correção para não quebrar o layout */
    width: auto;
}

.main-content {
    grid-area: main;
    padding: 2rem;
    overflow-y: auto;
    background-color: #f4f7f6;
}

.app-sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Hamburger Toggle no topo da Sidebar */
.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--sidebar-text-color);
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    border-bottom: 1px solid var(--sidebar-border-color);
}

.sidebar-toggle-btn:hover {
    background-color: var(--sidebar-hover-color);
}

.sidebar-header {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar-logo-icon img {
    height: 35px;
    width: 35px;
    object-fit: contain;
}

.sidebar-logo-text {
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: bold;
    white-space: nowrap;
    display: none;
}

.app-container.sidebar-expanded .sidebar-logo-text {
    display: block;
}

.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
    list-style: none !important;
    padding-left: 0 !important;
}

.py-2 {
    margin-bottom: 1rem !important;
}

/* Lógica de Grupos e Sanfona (Acordeão) */
.nav-group-header {
    display: flex;
    align-items: center;
    padding: 12px 0;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--sidebar-text-color);
}

.nav-group-header:hover {
    background-color: var(--sidebar-hover-color);
}

.nav-icon {
    min-width: var(--sidebar-width-collapsed);
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-text {
    flex-grow: 1;
    white-space: nowrap;
    display: none;
}

.app-container.sidebar-expanded .nav-text {
    display: inline-block;
}

.group-arrow {
    margin-right: 15px;
    transition: transform 0.3s ease;
    display: none;
}

.app-container.sidebar-expanded .group-arrow {
    display: block;
}

.nav-group.open .group-arrow {
    transform: rotate(180deg);
}

.nav-group-content {
    list-style: none;
    padding: 0;
    background-color: rgba(0,0,0,0.03);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.nav-group.open .nav-group-content {
    max-height: 500px; /* Expande o submenu */
}

.nav-group-content .nav-link {
    padding: 10px 0 10px 70px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: background 0.2s, color 0.2s;
}

.nav-group-content .nav-link .nav-text {
    padding-left: 70px !important;
    display: inline-block;
}

/* Itens de nível único (Dashboard) */
.nav-item .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 0;
    color: var(--sidebar-text-color);
    text-decoration: none;
    transition: background 0.2s;
}

.nav-item.active > .nav-link, .nav-item .nav-link:hover {
    background-color: var(--sidebar-hover-color);
}

/* Footer da Sidebar */
.sidebar-footer {
    padding: 15px 0;
    border-top: 1px solid var(--sidebar-border-color);
    background-color: var(--sidebar-bg-color);
}

.user-info {
    display: flex;
    align-items: center;
    padding: 5px 0;
}

#logout-button {
    background: none;
    border: none;
    width: 100%;
    display: flex;
    align-items: center;
    color: #e74c3c;
    padding: 10px 0;
    cursor: pointer;
    transition: background 0.3s;
}

#logout-button:hover { background-color: #fee2e2; }

.logout-text {
    display: none;
    font-size: 1rem;
    font-weight: 500;
}

.app-container.sidebar-expanded .logout-text {
    display: inline-block;
    margin-left: 15px;
}

.app-container:not(.sidebar-expanded) .logout-text,
.app-container:not(.sidebar-expanded) .nav-text {
    display: none;
}

.app-container.sidebar-expanded #logout-button {
    background-color: #fee2e2;
    color: #dc2626;
    border-radius: 8px;
    width: calc(100% - 20px);
    margin: 0 10px;
    justify-content: center;
}

/* ==========================================================================
   5. COMPONENTES E UTILITÁRIOS (APP ADMIN)
   ========================================================================== */

.fade-in { animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.spinner-border { width: 3rem; height: 3rem; }

/* Notificações */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.notification {
    background-color: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ==========================================================================
   6. SITE PÚBLICO: RODAPÉ (FOOTER) - (MANTIDO)
   ========================================================================== */

footer {
    background-color: #fdfdfd;
    border-top: 1px solid #eee;
    color: var(--color-text-secondary);
}

.container-footer {
    width: 90%;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 2fr 2fr 1fr;
    gap: 2rem;
    padding: 0;
    margin: 2rem 0 2rem 0;
}

.footer-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-logo img {
    max-width: 120px;
}

.footer-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.footer-col h4 {
    font-weight: 700;
    font-size: var(--font-size-small);
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 1rem 0;
}

.footer-col a {
    text-decoration: none;
    color: var(--color-text-secondary);
    transition: color 0.2s;
}

.footer-col a:hover {
    color: var(--color-primary); 
}

.footer-col p {
    margin: 0.25rem auto 0.25rem auto;
}

.newsletter-form {
    display: flex;
    align-items: center;
}

.newsletter-form input {
    border: none;
    border-bottom: 1px solid var(--color-text-primary);
    background-color: transparent;
    padding: 0.5rem 0;
    width: 70%;
}

.newsletter-form input:focus {
    outline: none;
    border-bottom-color: var(--color-primary);
}

.newsletter-form button {
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    margin-left: 1rem;
    color: var(--color-text-primary);
    transition: color 0.2s;
}

.newsletter-form button:hover {
    color: var(--color-primary);
}

.social-icons {
    display: flex;
    gap: 1.5rem;
}

.social-icons a {
    font-size: var(--font-size-biggest);
    color: var(--color-text-primary);
}

.footer-copyright {
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid #eee;
    font-size: var(--font-size-small);
}

.contato-grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 2rem;
    padding: 0;
    margin: 2rem 0 2rem 0;
}

/* ==========================================================================
   7. RESPONSIVIDADE (MANTIDO)
   ========================================================================== */

@media (max-width: 1180px) {
    .nav-menu .dropdown-menu {
        display: none;
        position: static;     /* Faz ele fluir naturalmente na lista */
        float: none;         /* Remove o comportamento flutuante */
        width: 100%;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;         /* Remove a borda da 'caixa' */
        box-shadow: none !important;     /* Remove a sombra da 'caixa' */
        background-color: transparent !important; /* Remove o fundo diferente */
        border-radius: 0;
    }

    /* Estilo dos links dentro do submenu (opções limpas) */
    .nav-menu .dropdown-menu li a {
        padding: 0.8rem 3.5rem !important; /* Mantém apenas o recuo à esquerda */
        background: none !important;
        border-bottom: 1px solid #f8f8f8; /* Linha sutil opcional entre opções */
        font-weight: normal;
        color: #666; /* Uma cor levemente mais suave que o item principal */
    }

    /* Garante que não haja fundo cinza ao passar o mouse no mobile */
    .nav-menu .dropdown-menu li a:hover {
        background-color: transparent !important;
        color: var(--color-text-primary);
    }
    .main-nav {
        height: 100px;
        grid-template-columns: auto 1fr auto;
    }
    body.menu-aberto { overflow: hidden; }
    .mobile-menu-toggle { display: block; }
    .nav-menu {
        position: fixed;
        top: 100px; /* Alinhado com a altura do header */
        left: 0;
        width: 270px; /* Largura fixa do seu padrão */
        height: calc(100vh - 100px); /* Altura total menos o header */
        background-color: var(--color-background-light);
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        flex-direction: column;
        align-items: flex-start;
        overflow-y: auto;
        padding: 1rem 0; /* Espaçamento interno vertical limpo */
        z-index: 1050;
    }
    body.menu-aberto .nav-menu { transform: translateX(0); }
    .nav-menu li {
        width: 100%;
    }

    .nav-menu li a {
        display: block;
        padding: 1rem 2rem;
        border-bottom: 1px solid #f1f1f1;
        width: 100%;
        color: var(--color-text-primary);
        text-decoration: none;
        font-size: 1.1rem;
    }

    /* Submenu (Dropdown) no Mobile */
    .dropdown-menu {
        position: static; /* Faz com que empurre o item 'Contato' para baixo */
        display: none;
        width: 100%;
        box-shadow: none;
        padding: 0 !important;
        border-radius: 0;
        background-color: #fafafa; /* Fundo ligeiramente diferente para o submenu */
    }

    /* Itens dentro do dropdown (indentação) */
    .dropdown-menu li a {
        padding-left: 3.5rem !important; /* Recuo para parecer sub-item */
        font-size: 1rem;
        border-bottom: 1px solid #f8f8f8;
    }

    .dropdown-menu.show {
        display: block;
    }
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2.5rem;
    }
    .footer-col { align-items: center; }
}

/* Ajustes finais de Overwrite */
.nav > .nav-item > .nav-link {
    padding: 8px 8px !important;
}