:root {
    --primary-color: #00ff88;
    --secondary-color: #00cc6936;
    --text-color: #e2e8f0;
    --background-color: #1a202c; 
    --font: 'Consolas', 'Monaco', 'Lucida Console', monospace;
   

    /* please update these variables to change the color scheme of the chat interface */
    /* --primary-color: #cd1094;
    --secondary-color: #cd109447;
    --text-color: #0c0c0c;
    --background-color: #dddddd;
    --font: 'Helvetica Neue', 'Arial', sans-serif; */
   
} 

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

body {
    font-family: var(--font);
    min-height: 100vh;
    height: 100vh;
    color: var(--text-color);
    background: var(--background-color);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.main-container {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
    border: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 20px;
}

.tab-container {
    border-bottom: 1px solid #909090;
    display: flex;
    padding: 0 20px;
}

.tab {
    background: none;
    padding: 12px 20px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.tab:hover {
    opacity: 0.8;
}

.tab.active {
    color: var(--primary-color);;
    border-bottom: 2px solid var(--primary-color);;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
}

.tab-content {
    flex: 1;
    display: none;
    flex-direction: column;
    padding: 20px;
    min-height: 0; /* Important for flex containers */
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #4a5568 #1e1e2e;
    min-height: 0; /* Important for flex containers */
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #1e1e2e;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    width: fit-content;
    max-width: 90%;
    word-wrap: break-word;
    animation: slideIn 0.3s ease-out;
    font-size: 14px;
    line-height: 1.4;
}

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

.message.user {
    background: linear-gradient(135deg, #00a8ff 0%, #0078d4 100%);
    color: white;
    margin-left: auto;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0, 120, 212, 0.3);
}

.message.assistant {
    background: #2d3748;
    color: #e2e8f0;
    margin-right: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Clean markdown formatting using standard HTML elements */
.message h1, .message h2, .message h3, .message h4, .message h5, .message h6 {
    color: #ffffff;
    font-weight: 600;
    margin: 16px 0 8px 0;
    line-height: 1.2;
}

.message h1 {
    font-size: 18px;
    border-bottom: 2px solid var(--primary-color);;
    padding-bottom: 4px;
}

.message h2 {
    font-size: 16px;
    border-bottom: 1px solid #4a5568;
    padding-bottom: 2px;
}

.message h3 {
    font-size: 15px;
    color: var(--primary-color);;
}

.message h4 {
    font-size: 14px;
    color: #cbd5e0;
}

.message h5, .message h6 {
    font-size: 13px;
}

.message p {
    margin: 8px 0;
    line-height: 1.6;
}

.message ul, .message ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message li {
    margin: 4px 0;
    line-height: 1.5;
}

.message ul li {
    list-style-type: disc;
}

.message ol li {
    list-style-type: decimal;
}

.message blockquote {
    border-left: 4px solid var(--primary-color);;
    margin: 12px 0;
    padding: 8px 12px;
    background: rgba(0, 255, 136, 0.1);
    font-style: italic;
}

.message pre {
    background: #1a202c;
    border: 1px solid #4a5568;
    border-radius: 4px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    
    font-size: 13px;
    line-height: 1.4;
}

.message pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

.message code {
    background: #1a202c;
    border: 1px solid #4a5568;
    border-radius: 3px;
    padding: 2px 6px;
    
    font-size: 13px;
    color: var(--primary-color);
}

.message table {
    border-collapse: collapse;
    margin: 12px 0;
    width: 100%;
    font-size: 13px;
}

.message th, .message td {
    border: 1px solid #4a5568;
    padding: 8px 12px;
    text-align: left;
}

.message th {
    background: #2d3748;
    font-weight: 600;
    color: var(--primary-color);;
}

.message td {
    background: #1a202c;
}

.message hr {
    border: none;
    border-top: 1px solid #4a5568;
    margin: 16px 0;
}

.message strong {
    font-weight: 600;
    color: #ffffff;
}

.message em {
    font-style: italic;
    color: #cbd5e0;
}

.message a {
    color: var(--primary-color);;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.message a:hover {
    color: var(--primary-color);
}

.message.system {
    background: #1a202c;
    color: #ffd700;
    font-style: italic;
    margin: 15px auto;
    text-align: center;
    font-size: 13px;
    max-width: fit-content;
    border: 1px solid #4a5568;
}

.message.system .message-row {
    display: block !important;
}

.message.progress {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    margin: 0 auto;
    text-align: center;
    font-size: 13px;
    max-width: 60%;
    border: 1px solid #dd6b20;
    box-shadow: 0 2px 8px rgba(237, 137, 54, 0.3);
}

.message.thinking {
    background: linear-gradient(135deg, #38b2ac 0%, #319795 100%);
    color: white;
    margin: 0 auto;
    text-align: center;
    font-size: 13px;
    max-width: 60%;
    border: 1px solid #319795;
    box-shadow: 0 2px 8px rgba(56, 178, 172, 0.3);
}

.timestamp {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    
}

.chat-input {
    padding: 20px;
    border-top: 1px solid #4a5568;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
}

.message-input {
    flex: 1;
    padding: 7px 16px;
    border: 1px solid #4a5568;
    border-radius: 6px;
    color: var(--text-color);
    background: inherit;
    outline: none;
    font-size: 14px;
    transition: all 0.3s ease;
    resize: none;
    min-height: 32px;
    max-height: 320px;
    line-height: 1.4;
    overflow-y: auto;
}

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

.send-button {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    flex-shrink: 0;
    width: 80px;
}

.send-button:hover:not(:disabled) {
    opacity: 0.8;
}

.send-button:disabled {
    background: #4a5568;
    color: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.status {
    font-size: 13px;
    text-align: center;
    flex-shrink: 0;
}

.status-inner {
    padding: 8px 12px;
    border-top: 1px solid #4a5568;
}

.status-bar-icon {
    margin-right: 6px;
}

.status-bar-text {
    display: inline;
}

.status.processing {
    color: #ffd700;
}

.connection-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    text-transform: uppercase;
    min-width: 120px;
    text-align: center;
}

.connection-status.connected {
    color: #00ca00;
    border: 1px solid #00ca00;
}

.connection-status.disconnected {
    color: red;
    border: 1px solid red;
}

.end-session-button {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    text-transform: uppercase;
    background: none;
    color: #ffa500;
    cursor: pointer;
    min-width: 90px;
    text-align: center;
    border: 1px solid #ffa500;
}

.end-session-button:hover:not(:disabled) {
    opacity: 0.8;
}

.end-session-button:disabled {
    background: rgba(128, 128, 128, 0.2);
    color: #808080;
    border: 1px solid #808080;
    cursor: not-allowed;
    transform: none;
}

.demo-info {
    position: absolute;
    bottom: 15px;
    left: 20px;
    font-size: 10px;
    color: rgba(224, 224, 224, 0.5);
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    
}

.tools-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flex containers */
    overflow: hidden;
}

.tools-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
}

.tools-header h2 {
    font-size: 20px;
    margin: 0;
}

.clear-tools-button {
    padding: 8px 16px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.clear-tools-button:hover {
    background: linear-gradient(135deg, #ee5a52 0%, #dc3545 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.tools-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #4a5568 #1e1e2e;
    min-height: 0; /* Important for flex containers */
}

.tools-list::-webkit-scrollbar {
    width: 8px;
}

.tools-list::-webkit-scrollbar-track {
    background: #1e1e2e;
}

.tools-list::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

.tools-list::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

.no-tools-message {
    text-align: center;
    font-style: italic;
    margin-top: 50px;
    font-size: 14px;
}

.tool-item {
    border: 1px solid #4a5568;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 16px;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease-out;
}

.tool-item.success {
    border-left: 4px solid var(--primary-color);
}

.tool-item.error {
    border-left: 4px solid #ff6b6b;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.tool-header:hover {
    background-color: var(--secondary-color);
}

.tool-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-name {
    font-size: 16px;
    font-weight: 600;
}

.tool-id {
    font-size: 12px;
    background: #1a202c;
    color: #cbd5e0;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #4a5568;
}

.toggle-button {
    background: none;
    border: none;
    color: var(--primary-color);;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    
}

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

.toggle-button.collapsed::before {
    content: "▶ ";
}

.toggle-button.expanded::before {
    content: "▼ ";
}

.tool-details {
    margin-top: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.tool-details.collapsed {
    max-height: 0;
    margin-top: 0;
    opacity: 0;
}

.tool-details.expanded {
    max-height: 1000px;
    opacity: 1;
}

.tool-section {
    margin-bottom: 12px;
}

.tool-section strong {
    color: var(--primary-color);;
    font-size: 12px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
}

.tool-args,
.tool-result {
    background: #1a202c;
    border: 1px solid #4a5568;
    color: #e2e8f0;
    border-radius: 4px;
    padding: 10px;
    font-size: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
}

.tool-args {
    color: #ffd700;
}

.code-accent {
    color: var(--primary-color);;
}

.glow {
    text-shadow: 0 0 10px currentColor;
}

/* Upload Button and Components */
.input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    width: 100%;
}

.upload-button {
    padding: 12px 20px;
    border: 1px solid #4a5568;
    border-radius: 6px;
    cursor: pointer;
    background: #2d3748;
    color: var(--primary-color);
    font-size: 18px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.upload-button:disabled {
    background: #4a5568;
    color: #a0aec0;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Upload Modal */
.upload-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.upload-modal-content {
    background: var(--background-color);
    border: 1px solid #4a5568;
    border-radius: 12px;
    padding: 24px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.upload-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.upload-modal-header h3 {
    font-size: 18px;
    color: var(--primary-color);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #cbd5e0;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #4a5568;
    color: var(--primary-color);
}

.upload-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.upload-option {
    width: 100%;
}

.upload-option-button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border: 2px solid #4a5568;
    border-radius: 8px;
    color: var(--text-color);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.upload-option-button:hover {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

.upload-option-button i {
    font-size: 20px;
    color: var(--primary-color);
}

.url-input-container {
    display: flex;
    gap: 8px;
}

.url-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #4a5568;
    border-radius: 8px;
    background: #1a202c;
    color: var(--text-color);
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.url-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--secondary-color);
}

.url-submit-button {
    padding: 12px 20px;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    color: #1a202c;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.url-submit-button:hover {
    opacity: 0.8;
}

/* Attachments Preview */
.attachments-preview {
    padding: 12px;
    border-bottom: 1px solid #4a5568;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 150px;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-color);
    animation: slideIn 0.2s ease-out;
}

.attachment-chip i.fa-file,
.attachment-chip i.fa-image,
.attachment-chip i.fa-video,
.attachment-chip i.fa-file-pdf,
.attachment-chip i.fa-file-audio {
    color: var(--primary-color);
}

.attachment-chip i.fa-link {
    color: #00a8ff;
}

.attachment-chip .attachment-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-chip .remove-attachment {
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    transition: all 0.2s ease;
}

.attachment-chip .remove-attachment:hover {
    color: #ff5252;
    transform: scale(1.2);
}

.send-button, .upload-button, .message-input {
    height: 40px;
}

/* Attachment Header for Tab View */
.attachment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
}

.remove-attachment-button {
    padding: 6px 16px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.remove-attachment-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #ee5a52 0%, #dc3545 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.remove-attachment-button:disabled {
    background: #4a5568;
    color: #a0aec0;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

/* Connection status icons */
.status-icon-connected {
    color: green;
}

.status-icon-disconnected {
    color: red;
}

/* Tool and attachment status icons */
.status-icon-success {
    color: green;
}

.status-icon-error {
    color: red;
}

.status-icon-sent {
    color: #00ff88;
}

.status-icon-pending {
    color: #ffd700;
}

/* Message row layout */
.message-row {
    display: flex;
    gap: 10px;
    align-items: baseline;
}

/* Utility classes for visibility */
.hidden {
    display: none !important;
}

.visible {
    display: block;
}

/* Templates should be hidden */
template {
    display: none;
}

/* Avatar styles */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.avatar-assistant {
    background: linear-gradient(135deg, var(--primary-color) 0%, #00cc69 100%);
    color: #1a202c;
    font-size: 16px;
}

/* Message content wrapper */
.message-content {
    flex: 1;
    min-width: 0;
}

.message-text {
    word-wrap: break-word;
}

/* Upload modal visibility states */
.upload-modal.modal-visible {
    display: flex;
}

.upload-modal.modal-hidden {
    display: none;
}
