/* Theme CSS - Estilo Zynix Completo */

/* Remove sublinhado de links com ícones */
a.text-decoration-none,
a[onclick*="viewFileDetails"],
a[onclick*="viewDocument"],
a[onclick*="showFile"],
.file-link,
.no-underline,
.btn-link,
button.btn-link {
    text-decoration: none !important;
}

a.text-decoration-none:hover,
a[onclick*="viewFileDetails"]:hover,
a[onclick*="viewDocument"]:hover,
a[onclick*="showFile"]:hover,
.file-link:hover,
.no-underline:hover,
.btn-link:hover,
button.btn-link:hover,
.btn-link:focus,
button.btn-link:focus {
    text-decoration: none !important;
}

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f8f9fa;
    overflow-x: hidden !important;
    max-width: 100vw;
}

html {
    overflow-x: hidden !important;
    max-width: 100vw;
}

/* Sidebar */
.app-sidebar {
    width: 280px;
    /* background: white; - Removido para permitir tema escuro */
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
}

.main-sidebar-header {
    height: 70px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
}

.header-logo {
    text-decoration: none;
}

.main-sidebar-header {
    width: 100% !important;
    padding: 0 15px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.header-logo {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.desktop-logo {
    max-height: none !important;
    width: auto !important;
    max-width: 80% !important;
    height: auto !important;
    display: block !important;
}

.main-sidebar {
    height: calc(100vh - 70px);
    overflow-y: auto;
    overflow-x: hidden;
}

.main-sidebar::-webkit-scrollbar {
    width: 6px;
}

.main-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.main-menu {
    list-style: none;
    padding: 15px 0;
    margin: 0;
}

.slide {
    margin: 0;
}

/* Menu Principal */
.side-menu__item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #495057;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
}

.side-menu__item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.side-menu__item.active {
    background: #6366f1;
    color: white;
}

.side-menu__item.active .side-menu__icon,
.side-menu__item.active .side-menu__label,
.side-menu__item.active .menu-arrow {
    color: white !important;
}

.side-menu__icon {
    width: 24px;
    margin-right: 12px;
    font-size: 18px;
}

.side-menu__label {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
}

.menu-arrow {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.menu-arrow.open {
    transform: rotate(90deg);
}

/* Submenus com Animação */
.slide-menu,
.sidebar-folder-list,
.sidebar-chat-list {
    list-style: none;
    padding: 0;
    margin: 0;
    /* background: rgba(0, 0, 0, 0.02); - Removido para permitir tema escuro */
    background: transparent;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.slide-menu.show,
.sidebar-folder-list.show,
.sidebar-chat-list.show {
    max-height: 500px;
    opacity: 1;
}

.sub-side-menu__item {
    display: block;
    padding: 10px 20px 10px 52px;
    color: #6c757d;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    position: relative;
}

.sub-side-menu__item:hover {
    background: rgba(99, 102, 241, 0.05);
    color: #6366f1;
}

.sub-side-menu__item i {
    margin-right: 8px;
    font-size: 14px;
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    height: 70px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 999;
    display: flex;
    align-items: center;
}

.main-header-container {
    width: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content-left {
    flex: 1;
}

.header-search {
    position: relative;
    max-width: 500px;
}

.header-search input {
    width: 100%;
    padding: 8px 15px 8px 40px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
}

.header-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.header-content-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    padding-top: 90px;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: calc(100vw - 280px);
}

.container-fluid {
    padding: 0 20px;
    overflow-x: hidden;
    max-width: 100%;
}

/* Prevenir overflow horizontal em tabelas */
.table-responsive {
    overflow-x: auto;
    max-width: 100%;
}

table {
    max-width: 100%;
}

/* Prevenir overflow em qualquer elemento */
.row {
    margin-left: 0;
    margin-right: 0;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    overflow-x: hidden;
}

.card-header {
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 15px 20px;
}

.card-body {
    padding: 20px;
}

/* Avatars */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.avatar-lg {
    width: 48px;
    height: 48px;
}

.bg-primary-transparent {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.bg-success-transparent {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.bg-danger-transparent {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Utilities */
.g-3 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

.page-header-breadcrumb {
    margin-bottom: 1.5rem;
}

.fw-semibold {
    font-weight: 600;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-menu.show {
    animation: slideDown 0.3s ease;
}

/* Correção do Header e Alinhamento */
.header-content-right {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
}

.header-theme-toggle {
    display: flex !important;
    align-items: center !important;
}

.header-notification {
    position: relative;
    display: flex !important;
    align-items: center !important;
    cursor: pointer;
}

.header-profile {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer;
}

/* ========== PADRÃO GLOBAL DE MENSAGENS DE CHAT ========== */
/* Mensagens do usuário no tema claro - FUNDO AZUL COM TEXTO BRANCO */
.chat-message-user {
    background-color: #007bff !important;
    color: white !important;
}

.chat-message-user * {
    color: white !important;
}

.chat-message-assistant,
.message-assistant,
.assistant-message,
.message.assistant .message-content {
    background-color: #f1f3f5 !important;
    color: #333 !important;
}

/* Tema escuro - mensagens */
[data-theme-mode="dark"] .chat-message-user,
[data-theme-mode="dark"] .message-user,
[data-theme-mode="dark"] .user-message,
[data-theme-mode="dark"] .message.user .message-content {
    background-color: #0056b3 !important;
    color: white !important;
}

[data-theme-mode="dark"] .chat-message-assistant,
[data-theme-mode="dark"] .message-assistant,
[data-theme-mode="dark"] .assistant-message,
[data-theme-mode="dark"] .message.assistant .message-content {
    background-color: #2c2c2c !important;
    color: #e0e0e0 !important;
}

/* Correção de cores para Badges e Botões no tema claro */
.badge.bg-primary,
.badge.bg-secondary,
.badge.bg-success,
.badge.bg-danger,
.badge.bg-warning,
.badge.bg-info,
.badge.bg-dark {
    color: white !important;
}

/* Garantir que botões tenham texto branco */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-info,
.btn-dark {
    color: white !important;
}

/* Botão Iniciar Chat específico */
.btn-chat-start {
    background-color: #6366f1;
    border-color: #6366f1;
    color: white !important;
}

.btn-chat-start:hover {
    background-color: #4f46e5;
    border-color: #4f46e5;
    color: white !important;
}

/* Responsive */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .app-sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .app-header {
        left: 0;
    }
}

/* TEMA ESCURO - Override */
[data-theme="dark"] .app-sidebar {
    background: #1a1a1a !important;
}

[data-theme="dark"] .slide-menu {
    background: transparent !important;
}

[data-theme="dark"] .sub-side-menu__item {
    color: #cbd5e1 !important;
    background: transparent !important;
}

[data-theme="dark"] .sub-side-menu__item:hover {
    background: rgba(99, 102, 241, 0.15) !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .sub-side-menu__item.active {
    background: rgba(99, 102, 241, 0.2) !important;
    color: #ffffff !important;
}