
/* Reset y variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: linear-gradient(135deg, #00ffd1 0%, #6900ff 100%);
    --primary-hover: #106ebe;
    --secondary-color: #f3f2f1;
    --border-color: #d1d1d1;
    --text-color: #323130;
    --text-light: #605e5c;
    --bg-color: #ffffff;
    --panel-bg: #faf9f8;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 8px rgba(0,0,0,0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--panel-bg);
    color: var(--text-color);
    overflow: hidden;
}

/* Layout principal */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    font-size: 14px;
}

.app-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.window-controls {
    display: flex;
    gap: 4px;
}

.window-btn {
    background: none;
    border: none;
    color: white;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.window-btn:hover {
    background: rgba(255,255,255,0.1);
}

.window-btn.close:hover {
    background: #e74c3c;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 16px;
    background: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
}

.toolbar-section {
    display: flex;
    gap: 4px;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.toolbar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-color);
    font-size: 12px;
}

.toolbar-btn:hover {
    background: rgba(0,120,212,0.1);
    color: var(--primary-color);
}

.toolbar-btn i {
    font-size: 18px;
}
.ailogo{
    width: auto;
    height: 30px;
}

/* Contenido principal */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
}

.editor-toolbar {
    border-bottom: 1px solid var(--border-color);
}

.editor-container {
    flex: 1;
    overflow: auto;
}

#editor {
    height: 100%;
    background: var(--bg-color);
}

/* Estilos personalizados para Quill */
.ql-toolbar {
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: var(--secondary-color) !important;
}

.ql-container {
    border: none !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

.ql-editor {
    padding: 20px !important;
    line-height: 1.6 !important;
    font-size: 14px !important;
}

.ql-editor.ql-blank::before {
    color: var(--text-light) !important;
    font-style: normal !important;
}

/* Panel del chat */
.chat-panel {
    width: 400px;
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
    display: none;
    flex-direction: column;
}

.chat-panel.open {
    display: flex;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--secondary-color);
}

.chat-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-light);
    transition: all 0.2s;
}

.chat-close:hover {
    background: rgba(0,0,0,0.1);
    color: var(--text-color);
}

.chat-status {
    padding: 16px;
    text-align: center;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-light);
}

.chat-status.hidden {
    display: none;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.4;
    font-size: 14px;
}

.message.user {
    background: var(--secondary-color);
    color: rgb(0, 0, 0);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    border: 1px solid var(--border-color);
}

.message.assistant {
    background: var(--primary-color);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    
}

.chat-input-container {
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

#chat-input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    background: var(--bg-color);
    color: var(--text-color);
}

#chat-input:disabled {
    background: var(--panel-bg);
    color: var(--text-light);
}

.chat-actions {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    background: var(--panel-bg);
}

.chat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    flex: 1;
    justify-content: center;
}

.chat-btn:hover:not(:disabled) {
    background: var(--secondary-color);
    border-color: var(--primary-color);
}

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

.chat-btn.primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

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

/* Scrollbar personalizado */
.chat-messages::-webkit-scrollbar,
.editor-container::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.editor-container::-webkit-scrollbar-track {
    background: var(--panel-bg);
}

.chat-messages::-webkit-scrollbar-thumb,
.editor-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.editor-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-panel {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1000;
        height: 100%;
    }
    
    .toolbar-btn span {
        display: none;
    }
    
    .toolbar-btn {
        padding: 8px;
    }
}

/* Estados de carga */
.chat-thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--secondary-color);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 85%;
    font-size: 14px;
    color: var(--text-light);
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dot {
    width: 6px;
    height: 6px;
    background: var(--text-light);
    border-radius: 50%;
    animation: thinking 1.4s ease-in-out infinite both;
}

.thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.thinking-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes thinking {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}