/* ============================================
   Tipografía Chat - Más moderna y ligera
   ============================================ */
.chat-page {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================
   Chat Page Layout
   ============================================ */
.chat-page {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #212121; /* Fondo neutro tipo ChatGPT */
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: 280px;
    height: 100vh;
    background: #171717; /* Fondo sidebar neutro */
    border-right: 1px solid #2d2d2d;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 100;
    position: relative;
}

.sidebar.hidden {
    transform: translateX(-280px);
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #2d2d2d;
    background: #171717;
}

.sidebar-logo {
    text-decoration: none;
    display: block;
    margin-bottom: 1rem;
}

.sidebar-logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.btn-new-chat {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: transparent;
    color: #ececec;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s ease;
}

.btn-new-chat:hover {
    background: #2a2a2a;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #171717;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section-title {
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8e8e8e;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

/* Pestañas del Sidebar */
.sidebar-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.25rem;
    background: #0f0f0f;
    border-radius: 8px;
}

.sidebar-tab {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #8e8e8e;
    font-size: 0.8125rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sidebar-tab:hover {
    color: #ececec;
    background: #2a2a2a;
}

.sidebar-tab.active {
    background: #2a2a2a;
    color: #ececec;
}

/* Contenido de pestañas */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Agentes */
.agents-header {
    margin-bottom: 1rem;
}

.btn-create-agent {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: transparent;
    color: #ececec;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s ease;
}

.btn-create-agent:hover {
    background: #2a2a2a;
}

.agents-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.agent-item {
    padding: 0.75rem;
    background: transparent;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.agent-item:hover {
    background: #2a2a2a;
    border-color: #3d3d3d;
}

.agent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.agent-info {
    flex: 1;
    min-width: 0;
}

.agent-name {
    font-size: 0.8125rem;
    font-weight: 400;
    color: #ececec;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-description {
    font-size: 0.75rem;
    font-weight: 300;
    color: #8e8e8e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-item {
    padding: 0.75rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: transparent;
}

.chat-item:hover {
    background: #2a2a2a;
}

.chat-item.active {
    background: #2a2a2a;
}

.chat-item-content {
    flex: 1;
    min-width: 0;
}

.chat-item-title {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-preview {
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-actions {
    display: none;
    align-items: center;
    gap: 0.25rem;
}

.chat-item:hover .chat-item-actions {
    display: flex;
}

.btn-chat-action {
    padding: 0.25rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: var(--transition);
}

.btn-chat-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #2d2d2d;
    background: #171717;
}

.sidebar-user-btn {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
    color: #ececec;
}

.sidebar-user-btn:hover {
    background: #2a2a2a;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ececec;
}

.user-info {
    flex: 1;
    text-align: left;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.user-plan {
    font-size: 0.6875rem;
    font-weight: 300;
    color: var(--text-muted);
}

/* ============================================
   Sidebar Toggle Button
   ============================================ */
.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 101;
    padding: 0.75rem;
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ececec;
    cursor: pointer;
    display: block;
    transition: background 0.2s ease;
}

.sidebar.hidden ~ .sidebar-toggle {
    left: 1rem;
}

.sidebar:not(.hidden) ~ .sidebar-toggle {
    left: 296px; /* 280px sidebar + 16px padding */
}

.sidebar-toggle:hover {
    background: #3a3a3a;
}

/* ============================================
   Chat Main Area
   ============================================ */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: row; /* Cambiado a row para sidebar + contenido */
    height: 100vh;
    overflow: hidden;
    background: #212121;
    transition: margin-left 0.3s ease;
}

/* ============================================
   Templates Sidebar (Vertical)
   ============================================ */
.templates-sidebar {
    width: 240px;
    min-width: 240px;
    background: #1a1a1a;
    border-right: 1px solid #2d2d2d;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3d3d3d #1a1a1a;
}

.templates-sidebar::-webkit-scrollbar {
    width: 6px;
}

.templates-sidebar::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.templates-sidebar::-webkit-scrollbar-thumb {
    background: #3d3d3d;
    border-radius: 3px;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #2d2d2d;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ececec;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.template-list {
    flex: 1;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.template-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #b4b4b4;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
}

.template-item:hover {
    background: #252525;
    color: #ececec;
    border-color: #3d3d3d;
}

.template-item.active {
    background: #2d2d2d;
    color: #10a37f;
    border-color: #10a37f;
}

.template-emoji {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.template-name {
    flex: 1;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid #2d2d2d;
}

.btn-stats-sidebar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: #252525;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ececec;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-stats-sidebar:hover {
    background: #2d2d2d;
    border-color: #10a37f;
    color: #10a37f;
}

.template-description-sidebar {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: #8e8e8e;
    line-height: 1.4;
    border-top: 1px solid #2d2d2d;
    background: #1f1f1f;
}

/* ============================================
   Chat Content Wrapper
   ============================================ */
.chat-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #212121;
}

.empty-state-content {
    max-width: 800px;
    text-align: center;
}

.capibara-logo-large {
    margin-bottom: 2rem;
}

.capibara-logo-large h1 {
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.empty-state-title {
    font-size: 1.75rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #ececec;
}

.empty-state-subtitle {
    font-size: 0.9375rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.suggestion-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.suggestion-card {
    padding: 1.5rem;
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: left;
    display: flex;
    align-items: start;
    gap: 1rem;
}

.suggestion-card:hover {
    background: #343434;
    border-color: #4d4d4d;
}

.suggestion-card i {
    color: #ececec;
    flex-shrink: 0;
}

.suggestion-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.suggestion-text {
    font-size: 0.8125rem;
    font-weight: 300;
    color: var(--text-muted);
}

/* ============================================
   Chat Area
   ============================================ */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    padding: 1rem 1.5rem;
    background: #212121;
    border-bottom: 1px solid #2d2d2d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.chat-title {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ============================================
   Beta Banner
   ============================================ */
.beta-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    border-bottom: 2px solid rgba(247, 147, 30, 0.5);
    color: #ffffff;
    font-size: 0.875rem;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.15);
}

.beta-banner i {
    flex-shrink: 0;
    opacity: 0.9;
}

.beta-banner span {
    flex: 1;
}

.beta-banner strong {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.beta-banner-close {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.beta-banner-close:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
}

.chat-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Indicador de estado del servidor */
.server-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    font-size: 0.75rem;
}

.status-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #565656;
    transition: all 0.3s ease;
}

.status-led.connected {
    background: #10a37f;
    box-shadow: 0 0 8px rgba(16, 163, 127, 0.6);
    animation: pulse 2s infinite;
}

.status-led.error {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.status-led.connecting {
    background: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    color: #a0a0a0;
    font-weight: 400;
}

.status-text.connected {
    color: #10a37f;
}

.status-text.error {
    color: #ef4444;
}

.status-text.connecting {
    color: #f59e0b;
}

/* Indicador de consenso */
.consensus-indicator {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #a0a0a0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.consensus-indicator:hover {
    background: #3a3a3a;
    border-color: #10a37f;
}

.consensus-indicator i {
    color: #10a37f;
}

.consensus-count {
    font-weight: 600;
    color: #ececec;
    min-width: 12px;
    text-align: center;
}

/* Estadísticas del mensaje */
.message-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #1a1a1a;
    border-radius: 6px;
    font-size: 0.7rem;
    color: #8e8e8e;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-item i {
    width: 12px;
    height: 12px;
}

.btn-icon {
    padding: 0.5rem;
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ececec;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-icon:hover {
    background: #3a3a3a;
}

/* ============================================
   Messages Container
   ============================================ */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1rem;
    scroll-behavior: smooth;
    background: #212121;
}

.message {
    max-width: 800px;
    margin: 0 auto 2rem auto;
    display: flex;
    gap: 1rem;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: #2a2a2a;
    color: #ececec;
}

.message.assistant .message-avatar {
    background: #10a37f;
    color: white;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-role {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.message-text {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 300;
    line-height: 1.6;
    word-wrap: break-word;
}

/* Formateo mejorado de texto dentro de mensajes */
.message-text p {
    margin: 0.75em 0;
}

.message-text p:first-child {
    margin-top: 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

/* Listas con viñetas */
.message-text ul {
    margin: 0.75em 0;
    padding-left: 1.5em;
    list-style-type: disc;
}

.message-text ul li {
    margin: 0.375em 0;
    line-height: 1.5;
}

/* Listas numeradas */
.message-text ol {
    margin: 0.75em 0;
    padding-left: 1.5em;
    list-style-type: decimal;
}

.message-text ol li {
    margin: 0.375em 0;
    line-height: 1.5;
}

/* Encabezados */
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4 {
    margin: 1em 0 0.5em 0;
    font-weight: 600;
    color: var(--text-primary);
}

.message-text h1 { font-size: 1.5em; }
.message-text h2 { font-size: 1.25em; }
.message-text h3 { font-size: 1.1em; }
.message-text h4 { font-size: 1em; }

/* Negrita y cursiva */
.message-text strong {
    font-weight: 600;
    color: #10a37f;
}

.message-text em {
    font-style: italic;
    color: var(--text-secondary);
}

/* Separadores */
.message-text hr {
    margin: 1em 0;
    border: none;
    border-top: 1px solid #3d3d3d;
}

/* Blockquotes */
.message-text blockquote {
    margin: 0.75em 0;
    padding-left: 1em;
    border-left: 3px solid #10a37f;
    color: var(--text-secondary);
    font-style: italic;
}

/* Cursor de streaming */
.message.streaming .message-text::after {
    content: '▋';
    color: #10a37f;
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

.message-text p {
    margin-bottom: 1rem;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text pre {
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.message-text code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.message-text pre code {
    background: none;
    padding: 0;
}

.message-text :not(pre) > code {
    background: #2a2a2a;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    color: #ec4899;
}

/* Tablas en mensajes */
.message-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
}

.message-text table thead {
    background: #2a2a2a;
}

.message-text table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 500;
    color: #ececec;
    border-bottom: 2px solid #3d3d3d;
}

.message-text table td {
    padding: 0.75rem;
    border-bottom: 1px solid #2d2d2d;
    color: #d4d4d4;
}

.message-text table tr:last-child td {
    border-bottom: none;
}

.message-text table tr:hover {
    background: #2a2a2a;
}

/* Listas */
.message-text ul,
.message-text ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-text li {
    margin: 0.25rem 0;
}

/* Encabezados */
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #ececec;
}

.message-text h1 {
    font-size: 1.5rem;
    border-bottom: 2px solid #3d3d3d;
    padding-bottom: 0.5rem;
}

.message-text h2 {
    font-size: 1.25rem;
}

.message-text h3 {
    font-size: 1.1rem;
}

.message-text h4 {
    font-size: 1rem;
}

/* Blockquotes */
.message-text blockquote {
    border-left: 3px solid #10a37f;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #a0a0a0;
    font-style: italic;
}

/* Links */
.message-text a {
    color: #10a37f;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.message-text a:hover {
    border-bottom-color: #10a37f;
}

/* Líneas horizontales */
.message-text hr {
    border: none;
    border-top: 1px solid #3d3d3d;
    margin: 1.5rem 0;
}

/* Bloques de código con botón copiar */
.message-text pre {
    position: relative;
}

.message-text pre:hover .code-copy-btn {
    opacity: 1;
}

.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-message-action {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #a0a0a0;
    font-size: 0.75rem;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-message-action:hover {
    background: #2a2a2a;
    color: #ececec;
}

/* Botón TTS activo (hablando) */
.btn-message-action.speaking {
    background: #10a37f;
    color: #ffffff;
    border-color: #10a37f;
    animation: pulse-tts 1.5s ease-in-out infinite;
}

@keyframes pulse-tts {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Mensaje de typing indicator */
.typing-indicator {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8e8e8e;
}

.typing-dot:nth-child(2) {
    opacity: 0.8;
}

.typing-dot:nth-child(3) {
    opacity: 0.6;
}

/* ============================================
   Rating Modal
   ============================================ */
.rating-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.rating-modal-content {
    background: #2a2a2a;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.rating-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #3d3d3d;
    position: relative;
}

.rating-modal-header h3 {
    margin: 0 0 0.5rem 0;
    color: #ececec;
    font-size: 1.25rem;
}

.rating-template-name {
    margin: 0;
    color: #10a37f;
    font-size: 0.875rem;
    font-weight: 500;
}

.rating-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.rating-close:hover {
    background: #3d3d3d;
    color: #ececec;
}

.rating-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.rating-instructions {
    margin: 0 0 1.5rem 0;
    color: #a0a0a0;
    font-size: 0.875rem;
}

.rating-criteria {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.rating-criterion {
    padding: 1rem;
    background: #212121;
    border-radius: 8px;
    border: 1px solid #3d3d3d;
}

.criterion-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #ececec;
}

.criterion-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.criterion-description {
    margin: 0 0 0.75rem 0;
    color: #a0a0a0;
    font-size: 0.8125rem;
}

.rating-stars {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.star-btn {
    background: none;
    border: none;
    color: #3d3d3d;
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.2s ease;
}

.star-btn:hover {
    color: #f59e0b;
    transform: scale(1.1);
}

.star-btn.active {
    color: #f59e0b;
}

.affected-params {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.params-label {
    color: #6b7280;
}

.params-list {
    color: #10a37f;
    font-family: 'Courier New', monospace;
}

.rating-notes {
    margin-top: 1.5rem;
}

.rating-notes label {
    display: block;
    margin-bottom: 0.5rem;
    color: #ececec;
    font-size: 0.875rem;
    font-weight: 500;
}

.rating-notes-input {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    background: #212121;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ececec;
    font-size: 0.875rem;
    font-family: inherit;
    resize: vertical;
}

.rating-notes-input:focus {
    outline: none;
    border-color: #10a37f;
}

.rating-modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid #3d3d3d;
}

.btn-rating-cancel,
.btn-rating-submit {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-rating-cancel {
    background: #3d3d3d;
    border: none;
    color: #ececec;
}

.btn-rating-cancel:hover {
    background: #4d4d4d;
}

.btn-rating-submit {
    background: #10a37f;
    border: none;
    color: white;
}

.btn-rating-submit:hover {
    background: #0d8f6d;
}

/* Toast de confirmación */
.rating-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #10a37f;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    gap: 1rem;
    align-items: center;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
}

.rating-toast.show {
    transform: translateY(0);
        opacity: 1;
    }

/* Modal de estadísticas */
.stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.stats-modal-content {
    background: #2a2a2a;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stats-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #3d3d3d;
    position: relative;
}

.stats-modal-header h3 {
    margin: 0;
    color: #ececec;
    font-size: 1.25rem;
}

.stats-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.stats-close:hover {
    background: #3d3d3d;
    color: #ececec;
}

.stats-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.template-stats-card {
    background: #212121;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.template-stats-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.template-stats-header .rank {
    color: #10a37f;
    font-weight: 700;
    font-size: 1.5rem;
}

.template-stats-header .template-name {
    flex: 1;
    color: #ececec;
    font-weight: 600;
    font-size: 1rem;
}

.total-score {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1rem;
}

.total-score.good {
    background: rgba(16, 163, 127, 0.2);
    color: #10a37f;
}

.total-score.medium {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.total-score.bad {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.criteria-scores {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.criterion-score {
    display: grid;
    grid-template-columns: 120px 1fr 50px;
    align-items: center;
    gap: 0.75rem;
}

.criterion-label {
    color: #a0a0a0;
    font-size: 0.8125rem;
}

.score-bar {
    height: 8px;
    background: #3d3d3d;
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #10a37f, #14b88f);
    transition: width 0.3s ease;
}

.score-value {
    color: #ececec;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: right;
}

.recommendations {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #3d3d3d;
}

.recommendations h4 {
    margin: 0 0 0.75rem 0;
    color: #ececec;
    font-size: 0.875rem;
    font-weight: 600;
}

.recommendation {
    margin: 0.5rem 0;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.recommendation.increase {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.recommendation.maintain {
    background: rgba(16, 163, 127, 0.1);
    color: #10a37f;
}

.evaluation-count {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #3d3d3d;
    color: #6b7280;
    font-size: 0.75rem;
    text-align: center;
}

.stats-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #3d3d3d;
}

.btn-export-ratings,
.btn-clear-ratings {
    flex: 1;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-export-ratings {
    background: #3d3d3d;
    border: none;
    color: #ececec;
}

.btn-export-ratings:hover {
    background: #4d4d4d;
}

.btn-clear-ratings {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ef4444;
}

.btn-clear-ratings:hover {
    background: rgba(239, 68, 68, 0.2);
}

.no-data {
    text-align: center;
    color: #6b7280;
    padding: 2rem;
    font-size: 0.875rem;
}

/* ============================================
   Template Selector
   ============================================ */
.template-selector-container {
    padding: 0.75rem 1.5rem 0;
    background: #212121;
    border-top: 1px solid #2d2d2d;
}

.template-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 800px;
    margin: 0 auto;
}

.template-selector label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #a0a0a0;
    font-size: 0.875rem;
    white-space: nowrap;
}

.template-select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ececec;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-select:hover {
    background: #323232;
    border-color: #10a37f;
}

.template-select:focus {
    outline: none;
    border-color: #10a37f;
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.1);
}

.template-select option {
    background: #2a2a2a;
    color: #ececec;
}

.btn-template-stats {
    padding: 0.5rem;
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #a0a0a0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-template-stats:hover {
    background: #323232;
    border-color: #10a37f;
    color: #10a37f;
}

.template-description {
    max-width: 800px;
    margin: 0.5rem auto 0;
    padding: 0.5rem 0.75rem;
    background: #2a2a2a;
    border-radius: 6px;
    color: #a0a0a0;
    font-size: 0.8125rem;
    text-align: center;
}

.template-stats {
    max-width: 800px;
    margin: 0.75rem auto 0;
    padding: 0.75rem;
    background: #2a2a2a;
    border-radius: 8px;
}

.template-stats h4 {
    margin: 0 0 0.75rem 0;
    color: #ececec;
    font-size: 0.875rem;
    font-weight: 600;
}

.top-templates {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.top-template {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #323232;
    border-radius: 6px;
}

.top-template .rank {
    color: #10a37f;
    font-weight: 600;
    font-size: 1rem;
}

.top-template .name {
    flex: 1;
    color: #ececec;
    font-size: 0.875rem;
}

.top-template .score {
    color: #a0a0a0;
    font-size: 0.8125rem;
}

/* ============================================
   Chat Input
   ============================================ */
.chat-input-container {
    padding: 1rem 1.5rem;
    background: #212121;
    border-top: none;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Previsualización de archivos adjuntos */
.attachments-preview {
    max-width: 800px;
    margin: 0 auto 0.75rem auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.attachment-item {
    position: relative;
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 200px;
}

.attachment-item.image {
    padding: 0;
    overflow: hidden;
}

.attachment-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

.attachment-icon {
    width: 32px;
    height: 32px;
    background: #3d3d3d;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ececec;
    flex-shrink: 0;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-size: 0.75rem;
    font-weight: 400;
    color: #ececec;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    font-size: 0.6875rem;
    font-weight: 300;
    color: #8e8e8e;
}

.attachment-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: #565656;
    border: 2px solid #212121;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.attachment-remove:hover {
    background: #ec4899;
}

.attachment-remove i {
    width: 12px;
    height: 12px;
    color: #ececec;
}

.chat-input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: end;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 12px;
    transition: border-color 0.2s ease;
}

.chat-input-wrapper:focus-within {
    border-color: #565656;
    background: #2a2a2a;
}

.message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ececec;
    font-size: 0.875rem;
    font-weight: 300;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    resize: none;
    outline: none;
    max-height: 200px;
    line-height: 1.5;
}

.message-input::placeholder {
    color: #8e8e8e;
}

.btn-send {
    padding: 0.5rem;
    width: 32px;
    height: 32px;
    background: #ececec;
    border: none;
    border-radius: 8px;
    color: #171717;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover:not(:disabled) {
    background: #d4d4d4;
}

.btn-send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #565656;
}

/* Modo stop - botón cuadrado */
.btn-send.stop-mode {
    background: #2a2a2a;
    border: 1px solid #565656;
    color: #ececec;
}

.btn-send.stop-mode:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.chat-input-footer {
    max-width: 800px;
    margin: 0.5rem auto 0;
    text-align: center;
}

.input-hint {
    font-size: 0.6875rem;
    font-weight: 300;
    color: #8e8e8e;
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #3d3d3d;
    background: #2a2a2a;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-close {
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: #ececec;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: #3a3a3a;
}

.modal-body {
    padding: 1.5rem;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #ececec;
    margin-bottom: 0.5rem;
}

.setting-select,
.setting-input {
    width: 100%;
    padding: 0.75rem;
    background: #171717;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ececec;
    font-size: 0.8125rem;
    font-weight: 300;
}

.setting-select:focus,
.setting-input:focus {
    outline: none;
    border-color: #565656;
}

.setting-range {
    width: 100%;
    margin-bottom: 0.5rem;
}

.setting-value {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #171717;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #ececec;
    font-weight: 500;
}

/* ============================================
   USER AUTHENTICATION
   ============================================ */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #1a1a1a;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    margin-bottom: 16px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    color: #ececec;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
}

.user-provider {
    color: #8e8e8e;
    font-size: 12px;
    text-transform: capitalize;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    color: #ececec;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: auto;
}

.logout-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.logout-btn i {
    width: 16px;
    height: 16px;
}

/* ============================================
   CONSENSUS SELECTORS
   ============================================ */
.template-selector,
.model-selector {
    margin: 16px 0;
    padding: 16px;
    background: #1a1a1a;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
}

.template-header,
.model-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #ececec;
    font-size: 14px;
    font-weight: 500;
}

.template-header i,
.model-header i {
    width: 16px;
    height: 16px;
    color: #10a37f;
}

.template-select {
    width: 100%;
    padding: 8px 12px;
    background: #2a2a2a;
    border: 1px solid #3d3d3d;
    border-radius: 6px;
    color: #ececec;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-select:hover {
    border-color: #565656;
}

.template-select:focus {
    outline: none;
    border-color: #10a37f;
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.2);
}

.model-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.model-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ececec;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-checkbox:hover {
    color: #10a37f;
}

.model-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #10a37f;
    cursor: pointer;
}

.model-checkbox span {
    user-select: none;
}

/* ============================================
   ENTROPY MONITOR
   ============================================ */
.stat-entropy {
    font-weight: 600;
    transition: all 0.3s ease;
}

.stat-entropy.entropy-low {
    color: #10b981;  /* Verde - Predecible */
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
}

.stat-entropy.entropy-normal {
    color: #3b82f6;  /* Azul - Normal */
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
}

.stat-entropy.entropy-medium {
    color: #f59e0b;  /* Naranja - Creativo */
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
}

.stat-entropy.entropy-high {
    color: #ef4444;  /* Rojo - Aleatorio */
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
}

.stat-entropy i {
    animation: pulse-entropy 2s ease-in-out infinite;
}

@keyframes pulse-entropy {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================
   MCP INDICATOR
   ============================================ */
.mcp-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(16, 163, 127, 0.15);
    border: 1px solid rgba(16, 163, 127, 0.4);
    color: #10a37f;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.mcp-badge i {
    width: 12px;
    height: 12px;
}

.mcp-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

.mcp-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #212121;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mcp-status:hover {
    background: #2a2a2a;
    border-color: #565656;
}

.mcp-status.active {
    border-color: #10a37f;
    color: #10a37f;
}

.mcp-status.active i {
    animation: pulse-mcp 2s ease-in-out infinite;
}

.mcp-status.inactive {
    color: #8e8e8e;
}

.mcp-status i {
    width: 16px;
    height: 16px;
}

@keyframes pulse-mcp {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    /* Prevenir overflow horizontal en toda la app */
    body, html {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 200;
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.hidden {
        transform: translateX(-280px);
    }
    
    .sidebar-toggle {
        display: block;
        left: 1rem !important;
    }
    
    .chat-main {
        width: 100%;
        margin-left: 0 !important;
        overflow-x: hidden;
    }
    
    .chat-area {
        width: 100%;
        overflow-x: hidden;
    }
    
    .chat-content-wrapper {
        overflow-x: hidden;
    }
    
    .suggestion-cards {
        grid-template-columns: 1fr;
    }
    
    .messages-container {
        padding: 0.75rem 0.5rem;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    .chat-input-container {
        padding: 0.75rem 0.5rem;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    .chat-input-wrapper {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .message {
        margin-bottom: 1.5rem;
    }
}

@media (min-width: 769px) {
    .chat-page {
        position: relative;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
    }
    
    .chat-main {
        margin-left: 280px;
    }
    
    .sidebar.hidden ~ .chat-main {
        margin-left: 0;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */
.sidebar-content::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track {
    background: #171717;
}

.sidebar-content::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb {
    background: #3d3d3d;
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover {
    background: #565656;
}

/* ============================================
   Overlay cuando el sidebar está abierto
   ============================================ */
.sidebar-overlay {
        position: fixed;
        top: 0;
    left: 0;
        right: 0;
        bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* En desktop, el overlay es más sutil */
@media (min-width: 769px) {
    .sidebar-overlay.active {
        background: rgba(0, 0, 0, 0.3);
    }
}

/* En móvil, el overlay es más oscuro */
@media (max-width: 768px) {
    .sidebar-overlay.active {
        background: rgba(0, 0, 0, 0.6);
    }
    
    /* ============================================
       Adaptaciones Móviles para Plantillas
       ============================================ */
    
    /* Ocultar sidebar de plantillas en móvil */
    .templates-sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        height: 100vh;
        z-index: 250;
        transition: transform 0.3s ease;
    }
    
    .templates-sidebar.show {
        transform: translateX(240px);
    }
    
    /* Ajustar chat-content-wrapper cuando sidebar está oculto */
    .chat-content-wrapper {
        width: 100%;
    }
    
    /* Banner beta más compacto */
    .beta-banner {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
        flex-wrap: wrap;
    }
    
    .beta-banner span {
        font-size: 0.75rem;
    }
    
    /* Botones mucho más compactos para móvil */
    .message-actions {
        flex-wrap: wrap;
        gap: 0.15rem;
        margin-top: 0.4rem;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .btn-message-action {
        min-width: 32px;
        min-height: 32px;
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        flex-shrink: 1;
    }
    
    .btn-message-action i {
        width: 10px !important;
        height: 10px !important;
    }
    
    /* Chat actions ultra compactas */
    .chat-actions {
        gap: 0.15rem;
        flex-wrap: wrap;
        max-width: 40%;
        justify-content: flex-end;
    }
    
    .chat-actions .btn-icon {
        min-width: 32px;
        min-height: 32px;
        padding: 0.4rem;
        flex-shrink: 0;
    }
    
    .chat-actions i {
        width: 14px !important;
        height: 14px !important;
    }
    
    .server-status {
        display: none !important; /* Ocultar en móvil */
    }
    
    .consensus-indicator {
        display: none !important; /* Ocultar en móvil */
    }
    
    .template-item {
        padding: 1rem;
        min-height: 48px;
    }
    
    /* Input más accesible */
    .message-input {
        font-size: 16px; /* Evita zoom automático en iOS */
    }
    
    .btn-send {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Chat header más compacto y sin overflow */
    .chat-header {
        padding: 0.75rem 0.75rem;
        gap: 0.5rem;
        overflow-x: hidden;
    }
    
    .chat-title {
        font-size: 0.8rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Mensajes con menos padding y sin overflow */
    .message {
        padding: 0.5rem 0.75rem;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .message-content {
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
        word-break: break-word;
    }
    
    .message-content pre {
        max-width: 100%;
        overflow-x: auto;
    }
    
    .message-content code {
        word-break: break-all;
    }
    
    /* Template selector items más grandes */
    .template-select {
        font-size: 16px;
        padding: 0.75rem;
    }
}

/* Ajustes para pantallas muy pequeñas */
@media (max-width: 480px) {
    .beta-banner strong {
        display: block;
        width: 100%;
        margin-bottom: 0.25rem;
    }
    
    .suggestion-card {
        padding: 0.75rem;
    }
    
    .message-content {
        font-size: 0.875rem;
    }
}

