:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --bg-color: #f3f4f6;
    --sidebar-bg: #1f2937;
    --text-color: #374151;
    --border-color: #e5e7eb;
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text-color);
    line-height: 1.5;
}

/* Autenticación */
.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-color);
}

.auth-container {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
}

.auth-buttons {
    display: flex;
    gap: 0.5rem;
}

.auth-buttons button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 0.375rem;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.auth-buttons button:hover {
    background-color: var(--secondary-color);
}

/* Aplicación principal */
.app-container {
    display: flex;
    height: 100vh;
}

.hidden {
    display: none !important;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-buttons {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-buttons button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 0.375rem;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.chat-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-item.active {
    background-color: rgba(255, 255, 255, 0.2);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Área principal */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.message {
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

.message-user {
    display: flex;
    justify-content: flex-end;
}

.message-assistant {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-user .message-content {
    background-color: var(--primary-color);
    color: white;
}

/* Área de entrada de mensaje */
.chat-input {
    padding: 1rem;
    background-color: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

.chat-input textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    resize: none;
    height: 2.5rem;
    line-height: 1.2;
}

.chat-input button {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.375rem;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-input button:hover {
    background-color: var(--secondary-color);
}

/* Código y Markdown */
.code-block {
    margin: 1rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: #2d2d2d;
    color: white;
}

.code-block-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.code-block-header button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.markdown-content {
    line-height: 1.6;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    margin: 1.5rem 0 1rem;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

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

/**/

/* Modo oscuro */
.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --sidebar-bg: #2d2d2d;
    --border-color: #404040;
}

.dark-mode .message-content {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

.dark-mode .chat-input {
    background-color: #2d2d2d;
}

.dark-mode .chat-input textarea {
    background-color: #1a1a1a;
    color: #e0e0e0;
    border-color: #404040;
}

/* Indicador de escritura */
.typing-indicator {
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
    margin: 0.5rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Toolbar para funciones adicionales */
.chat-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.chat-toolbar button {
    padding: 0.5rem;
    border: none;
    border-radius: 0.375rem;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Estilo para mensajes marcados como favoritos */
.message.bookmarked {
    border-left: 4px solid var(--primary-color);
}

/* Panel de snippets */
.snippets-panel {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 300px;
    background-color: white;
    border-left: 1px solid var(--border-color);
    padding: 1rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.snippets-panel.active {
    transform: translateX(0);
}

/* Estilos para resultados de búsqueda */
.search-highlight {
    background-color: yellow;
    padding: 0.2rem;
    border-radius: 0.2rem;
}

/**/

/* Paneles */
.search-panel {
    position: fixed;
    top: 0;
    right: 0;
    background: white;
    padding: 1rem;
    border-radius: 0 0 0 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.search-panel.active {
    transform: translateY(0);
}

.search-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-input input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    width: 200px;
}

.search-input button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
}

/* Ajustes para modo oscuro */
.dark-mode .search-panel,
.dark-mode .snippets-panel {
    background: var(--sidebar-bg);
    color: white;
}

.dark-mode .search-input input {
    background: var(--bg-color);
    color: white;
    border-color: var(--border-color);
}

/**/

.side-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background-color: #ffffff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.side-panel.active {
    right: 0;
}

.panel-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f8f9fa;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #2d3748;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.snippet-categories {
    margin-bottom: 1rem;
}

.category-button {
    padding: 0.5rem 1rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s;
}

.category-button.active {
    background-color: #4a5568;
    color: white;
}

.snippet-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.snippet-item {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.snippet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.snippet-content {
    padding: 1rem;
    background-color: #ffffff;
}

.snippet-actions {
    display: flex;
    gap: 0.5rem;
}

.snippet-actions button {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 0.25rem;
    background-color: #4a5568;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.snippet-actions button:hover {
    background-color: #2d3748;
}

/* Dark mode styles */
.dark-mode .side-panel {
    background-color: #1a202c;
    border-left: 1px solid #2d3748;
}

.dark-mode .panel-header {
    background-color: #2d3748;
    border-bottom: 1px solid #4a5568;
}

.dark-mode .panel-header h3 {
    color: #e2e8f0;
}

.dark-mode .snippet-item {
    border-color: #4a5568;
    background-color: #2d3748;
}

.dark-mode .snippet-header {
    background-color: #4a5568;
    border-bottom: 1px solid #2d3748;
    color: #e2e8f0;
}

.dark-mode .snippet-content {
    background-color: #1a202c;
    color: #e2e8f0;
}