/*
 * Claude.ai Theme - Design Real
 * Replicação fiel da interface do Claude.ai
 */

/* ============================================
   RESET E VARIÁVEIS
   ============================================ */

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

:root {
    /* Cores Claude.ai - AJUSTES_220126_V02 */
    --bg-main: #F5F5F0;
    --bg-sidebar: #FAFAF8;
    --bg-elevated: #FFFFFF;
    --bg-chat: #FFFFFF;
    --bg-input: #FFFFFF;
    --bg-hover: #EFEFEA;

    /* Coral/Terracota */
    --primary: #D97757;
    --primary-dark: #C66847;
    --accent-primary: #D97757;
    --accent-hover: #C66847;

    /* Textos */
    --text-primary: #1A1A1A;
    --text-secondary: #6B6B6B;
    --text-tertiary: #9B9B9B;
    --text-sidebar: #1A1A1A;

    /* Borders */
    --border-primary: #E8E8E4;
    --border-secondary: #D0D0CA;
    --border-light: #E8E8E4;
    --border-sidebar: #E8E8E4;

    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);

    /* Fontes - AJUSTES_220126 */
    --font-serif: "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    /* Tamanhos */
    --sidebar-width: 260px;
    --chat-max-width: 860px;

    /* Espaçamentos */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Transições */
    --transition: 150ms ease;  /* CORRIGIDO para 0.15s */
}

html, body {
    height: 100%;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   SIDEBAR - Estilo Claude.ai Real
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-sidebar);  /* MODELO.HTML */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
}

/* Header da Sidebar */
.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-sidebar);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-decoration: none;
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.sidebar-logo:hover {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.sidebar-logo img {
    width: 259px;
    height: auto;
    max-height: 72px;
    object-fit: contain;
}

/* Nav Items - Estilo Claude.ai */
.sidebar-nav {
    padding: 8px 0;
}

/* Botão Novo Chat - CÓDIGO FORNECIDO PELO USUÁRIO */
.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-primary);
    width: 100%;
    margin: 12px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.new-chat-btn:hover {
    background: #E5E5E0;
    border-color: var(--border-primary);
}

.new-chat-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2.5;
    flex-shrink: 0;
}

/* Section Divider */
.section-divider {
    height: 1px;
    background: var(--border-sidebar);
    margin: 12px 8px;
}

/* Conteúdo da Sidebar */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;  /* MODELO.HTML - padding reduzido */
}

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

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);  /* MODELO.HTML - scrollbar escura em fundo claro */
    border-radius: 3px;
}

/* Seções da Sidebar */
.sidebar-section {
    margin-bottom: var(--spacing-lg);
}

.sidebar-section-title {
    padding-top: 16px;  /* AJUSTES_220126 - mais espaço acima */
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 8px;
    font-size: 10px;  /* AJUSTES_220126 */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;  /* AJUSTES_220126 */
    color: #8B8B8B;
    font-family: var(--font-sans);
}

/* Busca de Conversas */
.sidebar-search {
    position: relative;
    padding: 0 10px;
    margin-bottom: var(--spacing-md);
}

.sidebar-search .search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-sans);
    transition: all var(--transition);
}

.sidebar-search .search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(217, 119, 87, 0.1);
}

.sidebar-search .search-input::placeholder {
    color: var(--text-tertiary);
}

.sidebar-search .search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

/* Item da Sidebar - BASEADO EM MODELO.HTML */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;  /* AJUSTES_220126 - mais compacto */
    margin: 0;  /* AJUSTES_220126 - sem espaçamento */
    border-radius: 5px;  /* AJUSTES_220126 */
    color: var(--text-sidebar);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 13px;  /* AJUSTES_220126 */
    font-weight: 400;  /* AJUSTES_220126 */
    font-family: var(--font-sans);
}

.sidebar-item:hover {
    background: var(--bg-hover);  /* MODELO.HTML */
}

.sidebar-item.active {
    background: var(--bg-hover);  /* MODELO.HTML */
}

.sidebar-item svg {
    width: 15px;  /* AJUSTES_220126 */
    height: 15px;
    flex-shrink: 0;
    opacity: 0.4;  /* AJUSTES_220126 - mais sutil */
}

