/* ==================== ESTILOS GLOBAIS ==================== */
/*
 * Reset CSS e estilos base aplicados globalmente em toda a aplicação.
 * Este arquivo contém apenas estilos que afetam elementos HTML básicos.
 */

/* ==================== RESET CSS ==================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== BODY ==================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* ==================== MAIN CONTENT AREA (#app) ==================== */

#app {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--bg-primary);
    position: relative;
}

/* Container de fundo atrás das páginas */
#app::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-secondary);
    border-radius: var(--content-border-radius) 0 0 var(--content-border-radius);
    z-index: 0;
    pointer-events: none;
}

/* Scrollbar minimalista para #app */
#app::-webkit-scrollbar {
    width: 6px;
}

#app::-webkit-scrollbar-track {
    background: transparent;
}

#app::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

#app::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Firefox scrollbar */
#app {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* ==================== MOBILE HEADER ==================== */

.mobile-header {
    display: none;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background-color: var(--bg-primary);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    width: 100%;
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background var(--transition-speed) var(--transition-ease);
}

.mobile-menu-btn:hover {
    background: var(--hover);
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

.mobile-title {
    font-size: 18px;
    font-weight: 600;
}

/* ==================== CONTENT CONTAINER ==================== */
/* Removido - não é mais necessário, o #app é o container principal */

/* ==================== PAGES (Containers de Páginas) ==================== */

.page {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 100%;
    background-color: transparent; /* Transparente para mostrar o fundo */
    border-radius: var(--content-border-radius) 0 0 var(--content-border-radius);
    animation: fadeIn 0.4s var(--transition-ease);
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--content-padding);
    box-sizing: border-box;
    position: relative;
    z-index: 1; /* Ficar acima do fundo */
}

/* Scrollbar minimalista para páginas */
.page::-webkit-scrollbar {
    width: 6px;
}

.page::-webkit-scrollbar-track {
    background: transparent;
}

.page::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.page::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Firefox scrollbar */
.page {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Mobile: bordas arredondadas apenas no topo e scrollbar mais fina */
@media (max-width: 768px) {
    /* Ajustar container de fundo no mobile */
    #app::before {
        border-radius: var(--content-border-radius) var(--content-border-radius) 0 0;
    }
    
    .page {
        border-radius: var(--content-border-radius) var(--content-border-radius) 0 0;
        max-height: 100%;
        height: 100%;
        padding: var(--content-padding);
    }
    
    .page::-webkit-scrollbar {
        width: 4px;
    }
}

/* Garantir que o conteúdo direto no #app também preencha */
#app > * {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1; /* Ficar acima do fundo */
}

/* Remover padding da página quando contém chat-container (compatibilidade) */
.page .chat-container {
    margin: calc(var(--content-padding) * -1);
    width: calc(100% + var(--content-padding) * 2);
    max-width: calc(100% + var(--content-padding) * 2);
}

@media (max-width: 768px) {
    .page .chat-container {
        margin: calc(var(--content-padding) * -1);
        width: calc(100% + var(--content-padding) * 2);
        max-width: calc(100% + var(--content-padding) * 2);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== OVERLAY (Mobile) ==================== */

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition-speed) var(--transition-ease);
}

.overlay.active {
    display: block;
    opacity: 1;
}

/* ==================== RESPONSIVIDADE - MOBILE ==================== */

@media (max-width: 768px) {
    
    /* Ajuste de espaçamento para mobile */
    :root {
        --content-padding: 24px;
    }
    
    /* Body no mobile: usar altura dinâmica e sidebar não ocupa espaço (é fixed) */
    body {
        flex-direction: column;
        height: 100dvh; /* Dynamic viewport height para mobile */
        max-height: 100dvh;
        overflow: hidden;
    }
    
    /* Mostrar header mobile */
    .mobile-header {
        display: flex;
        flex-shrink: 0;
        height: var(--header-height, 60px);
    }
    
    /* Ajustar #app para considerar o header mobile e usar altura dinâmica */
    #app {
        margin-top: var(--header-height, 60px);
        height: calc(100dvh - var(--header-height, 60px));
        max-height: calc(100dvh - var(--header-height, 60px));
        width: 100%;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    /* Ajustar container de fundo no mobile */
    #app::before {
        top: 0;
        height: 100%;
    }
    
    /* Scrollbar minimalista para mobile */
    #app::-webkit-scrollbar {
        width: 4px;
    }
}

/* ==================== RESPONSIVIDADE - TABLET ==================== */

@media (min-width: 769px) and (max-width: 1024px) {
    
    /* Ajuste de espaçamento para tablet */
    :root {
        --content-padding: 32px;
    }
}

