:root {
    --primary-color: #5513d1;
    --secondary-color: #6d31df;
    --bg-color: #0f0f0f;
    --text-color: #e2e8f0;
    --light-gray: #1e1e1e;
    --dark-gray: #94a3b8;
    --darker-gray: #2a2a2a;
    --border-color: #333333;
    --border-radius: 10px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 2rem);
}

.header {
    padding: 1rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 600;
}

.settings-button {
    position: absolute;
    left: 1rem;
    background-color: var(--darker-gray);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.2s, border-color 0.2s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-button:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.history-button {
    position: absolute;
    right: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

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

/* Settings Modal */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.settings-modal-content {
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-modal-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group label {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

.setting-input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--darker-gray);
    color: var(--text-color);
    border-radius: 5px;
    font-size: 0.9rem;
}

.setting-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.setting-textarea {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--darker-gray);
    color: var(--text-color);
    border-radius: 5px;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.setting-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.setting-group:has(select) {
    position: relative;
}

.setting-group:has(select)::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--dark-gray);
    font-size: 0.8rem;
}

select.setting-input {
    appearance: none;
    background-image: none;
    padding-right: 2rem;
}

.refresh-btn {
    background-color: var(--darker-gray);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 0.5rem;
    transition: background-color 0.2s;
    width: fit-content;
}

.refresh-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.setting-slider {
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 5px;
    background: var(--darker-gray);
    outline: none;
}

.setting-slider::-webkit-slider-thumb {
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.setting-slider::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.settings-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

.save-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.save-btn:hover {
    background-color: var(--secondary-color);
}

.reset-btn {
    background-color: var(--darker-gray);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s;
}

.reset-btn:hover {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-gray);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: var(--text-color);
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 500;
    z-index: 2000;
    animation: slideIn 0.3s ease-out;
}

.notification.success {
    background-color: var(--success-color);
}

.notification.error {
    background-color: var(--error-color);
}

.notification.info {
    background-color: var(--primary-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* History Modal */
.history-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.history-modal-content {
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.history-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.history-modal-header h2 {
    margin: 0;
    color: var(--primary-color);
}

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

.history-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--darker-gray);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.history-item:hover {
    background-color: #3a3a3a;
    border-color: var(--primary-color);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-item-title {
    font-weight: bold;
    color: var(--text-color);
}

.history-item-date {
    font-size: 0.8rem;
    color: var(--dark-gray);
}

.history-item-preview {
    color: var(--dark-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.history-action-button {
    background-color: var(--darker-gray);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s, border-color 0.2s;
}

.history-action-button:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.history-action-button.delete {
    color: #ef4444;
    border-color: #ef4444;
}

.history-action-button.delete:hover {
    background-color: #ef4444;
    border-color: #ef4444;
    color: white;
}

.no-history {
    text-align: center;
    color: var(--dark-gray);
    padding: 2rem;
}

.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    background: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

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

.mgs{
    margin-top: 70%;
    font-family: 'Courier New', Courier, monospace;
    font-size: 2rem;
    text-align: center;
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    max-width: 80%;
}

.message.user {
    background-color: var(--primary-color);
    color: white;
    margin-left: auto;
}

.message.bot {
    background-color: var(--darker-gray);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    margin-right: auto;
}

.message-metadata {
    font-size: 0.75rem;
    color: var(--dark-gray);
    margin-bottom: 0.25rem;
}

.message.user .message-metadata {
    color: rgba(255, 255, 255, 0.7);
}

.message-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.message-content code {
    background-color: rgba(0, 0, 0, 0.3);
    color: #a8e6cf;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Andale Mono', monospace;
}

.message-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5rem 0;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-image:hover {
    transform: scale(1.05);
}

.image-preview-container {
    margin-top: 0.5rem;
    position: relative;
}

.image-preview {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-image-btn:hover {
    background: rgba(239, 68, 68, 1);
}

.input-area {
    display: flex;
    flex-direction: column;
    padding: 10px;
    border: 0;
    background-color: var(--bg-color);
}

.input-controls {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.message-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    background-color: var(--light-gray);
    color: var(--text-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    resize: none;
    min-height: 24px;
    max-height: 150px;
    overflow-y: auto;
    box-sizing: border-box;
}

.message-input::placeholder {
    color: var(--dark-gray);
}

.message-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.file-input {
    display: none;
}

.image-button {
    padding: 0.75rem;
    background-color: var(--darker-gray);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.image-button:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.send-button {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

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

.send-button:disabled {
    background-color: var(--darker-gray);
    color: var(--dark-gray);
    cursor: not-allowed;
}

.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

.status-bar {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-dot.connected {
    background-color: #10b981;
}

.status-dot.disconnected {
    background-color: #ef4444;
}

.current-model {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-left: auto;
    margin-right: 1rem;
}

.markdown p {
    margin: 0.5rem 0;
}

.markdown pre {
    background-color: #1a1a1a;
    color: #e2e8f0;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.markdown code {
    font-family: 'Consolas', 'Monaco', 'Andale Mono', monospace;
}

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

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
}

.image-modal-close:hover {
    color: #ccc;
}

/* Scrollbar styling for dark theme */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--darker-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Add responsiveness */
@media (max-width: 768px) {
    .message {
        max-width: 90%;
    }
    
    .input-controls {
        flex-wrap: wrap;
    }
    
    .image-preview {
        max-width: 150px;
        max-height: 100px;
    }
    
    .settings-modal-content,
    .history-modal-content {
        width: 95%;
        padding: 1rem;
    }
    
    .header {
        padding: 0.5rem 0;
    }
    
    .settings-button,
    .history-button {
        position: static;
        margin: 0 0.5rem;
    }
    
    .header {
        justify-content: space-between;
        padding: 0.5rem 1rem;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .current-model {
        margin: 0;
    }
}