.sidebar-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;  /* AJUSTES_220126 */
    font-family: var(--font-sans);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-white-secondary);
}

/* Footer da Sidebar - PERFIL COM SEPARAÇÃO */
.sidebar-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-sidebar);  /* MODELO.HTML - #E8E8E4 */
    margin-top: auto;  /* CORRIGIDO empurra para baixo */
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
}

.user-menu:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 28px;  /* AJUSTES_220126 */
    height: 28px;
    border-radius: 50%;
    background: #1A1A1A;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;  /* AJUSTES_220126 */
    color: white;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 12px;  /* AJUSTES_220126 */
    font-weight: 500;
    color: #1A1A1A;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-sans);
}

.user-email {
    font-size: 10px;  /* AJUSTES_220126 */
    font-weight: 400;  /* AJUSTES_220126 */
    color: #6B6B6B;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
    font-family: var(--font-sans);
}

.user-menu svg {
    width: 18px;
    height: 18px;
    color: var(--text-white-secondary);
    flex-shrink: 0;
}

/* Dropdown do Usuário - CORRIGIDO PARA CLARO */
.user-dropdown {
    position: absolute;
    bottom: 80px;
    left: 16px;
    width: 228px;
    background: #FFFFFF;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition);
    font-size: 14px;
    font-family: var(--font-sans);
}

.user-dropdown-item:hover {
    background: var(--bg-hover);
}

.user-dropdown-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-primary);
    margin: var(--spacing-sm) 0;
}

/* ============================================
   ÁREA PRINCIPAL - CHAT
   ============================================ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    overflow: hidden;
}

/* Permitir scroll em páginas sem chat-container (ex: /chat) */
.main-content:not(:has(.chat-container)) {
    overflow-y: auto;
}

/* Header do Chat */
.chat-header {
    height: 64px;
    padding: 0 var(--spacing-xl);
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
}

.chat-title {
    font-family: var(--font-serif);  /* AJUSTES_220126 - Charter/Georgia */
    font-size: 20px;  /* AJUSTES_220126 */
    font-weight: 400;  /* AJUSTES_220126 */
    color: var(--text-primary);
}

.chat-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.chat-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.chat-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.chat-action-btn svg {
    width: 18px;
    height: 18px;
}

/* Container de Mensagens */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-xl) 0;
    background: var(--bg-main);
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

/* Mensagens */
.messages-wrapper {
    max-width: var(--chat-max-width);
    margin: 0 auto;
    padding: 0;
}

.message {
    margin-bottom: var(--spacing-xl);
    display: flex;
    gap: var(--spacing-md);
    animation: fadeIn 0.3s ease;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
}

.message.user .message-avatar {
    background: var(--accent-primary);
    color: var(--text-white);
}

.message.assistant .message-avatar {
    background: var(--text-primary);
    color: var(--text-white);
}

.message.assistant .message-avatar svg {
    width: 20px;
    height: 20px;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.message-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.message-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.message-body {
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-primary);
    word-wrap: break-word;
}

.message-body p {
    margin-bottom: var(--spacing-md);
}

.message-body p:last-child {
    margin-bottom: 0;
}

.message-body code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "SF Mono", Monaco, monospace;
    font-size: 15px;
}

.message-body pre {
    background: rgba(0, 0, 0, 0.04);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: var(--spacing-md) 0;
}

.message-body pre code {
    background: none;
    padding: 0;
}

.message-body strong {
    font-weight: 600;
}

.message-body ul,
.message-body ol {
    padding-left: 24px;
    margin: var(--spacing-md) 0;
}

.message-body li {
    margin-bottom: var(--spacing-sm);
}

/* Estado Vazio */
.empty-state {
    max-width: var(--chat-max-width);
    margin: var(--spacing-xl) auto;
    padding: var(--spacing-xl);
    text-align: center;
}

.empty-state-icon {
    width: 56px;  /* AJUSTES_220126 */
    height: 56px;
    margin: 0 auto var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.2;  /* AJUSTES_220126 - mais sutil */
}

