/* LAYOUT.CSS - Estrutura geral da aplicação */

body {
    font-family: var(--font-primary, var(--font-family));
    font-size: var(--font-size-base);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Full-page sections (login, signup) */
.section {
    display: none !important;
    min-height: 100vh;
}

.section.active {
    display: flex !important;
}

/* App layout (sidebar + main) */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* App sections (content inside main area) */
.app-section {
    display: none;
}

.app-section.active {
    display: block;
}

.sections-container {
    flex: 1;
    overflow-y: auto;
}

/* Section tabs (for merged sections) */
.section-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 20px 0;
    border-bottom: 2px solid var(--color-border, #e5e5e5);
    background: var(--color-bg-card, #fff);
    position: sticky;
    top: 0;
    z-index: 10;
}

.section-tab {
    padding: 10px 24px 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text-light, #666);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.section-tab:hover {
    color: var(--color-primary, #6D00FF);
    background: rgba(var(--color-primary-rgb), 0.05);
}

.section-tab.active {
    color: var(--color-primary, #6D00FF);
    border-bottom-color: var(--color-primary, #6D00FF);
    font-weight: 600;
    background: rgba(var(--color-primary-rgb), 0.03);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    padding: 16px 0;
}

[data-theme="dark"] .section-tabs {
    background: #1e1e1e;
    border-bottom-color: #3a3a5c;
}

[data-theme="dark"] .section-tab {
    color: #c0c0d0;
}

[data-theme="dark"] .section-tab:hover {
    color: #b794ff;
    background: rgba(168, 85, 247, 0.1);
}

[data-theme="dark"] .section-tab.active {
    color: #b794ff;
    border-bottom-color: #b794ff;
    background: rgba(168, 85, 247, 0.06);
}

/* Sidebar - Dark Mode */
[data-theme="dark"] .sidebar {
    border-right-color: #1a1a2e;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .sidebar-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sidebar-title {
    color: #a78bfa;
}

[data-theme="dark"] .sidebar-link {
    color: rgba(255, 255, 255, 0.65);
}

[data-theme="dark"] .sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

[data-theme="dark"] .sidebar-link.active {
    background: rgba(var(--color-primary-rgb), 0.25);
    color: #ffffff;
    border-left-color: #a78bfa;
}

[data-theme="dark"] .sidebar-link svg {
    stroke: rgba(255, 255, 255, 0.65);
}

[data-theme="dark"] .sidebar-link:hover svg,
[data-theme="dark"] .sidebar-link.active svg {
    stroke: #ffffff;
}

/* Sidebar */
.sidebar {
    width: 250px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--color-border);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease, background 0.3s ease;
}

.sidebar.closed {
    transform: translateX(-250px);
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

.sidebar-logo {
    margin-bottom: var(--spacing-sm);
    filter: drop-shadow(0 2px 8px rgba(var(--color-primary-rgb), 0.15));
    transition: transform 0.3s ease;
}

.sidebar-logo:hover {
    transform: scale(1.05);
}

.sidebar-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-primary);
    margin: 0;
}

/* Hamburger Button */
.hamburger-btn {
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 0;
    transition: all 0.3s ease;
    border-radius: var(--radius-sm);
    position: relative;
    z-index: 10;
}

.hamburger-btn svg {
    color: var(--color-primary) !important;
    stroke: var(--color-primary) !important;
    display: block !important;
    width: 24px;
    height: 24px;
}

.hamburger-btn:hover {
    background: rgba(var(--color-primary-rgb), 0.1);
}

.hamburger-btn:hover svg {
    stroke: var(--color-primary-dark) !important;
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-md) 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: var(--color-primary);
}

.sidebar-link.active {
    background: rgba(var(--color-primary-rgb), 0.08);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    font-weight: 600;
}

.sidebar-link svg {
    flex-shrink: 0;
    stroke: var(--sidebar-text);
    transition: stroke 0.2s ease;
}

.sidebar-link:hover svg,
.sidebar-link.active svg {
    stroke: var(--color-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--color-bg);
    transition: margin-left 0.3s ease, background 0.3s ease;
}

.main-content.sidebar-closed {
    margin-left: 0;
}

/* Top Bar */
.top-bar {
    background: var(--topbar-bg);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--topbar-shadow);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.page-icon {
    flex-shrink: 0;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    text-transform: lowercase;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: var(--spacing-lg);
}

/* Login Section Layout */
#login,
#signup {
    display: none;
    align-items: center;
    justify-content: center;
}

#login.active,
#signup.active {
    display: flex;
}

/* Sections with Sidebar */
#home,
#historias,
#conversas,
#arquivos,
#usuarios,
#permissoes-config {
    display: none;
}

#home.active,
#historias.active,
#conversas.active,
#arquivos.active,
#usuarios.active,
#permissoes-config.active {
    display: flex;
}

/* FORÇAR VISIBILIDADE DO HAMBURGER */
.top-bar-left .hamburger-btn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.top-bar-left .hamburger-btn svg {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* FORÇAR VISIBILIDADE DE LINKS ADMIN */
.sidebar-link.admin-only {
    display: flex !important;
}

/* Esconder apenas se explicitamente necessário */
.sidebar-link.admin-only[style*="display: none"] {
    display: none !important;
}
/* FIX PARA SEÇÕES - Adicione no final do seu CSS principal */

/* Esconder todas as seções por padrão */
.section {
    display: none !important;
}

/* Mostrar apenas a seção ativa */
.section.active {
    display: block !important;
}

/* Garantir que a seção ativa está visível */
#login.active,
#signup.active,
#home.active,
#admin.active,
#profile.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Esconder seções não ativas */
#login:not(.active),
#signup:not(.active),
#home:not(.active),
#admin:not(.active),
#profile:not(.active) {
    display: none !important;
}

/* Seletor de cor removido — identidade visual fixa
}

/* ==================== TOGGLE DE TEMA ==================== */

.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.theme-toggle:hover {
    background: var(--color-hover);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    stroke: var(--color-text);
    stroke-width: 2;
    fill: none;
    transition: all 0.3s ease;
}

/* Ícone do sol (tema claro) */
.theme-toggle .sun-icon {
    display: block;
}

.theme-toggle .moon-icon {
    display: none;
}

/* Ícone da lua (tema escuro) */
[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle svg {
    stroke: #ffd700;
}

/* Transição suave para todos os elementos */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}