:root {
    --bg-dark: #131314;
    --surface-dark: #1e1f20;
    --text-primary: #e3e3e3;
    --text-secondary: #c4c7c5;
    --accent: #a8c7fa;
    --accent-hover: #aecbfa;
    --user-msg-bg: #2a2b2c;
    --gradient-text: linear-gradient(74deg, #4285f4 0, #9b72cb 9%, #d96570 20%, #d96570 24%, #9b72cb 35%, #4285f4 44%, #9b72cb 50%, #d96570 56%, #e3e3e3 75%, #e3e3e3 100%);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
}

.chat-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: rgba(19, 19, 20, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.logo {
    font-size: 1.25rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.sparkle {
    font-size: 1.5rem;
}

.settings-btn {
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.settings-btn:hover {
    color: var(--text-primary);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
}

.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.greeting {
    font-size: 3rem;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.hello {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation: shine 5s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}

.subtext {
    color: #444746;
    font-size: 2.5rem;
}

.message {
    display: flex;
    gap: 16px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    background-color: var(--user-msg-bg);
    padding: 12px 18px;
    border-radius: 20px 20px 4px 20px;
}

.message.assistant {
    align-self: flex-start;
}

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

.avatar.bot {
    background: linear-gradient(135deg, #4285f4, #9b72cb);
    color: white;
}

.message-content {
    line-height: 1.6;
    font-size: 1rem;
}

.input-area {
    padding: 12px 24px 24px;
    background: linear-gradient(180deg, rgba(19,19,20,0) 0%, var(--bg-dark) 20%);
}

.chat-input-wrapper {
    position: relative;
    background-color: var(--surface-dark);
    border-radius: 30px;
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border: 1px solid #444746;
    transition: background-color 0.2s, border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    background-color: #2a2b2c;
    border-color: #5f6368;
}

#user-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 12px 8px;
    font-family: inherit;
    outline: none;
}

.send-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background-color 0.2s;
}

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

.footer-text {
    text-align: center;
    font-size: 0.75rem;
    color: #5f6368;
    margin-top: 12px;
}

/* --- Header Links --- */
.header-actions {
    display: flex;
    gap: 15px;
}
.header-link {
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    background: transparent;
    border-radius: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.header-link:hover {
    color: #e2e2e2;
    background: rgba(255, 255, 255, 0.05);
}
.header-link.active {
    color: #e2e2e2;
    background: rgba(255, 255, 255, 0.1);
}
/* Estilo del botón Salir ahora hace match completo */
.header-link.logout {
    color: #ffffff; 
}
.header-link.logout:hover {
    color: #e2e2e2;
    background: rgba(255, 255, 255, 0.05);
}

/* --- Toggle Switch --- */
.rag-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 12px;
    background: #1a1b21;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #2d2e36;
}
.toggle-label {
    font-size: 12px;
    color: #a0a0a5;
    font-weight: 600;
    width: 60px;
}

/* The switch - the box around the slider */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

/* Hide default HTML checkbox */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #3d3e48;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #a0a0a5;
  transition: .4s;
}

input:checked + .slider {
  background-color: #6366f1; /* purple style */
}

input:focus + .slider {
  box-shadow: 0 0 1px #6366f1;
}

input:checked + .slider:before {
  transform: translateX(16px);
  background-color: white;
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* --- Database View Styles --- */
.db-body {
    background-color: #0f1014;
    color: #e4e4e7;
    font-family: 'Inter', sans-serif;
    margin: 0;
}
.db-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
.db-content {
    flex: 1;
    background: #1a1b21;
    border: 1px solid #2d2e36;
    border-radius: 12px;
    margin-top: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.table-wrapper {
    flex: 1;
    overflow-y: auto;
}
#conocimiento-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
#conocimiento-table th, #archivos-table th {
    background-color: #262730;
    color: #a0a0a5;
    padding: 15px;
    font-weight: 500;
    font-size: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #3d3e48;
}
#conocimiento-table td, #archivos-table td {
    padding: 15px;
    border: 1px solid #3d3e48; /* Divisor gris oscuro */
    font-size: 14px;
}
#conocimiento-table tr:hover, #archivos-table tr:hover {
    background-color: #202128;
}
.id-col { color: #6366f1; font-weight: 500; width: 60px; text-align: center; }
.excel-col { width: 250px; }
.text-col { 
    background-color: #e2e2e2; /* Fondo Gris claro */
    color: #000000; /* Letras Negras */
    line-height: 1.6; 
}
.badge {
    background: #10b98120;
    color: #10b981;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

/* Upload Button Styles */
.upload-btn {
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background-color 0.2s;
    margin-right: 8px;
}

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

.file-name-display {
    color: var(--accent);
    font-size: 0.85rem;
    margin-right: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* Markdown and Code Styles */
.message-content h1, .message-content h2, .message-content h3 {
    margin-top: 12px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.message-content p {
    margin-bottom: 12px;
}

.message-content ul, .message-content ol {
    margin-bottom: 12px;
    padding-left: 20px;
}

.message-content a {
    color: var(--accent);
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.code-wrapper {
    position: relative;
    margin: 16px 0;
    border-radius: 8px;
    background: #0d1117;
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #161b22;
    color: #8b949e;
    font-size: 0.8rem;
    font-family: monospace;
}

.copy-btn {
    background: transparent;
    border: none;
    color: #8b949e;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.copy-btn:hover {
    color: #c9d1d9;
}

.code-wrapper pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
}

.code-wrapper code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.message-content code:not(pre code) {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

/* Modificadores extra Database UI */
.db-scrollable {
    overflow-y: auto !important;
    padding: 20px;
    display: flex;
    flex-direction: column;
}
.section-title {
    color: var(--accent);
    margin-bottom: 15px;
    font-weight: 500;
}
.short-wrapper {
    max-height: 300px;
}
.delete-btn {
    background-color: #ef444420;
    color: #ef4444;
    border: 1px solid #ef444440;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}
.delete-btn:hover {
    background-color: #ef4444;
    color: white;
}

/* --- DASHBOARD STYLES --- */
.dashboard-controls {
    margin-bottom: 25px;
}

.glass-search {
    background: rgba(30, 31, 32, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 16px;
}

.search-title {
    color: var(--accent);
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 500;
}

.graph-input-wrapper {
    display: flex;
    gap: 15px;
    align-items: center;
}

.neon-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #444746;
    color: white;
    padding: 12px 18px;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s;
}
.neon-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

#file-selector {
    width: 250px;
}
#ai-prompt {
    flex: 1;
}

/* Grid System */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.glass-panel {
    background: rgba(26, 27, 33, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(45, 46, 54, 0.8);
    border-radius: 16px;
    padding: 24px;
    transition: transform 0.2s;
}
.glass-panel:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.metric-card h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
}

.big-metric {
    font-size: 48px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #6366f1, #a8c7fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 10px;
}
.metric-subtitle {
    color: #a0a0a5;
    font-size: 14px;
    margin-top: 5px;
}

.loading-spin {
    display: inline-block;
    animation: spin 2s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