.empty-state-icon svg {
    width: 56px;  /* AJUSTES_220126 - ícone maior */
    height: 56px;
    color: var(--text-secondary);
}

.empty-state-title {
    font-family: var(--font-serif);  /* AJUSTES_220126 - Charter/Georgia */
    font-size: 32px;  /* AJUSTES_220126 */
    font-weight: 400;  /* AJUSTES_220126 */
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.empty-state-description {
    font-size: 16px;
    font-family: var(--font-sans);  /* AJUSTES_220126 - Inter */
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Input de Mensagem */
.chat-input-container {
    padding: var(--spacing-lg) 0;
    background: var(--bg-main);
    flex-shrink: 0;
}

.chat-input-wrapper {
    max-width: var(--chat-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.btn-attach {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;  /* AJUSTES_220126 */
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-attach:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.btn-attach svg {
    width: 18px;
    height: 18px;
}

.chat-input {
    flex: 1;
    min-height: 44px;  /* AJUSTES_220126 */
    max-height: 200px;
    padding: 10px 0;  /* AJUSTES_220126 - ajustado para centralizar */
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;  /* AJUSTES_220126 */
    font-family: var(--font-sans);
    resize: none;
    outline: none;
}

.chat-input::placeholder {
    color: var(--text-tertiary);
    font-size: 15px;  /* AJUSTES_220126 */
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    border: none;
    border-radius: 6px;  /* AJUSTES_220126 */
    color: white;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--accent-hover);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-btn svg {
    width: 18px;
    height: 18px;
}

/* Indicador de Digitando */
.typing-indicator {
    max-width: var(--chat-max-width);
    margin: 0 auto var(--spacing-lg);
    padding: 0 var(--spacing-xl);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.typing-dots {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-lg);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.typing-timer {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Anexos */
.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.file-preview-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.file-preview-remove {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition);
}

.file-preview-remove:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.attachment-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
}

.attachment-badge svg {
    width: 14px;
    height: 14px;
}

/* Ações das Mensagens */
.message-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.message-action-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.04);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}

.message-action-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.message-action-btn svg {
    width: 14px;
    height: 14px;
}

.message-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.message-action-btn .spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Seletor de Prompt */
.prompt-selector-container {
    max-width: var(--chat-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-xl) var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.prompt-selector-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.prompt-selector-label svg {
    width: 16px;
    height: 16px;
}

.prompt-select {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 6px;  /* AJUSTES_220126 */
    color: var(--text-primary);
    font-size: 14px;  /* AJUSTES_220126 */
    font-family: var(--font-sans);
    cursor: pointer;
    outline: none;
    transition: all var(--transition);
}

.prompt-select:hover:not(:disabled) {
    border-color: var(--accent-primary);
}

.prompt-select:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

/* Loading */
.loading-text {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ============================================
   PÁGINAS ADMIN
   ============================================ */

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.page-header h1 {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 400;
    color: var(--text-primary);
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 87, 0.25);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
    background: #E5E5E0;
}

.btn-danger {
    background: #DC3545;
    color: white;
}

.btn-danger:hover {
    background: #C82333;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Tabelas */
.table-responsive {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--bg-main);
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-primary);
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-primary);
    font-size: 14px;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--bg-main);
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #D4EDDA;
    color: #155724;
}

.status-inactive {
    background: #F8D7DA;
    color: #721C24;
}

/* Empty State Admin */
.empty-state-admin {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-primary);
}

.empty-state-admin p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 20px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: #D1ECFF;
    color: #0C5DA5;
}

.badge-secondary {
    background: #E8E8E4;
    color: #6B6B6B;
}

.badge-success {
    background: #D4EDDA;
    color: #155724;
}

.badge-danger {
    background: #F8D7DA;
    color: #721C24;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.modal-body {
    margin-bottom: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-family: var(--font-sans);
}

.form-group small {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.4;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    background: white;
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    outline: none;
    transition: all 0.15s ease;
    font-family: var(--font-sans);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

input[type="number"].form-control,
input[type="text"].form-control,
input[type="email"].form-control,
input[type="password"].form-control {
    height: 44px;
}

.form-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    background: white;
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-sans);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-main);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s ease;
    font-size: 14px;
}

.checkbox-label:hover {
    background: var(--bg-hover);
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

/* Permission Tabs */
.permission-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--border-primary);
}

.permission-tab {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -2px;
}

.permission-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.permission-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.permission-content {
    display: none;
}

.permission-content.active {
    display: block;
}

.permission-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.gpt-category-badge {
    display: inline-block;
    background: var(--bg-hover);
    color: var(--text-tertiary);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* Form Cards & Layout */
.form-card {
    background: white;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
}

.form-card h3 {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-primary);
}

/* File Upload */
.file-upload-area {
    border: 2px dashed var(--border-secondary);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: var(--bg-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-area:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.file-upload-area.highlight {
    border-color: var(--primary);
    background: rgba(217, 119, 87, 0.05);
}

.file-upload-area input[type="file"] {
    display: none;
}

.file-upload-area p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
}

.file-list li {
    padding: 8px 12px;
    background: var(--bg-hover);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-primary);
}

.upload-form {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-primary);
}

/* Info List */
.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-primary);
    font-size: 14px;
    color: var(--text-primary);
}

.info-list li:last-child {
    border-bottom: none;
}

.info-list strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.users {
    background: #E3F2FD;
    color: #1976D2;
}

.stat-icon.gpts {
    background: #F3E5F5;
    color: #7B1FA2;
}

.stat-icon.conversations {
    background: #E8F5E9;
    color: #388E3C;
}

.stat-icon.messages {
    background: #FFF3E0;
    color: #F57C00;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.dashboard-card {
    background: white;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.card-body {
    padding: 20px 24px;
}

.list-simple {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-simple li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-simple li:last-child {
    border-bottom: none;
}

.list-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.list-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============================================
   CHAT INDEX (LISTA DE GPTs)
   ============================================ */

.chat-index-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.index-welcome {
    text-align: center;
    margin-bottom: 3rem;
}

.index-welcome .welcome-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    color: var(--primary);
}

.index-welcome .welcome-icon svg {
    width: 100%;
    height: 100%;
}

.index-welcome h1 {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.index-welcome p {
    font-family: var(--font-sans);
    font-size: 16px;
    color: var(--text-secondary);
}

.gpt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.gpt-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    display: flex;
    gap: 1rem;
}

.gpt-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(217, 119, 87, 0.15);
    transform: translateY(-2px);
}

.gpt-icon {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gpt-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.gpt-info h3 {
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.gpt-info p {
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.gpt-category {
    display: inline-block;
    background: var(--bg-hover);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================
   RESPONSIVO
   ============================================ */

/* Botão mobile - ESCONDIDO NO DESKTOP */
.mobile-menu-btn {
    display: none;
}

/* Overlay mobile - ESCONDIDO NO DESKTOP */
.sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {
    /* ===== SIDEBAR MOBILE ===== */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* ===== SIDEBAR OVERLAY ===== */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* ===== MOBILE MENU BUTTON ===== */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        border: none;
        background: transparent;
        cursor: pointer;
        padding: 0;
        color: var(--text-primary);
    }

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

    /* ===== MAIN CONTENT ===== */
    .main-content {
        width: 100%;
        margin-left: 0;
    }

    /* ===== CHAT HEADER ===== */
    .chat-header {
        padding: 12px 16px;
        height: 60px;
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .chat-title {
        font-size: 16px;
        flex: 1;
    }

    /* ===== CHAT CONTAINER ===== */
    .chat-container {
        height: calc(100vh - 60px - 80px);
        overflow-y: auto;
        padding-bottom: 0;
    }

    /* ===== MESSAGES ===== */
    .messages-wrapper {
        padding: 16px 16px;
    }

    .message {
        gap: 12px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .message-avatar svg {
        width: 16px;
        height: 16px;
    }

    .message-body {
        font-size: 15px;
        line-height: 1.6;
    }

    .message-body pre {
        font-size: 13px;
        overflow-x: auto;
    }

    .message-actions {
        flex-wrap: wrap;
    }

    .message-action-btn {
        font-size: 13px;
        padding: 8px 12px;
        min-height: 44px;
    }

    /* ===== CHAT INPUT ===== */
    .chat-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 0;
        background: var(--bg-input);
        border-top: 1px solid var(--border-primary);
        z-index: 100;
    }

    .chat-input-wrapper {
        max-width: 100%;
        padding: 0 16px;
    }

    .chat-input {
        font-size: 16px;
        min-height: 44px;
        max-height: 150px;
    }

    .btn-attach,
    .chat-send-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    /* ===== FILE PREVIEW ===== */
    .file-preview {
        flex-direction: column;
    }

    .file-preview-item {
        width: 100%;
    }

    /* ===== SIDEBAR SECTIONS ===== */
    .sidebar-section {
        font-size: 14px;
    }

    .sidebar-section-title {
        font-size: 12px;
        padding: 8px 16px;
    }

    .sidebar-item {
        font-size: 14px;
        padding: 10px 16px;
        min-height: 44px;
    }

    /* ===== PROMPT SELECTOR ===== */
    .prompt-selector-container {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 80px;
    }

    .prompt-selector-label {
        font-size: 12px;
    }

    .prompt-select {
        width: 100%;
        font-size: 16px;
        padding: 10px 12px;
        min-height: 44px;
    }

    /* ===== EMPTY STATE ===== */
    .empty-state {
        padding: 32px 16px;
    }

    .empty-state-title {
        font-size: 24px;
    }

    .empty-state-description {
        font-size: 14px;
    }

    /* ===== TYPING INDICATOR ===== */
    .typing-indicator {
        padding: 0 16px;
        margin-bottom: 16px;
    }

    /* ===== ADMIN PAGES ===== */
    .admin-container {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .stats-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 8px;
    }

    /* ===== CHAT INDEX ===== */
    .chat-index-container {
        padding: 2rem 1rem;
        min-height: calc(100vh - 60px);
    }

    .index-welcome h1 {
        font-size: 24px;
    }

    .index-welcome p {
        font-size: 14px;
    }

    .gpt-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .gpt-card {
        padding: 1rem;
    }
}

/* ============================================
   MARKDOWN CONTENT STYLES
   ============================================ */

/* Citações (blockquotes) - Estilo profissional para peças jurídicas */
.message-content blockquote,
.assistant-message blockquote,
blockquote {
    position: relative;
    margin: 1.5em 0;
    padding: 1em 1em 1em 1.5em;
    background: #F9F9F7;
    border-left: 4px solid #D97757;
    font-style: italic;
    color: #2A2A2A;
    line-height: 1.7;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-radius: 0 4px 4px 0;
}

.message-content blockquote p,
.assistant-message blockquote p,
blockquote p {
    margin: 0.75em 0;
    font-size: 0.95em;
}

.message-content blockquote p:first-child,
.assistant-message blockquote p:first-child,
blockquote p:first-child {
    margin-top: 0;
}

.message-content blockquote p:last-child,
.assistant-message blockquote p:last-child,
blockquote p:last-child {
    margin-bottom: 0;
}

/* Citações aninhadas */
.message-content blockquote blockquote,
.assistant-message blockquote blockquote,
blockquote blockquote {
    margin: 1em 0;
    border-left-color: #9B9B9B;
    background: #EFEFED;
}

/* ============================================
   ADMIN PAGES - FIX SCROLL
   ============================================ */

/* Permitir scroll nas páginas admin */
.admin-container {
    padding: 2rem;
    overflow-y: auto;
    height: 100%;
}

.main-content:has(.admin-container) {
    overflow-y: auto;
}

/* Fallback para navegadores sem suporte a :has() */
body:has(.admin-container) .main-content {
    overflow-y: auto;
}

/* File upload area - clicável */
.file-upload-area {
    border: 2px dashed var(--border-primary);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    background: var(--bg-elevated);
    cursor: pointer;
    transition: all var(--transition);
}

.file-upload-area:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.file-upload-area.highlight {
    border-color: var(--primary);
    background: #FFF5F0;
}

.file-upload-area input[type="file"] {
    display: none;
}

.file-upload-area p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
}

.file-list li {
    padding: 0.5rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 14px;
    color: var(--text-primary);
}

/* ============================================
   AUTH PAGES
   ============================================ */

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-main);
}
