.video-progress { margin: 8px 0; }
.video-progress .progress-bar { width: 100%; height: 8px; background: rgba(255,255,255,0.15); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.video-progress .progress-fill { height: 100%; width: 0%; background: var(--accent-color); transition: width 0.4s ease; }
.video-progress .progress-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
/* Ensure icons in these titles also render with the gradient */
.model-hub-panel h3 i,
.settings-panel h3 i {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}
/* Model search pretty table */
.model-search-results { margin-top: 8px; }
.model-search-results h4 { margin: 4px 0 6px; }
.model-table { width: 100%; border-collapse: collapse; border-spacing: 0; font-size: 0.92rem; table-layout: auto; }
.model-table th, .model-table td { border: 1px solid #e3e3e3; padding: 6px 10px; vertical-align: top; }
/* Prevent wrapping for column titles only */
.model-table th { white-space: nowrap; }
/* Allow content cells to wrap so table fits chat width */
.model-table td { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
/* Column sizing tuned to fit within chat bubble (after removing License column) */
.model-table th:nth-child(2), .model-table td:nth-child(2) { min-width: 260px; }
.model-table th:nth-child(3), .model-table td:nth-child(3) { min-width: 120px; text-align: right; }
.model-table th:nth-child(4), .model-table td:nth-child(4) { min-width: 100px; }
.model-table th { background: #f6f8fa; text-align: left; }
.model-table code { background: #f3f3f3; padding: 2px 4px; border-radius: 3px; white-space: normal; }
/* Classification results pretty table */
.classification-table { width: 100%; border-collapse: separate; border-spacing: 12px 0; font-size: 0.92rem; }
.classification-table th, .classification-table td { border: 1px solid #e3e3e3; padding: 8px 12px; vertical-align: top; }
.classification-table td:nth-child(3) { text-align: right; }
.classification-table th { background: #f6f8fa; text-align: left; }
:root {
    --primary-color: #667eea;
    --primary-hover: #5a6fd8;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #764ba2;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 8px rgba(0,0,0,0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
    /* layout variables */
    --left-panel-width: 320px;
    --center-width: 960px;
    --right-panel-width: 360px;
    --grid-gap: 24px;
    --page-pad: 0px;
    --dock-height: 120px;
}

/* FUTURE THEME TOKENS */
.theme-future {
    --bg-offwhite: #f5f3ef;
    --text-main: #111316;
    --accent-1: #7C3AED;
    --accent-2: #A78BFA;
    --glass-fill: rgba(255, 255, 255, 0.36);
    --glass-stroke: rgba(17, 19, 22, 0.06);
    --glass-shadow: 0 8px 28px rgba(17, 12, 30, 0.15);
}

.theme-future body,
body.theme-future {
    background: var(--bg-offwhite);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.theme-future header { display: none; }

/* Theme toggle control */
.theme-toggle {
    position: fixed;
    top: 16px;
    right: calc(var(--right-panel-width) + var(--grid-gap) + 12px);
    z-index: 9999; /* float above chat */
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.theme-toggle .switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.theme-toggle .switch input { opacity: 0; width: 0; height: 0; }
.theme-toggle .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ddd; transition: .2s; border-radius: 999px; }
.theme-toggle .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; transition: .2s; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.theme-toggle input:checked + .slider { background: linear-gradient(135deg, var(--accent-1), var(--accent-2)); }
.theme-toggle input:checked + .slider:before { transform: translateX(20px); }
.theme-toggle .theme-label { font-size: 12px; font-weight: 600; }
.theme-toggle .theme-label { text-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.theme-toggle .slider { box-shadow: 0 4px 10px rgba(0,0,0,0.15); }

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

/* Global typography: Inter for UI; Space Grotesk for brand; JetBrains Mono for code */
html, body, button, input, select, textarea {
    font-family: 'Inter', 'Space Grotesk', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

body {
    font-family: 'Inter', 'Space Grotesk', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark-color);
    line-height: 1.6;
}

/* Sleek fonts for major UI elements */
h1, h2, h3, h4, h5, h6,
.brand-logo,
.task-header span,
.primary-btn,
.secondary-btn,
.theme-toggle .theme-label {
    font-family: 'Inter', 'Space Grotesk', system-ui, sans-serif;
    letter-spacing: 0.2px;
}

html, body { height: 100%; overflow: hidden; }

.container {
    max-width: 100vw;
    margin: 0 auto;
    padding: var(--page-pad);
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.model-selector label {
    font-weight: 600;
    color: var(--dark-color);
    font-family: 'Space Grotesk', system-ui, sans-serif;
}

.model-selector select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: white;
    font-family: 'Inter', system-ui, sans-serif;
}

.model-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

main {
    display: grid;
    grid-template-columns: var(--left-panel-width) 1fr var(--right-panel-width);
    grid-template-rows: 1fr;
    gap: var(--grid-gap);
    flex: 1;
    height: calc(100vh - 0px);
    width: 100vw;
    transition: grid-template-columns 320ms ease;
}

/* Ensure proper grid column assignments */
.model-hub-panel { grid-column: 1; grid-row: 1; height: 100vh; overflow-y: auto; scrollbar-width: none; }
.model-hub-panel::-webkit-scrollbar { width: 0; height: 0; }

/* Regular settings panels go to the third column */
.settings-panel { grid-column: 3; grid-row: 1; height: 100vh; overflow-y: auto; scrollbar-width: none; }
.settings-panel::-webkit-scrollbar { width: 0; height: 0; }

/* Agent orchestration panel goes under chat in first column */
/* keep agent panel on the right stack */

.chat-container {
    position: relative;
    background: transparent;
    border-radius: 18px;
    padding: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    height: 100vh;
    width: 100%;
    grid-column: 2; /* explicit default placement in center column */
    /* Keep chat centered and stable during panel transitions */
    max-width: calc(100vw - var(--left-panel-width) - var(--right-panel-width) - (2 * var(--grid-gap)));
    margin-left: auto;
    margin-right: auto;
    justify-self: center;
    transition: max-width 320ms ease, margin 320ms ease;
}

.chat-messages {
    flex: 0 0 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 24px 24px 24px;
    border-radius: 0;
    background: transparent;
    margin-bottom: 0;
    height: 100vh; /* let content scroll underneath dock */
    width: 100%;
    position: relative;
    z-index: 2;
    scrollbar-width: none; /* Firefox */
}

/* Adjust top padding when welcome box is hidden to avoid theme toggle overlap */
.chat-messages.no-welcome {
    padding-top: 60px; /* Extra space to clear theme toggle */
}

/* Spacer to ensure last message clears the input dock visually */
.chat-messages::after {
    content: "";
    display: block;
    height: calc(var(--dock-height) + 124px); /* add extra 100px gap under bubbles */
}

/* Hide scrollbar in WebKit */
.chat-messages::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* Ensure panels sit below center chat stream */
.model-hub-panel, .settings-panel { z-index: 1; }

/* Collapsible panels */
.panel-toggle {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(0,0,0,0.08);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    color: var(--text-main);
    width: 32px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    cursor: pointer;
    transition: transform 300ms ease, opacity 200ms ease, left 320ms ease, right 320ms ease;
    opacity: 0.7;
}

.panel-toggle:hover { opacity: 1; }
.panel-toggle.left { left: calc(var(--left-panel-width) + var(--grid-gap) - 16px); }
.panel-toggle.right { right: calc(var(--right-panel-width) + var(--grid-gap) - 16px); }

.panels-collapsed-left main { grid-template-columns: 0px 1fr var(--right-panel-width); }
.panels-collapsed-right main { grid-template-columns: var(--left-panel-width) 1fr 0px; }
.panels-collapsed-both main { grid-template-columns: 0px 1fr 0px; }

/* Keep toggle buttons stuck to panel edges when collapsed */
.panels-collapsed-left .panel-toggle.left { left: calc(0px + var(--grid-gap) - 16px); }
.panels-collapsed-right .panel-toggle.right { right: calc(0px + var(--grid-gap) - 16px); }
.panels-collapsed-both .panel-toggle.left { left: calc(0px + var(--grid-gap) - 16px); }
.panels-collapsed-both .panel-toggle.right { right: calc(0px + var(--grid-gap) - 16px); }
.panels-collapsed-both .panel-toggle.left i { transform: rotate(180deg); }
.panels-collapsed-both .panel-toggle.right i { transform: rotate(180deg); }

.panels-collapsed-left .model-hub-panel { transform: translateX(-10px); opacity: 0; pointer-events: none; }
.panels-collapsed-right .settings-panel { transform: translateX(10px); opacity: 0; pointer-events: none; }
.panels-collapsed-both .model-hub-panel { transform: translateX(-10px); opacity: 0; pointer-events: none; overflow: hidden; width: 0; margin: 0; padding: 0; border: 0; }
.panels-collapsed-both .settings-panel { transform: translateX(10px); opacity: 0; pointer-events: none; overflow: hidden; width: 0; margin: 0; padding: 0; border: 0; }

.model-hub-panel, .settings-panel, .chat-container { transition: all 320ms cubic-bezier(0.2, 0.8, 0.2, 1); }

.panels-collapsed-left .chat-container { grid-column: 2 / 3; }
.panels-collapsed-right .chat-container { grid-column: 2 / 3; }
.panels-collapsed-both .chat-container { grid-column: 2 / 3; }

/* Keep chat column at original readable width when any side is collapsed */
.panels-collapsed-left .chat-container,
.panels-collapsed-right .chat-container,
.panels-collapsed-both .chat-container {
    max-width: calc(100vw - var(--left-panel-width) - var(--right-panel-width) - (2 * var(--grid-gap)));
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    justify-self: center; /* center grid item within expanded middle column */
}

.panels-collapsed-left .panel-toggle.left i { transform: rotate(180deg); }
.panels-collapsed-right .panel-toggle.right i { transform: rotate(180deg); }

/* Murmuration orb positioned against left edge of chat stream */
.murmuration-orb {
    position: absolute;
    left: 12px; /* ensure visible within chat column */
    top: 12px;
    width: 68px; /* 75% of previous */
    height: 68px;
    filter: drop-shadow(0 10px 30px rgba(0,0,0,0.18));
    pointer-events: none;
    background: transparent !important;
    z-index: 2; /* above panels, below messages */
    transition: top 420ms cubic-bezier(0.22, 1, 0.36, 1), left 420ms cubic-bezier(0.22, 1, 0.36, 1), transform 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease; /* smooth fly + shrink */
}

/* Initial state: slightly bigger and vertically centered in the chat area */
.murmuration-orb.orb-initial {
    left: 50%;
    top: 50%;
    width: 136px;
    height: 136px;
    transform: translate(-50%, -50%);
    opacity: 1;
}

/* Fade helper for reposition transitions */
.murmuration-orb.orb-fade-out {
    opacity: 0;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    max-width: 85%;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    animation: fadeIn 0.3s ease;
    font-family: 'Space Grotesk', system-ui, sans-serif;
}

/* Ensure long JSON or code blocks wrap instead of blowing out layout */
.message pre,
.message code,
.message .json {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

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

.message.user {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #fff;
    margin-left: auto;
    text-align: right;
    border: none;
    width: fit-content;
    max-width: min(85%, 70ch);
}

.message.assistant {
    background: rgba(255,255,255,0.48);
    color: var(--text-main);
    border-left: none;
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid rgba(255,255,255,0.38);
    box-shadow: 0 10px 30px rgba(17, 12, 30, 0.10);
    width: fit-content;
    max-width: min(85%, 70ch);
    margin-left: 75px; /* reduced gutter to bring orb closer to bubble */
}

.message.system {
    background: rgba(255,255,255,0.45);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    color: var(--text-main);
    text-align: left;
    max-width: 780px;
    margin-left: auto;
    margin-right: auto;
    font-weight: 500;
    border-left: none;
    border: 1px solid rgba(255,255,255,0.35);
    box-shadow: 0 10px 30px rgba(17,12,30,0.08);
    padding: 24px 28px;
    margin-top: 12px;
}

/* Improve list alignment inside the centered system message */
.message.system ul {
    display: block;
    text-align: left;
    margin: 8px 0 0 0;
    padding-left: 1.2em;
    list-style: disc;
    list-style-position: inside; /* keep bullets within the box */
}

.message.system li {
    margin: 4px 0;
}

.message.loading {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: var(--secondary-color);
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    max-width: 85%;
    animation: pulse 2s infinite;
}

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

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

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

.loading-message-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.loading-task-info {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

.loading-model-info {
    font-size: 12px;
    color: var(--secondary-color);
    font-family: 'Courier New', monospace;
}

.loading-progress-info {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.image-container {
    margin: 10px 0;
}

.image-container img {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.image-analysis {
    background: rgba(23, 162, 184, 0.1);
    border-left: 4px solid var(--info-color);
    padding: 15px;
    margin: 10px 0;
    border-radius: var(--border-radius);
}

.image-analysis h4 {
    color: var(--info-color);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.meta-info {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(23, 162, 184, 0.3);
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-container textarea {
    padding: 12px 14px;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    transition: var(--transition);
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    border: 1px solid rgba(0,0,0,0.06);
}

.input-container textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

/* Floating input dock */
.theme-future .input-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 16px; /* move input and upload 30px lower from previous 8px */
    background: transparent;
    width: 880px;
    z-index: 3;
}

/* Input settings popover */
.input-settings-popover {
    position: absolute;
    right: 16px;
    bottom: 82px; /* lift popover slightly relative to raised buttons */
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px) saturate(140%);
    padding: 12px;
    border-radius: 12px;
    box-shadow: var(--glass-shadow);
    min-width: 220px;
}

.input-settings-popover .popover-header {
    font-weight: 700;
    margin-bottom: 8px;
    font-family: 'Space Grotesk', sans-serif;
}

.input-settings-popover .popover-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0;
}

.theme-future .button-container .primary-btn {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
}

.brand-logo {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 1rem;
    color: var(--text-main);
    opacity: 0.8;
    position: relative;
    top: -6px;
}

/* Loading indicator styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 123, 255, 0.3);
    max-width: 400px;
    width: 90%;
    color: white;
}

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

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

.loading-text {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.loading-subtext {
    color: #aaa;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 20px;
}

.loading-model-info {
    background: rgba(0, 123, 255, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    text-align: left;
}

.loading-model-name {
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
    margin-bottom: 8px;
}

.loading-task {
    color: #ccc;
    font-size: 12px;
}

.loading-progress {
    color: #888;
    font-size: 12px;
    margin-top: 15px;
    font-style: italic;
}

.image-upload-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.image-preview {
    position: relative;
    display: inline-block;
}

.image-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
}

.remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: var(--transition);
}

.remove-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.button-container {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

.primary-btn:hover {
    filter: brightness(1.03);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.secondary-btn {
    background: rgba(255,255,255,0.35);
    color: var(--text-main);
    border: 1px solid rgba(0,0,0,0.06);
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.55);
    transform: translateY(-1px);
}

.model-hub-panel {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--glass-shadow);
    max-height: fit-content;
}

.model-hub-panel h3 {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Inter', 'Space Grotesk', system-ui, sans-serif;
}

.task-section {
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.task-header {
    background: var(--light-color);
    padding: 15px;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.task-header:hover {
    background: #e9ecef;
}

.task-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--dark-color);
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
}

.discover-btn {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'Inter', 'Space Grotesk', system-ui, sans-serif;
    width: 110px;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* space between icon and title text in headers (only for the leading icon) */
.task-header > i { margin-right: 0; }
.task-title > i { margin-right: 8px; }

/* lock discover buttons to a fixed width and push them to the right */
.task-header .discover-btn {
    margin-left: auto;
    align-self: center;
    flex: 0 0 110px;
}

.discover-btn:hover {
    filter: brightness(1.05);
    transform: scale(1.05);
}

.model-options {
    padding: 15px;
    background: white;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--secondary-color);
    font-style: italic;
}

.error {
    text-align: center;
    padding: 20px;
    color: var(--danger-color);
    background: rgba(220, 53, 69, 0.1);
    border-radius: var(--border-radius);
}

.no-models {
    text-align: center;
    padding: 20px;
    color: var(--secondary-color);
}

.model-card {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    transition: var(--transition);
    position: relative;
}

.model-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.model-card.selected {
    border-color: var(--success-color);
    background: rgba(40, 167, 69, 0.05);
}

.model-card.default {
    border-color: var(--primary-color);
}

.model-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.model-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
    flex: 1;
    word-break: break-word;
}

.default-badge {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 10px;
}

.selected-badge {
    background: var(--success-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 10px;
}

.model-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

.metric {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--secondary-color);
}

.metric i {
    width: 14px;
    color: var(--info-color);
}

.model-actions {
    display: flex;
    gap: 8px;
}

.model-btn {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.select-btn {
    background: var(--success-color);
    color: white;
}

.select-btn:hover {
    background: #218838;
}

.details-btn {
    background: var(--info-color);
    color: white;
}

.details-btn:hover {
    background: #138496;
}

.performance-dashboard {
    margin-top: 20px;
    padding: 20px;
    background: rgba(23, 162, 184, 0.05);
    border-radius: var(--border-radius);
    border: 1px solid rgba(23, 162, 184, 0.2);
}

.performance-dashboard h4 {
    color: var(--info-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.performance-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.metric-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
    border-left: 3px solid var(--info-color);
}

.metric-label {
    font-size: 12px;
    color: var(--secondary-color);
    font-weight: 500;
}

.metric-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--info-color);
}

.settings-panel {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--glass-shadow);
    max-height: fit-content;
}

.settings-panel h3 {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting {
    margin-bottom: 20px;
}

.setting label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
}

.setting input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.setting input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
}

.setting input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.custom-functions h4 {
    color: var(--dark-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.custom-function {
    background: var(--light-color);
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.function-info strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 5px;
}

.function-info p {
    font-size: 12px;
    color: var(--secondary-color);
    margin: 0;
}

.remove-function-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: var(--transition);
}

.remove-function-btn:hover {
    background: #c82333;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

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

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.parameter-field {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: var(--light-color);
    border-radius: var(--border-radius);
}

.remove-param-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

.remove-param-btn:hover {
    background: #c82333;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

.model-details {
    color: var(--dark-color);
}

.model-details h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.4rem;
    word-break: break-word;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section h4 {
    color: var(--info-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 2px solid rgba(23, 162, 184, 0.2);
    padding-bottom: 5px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    color: var(--dark-color);
    font-weight: 500;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

@media (max-width: 1200px) {
    main {
        grid-template-columns: 1fr 280px;
        grid-template-rows: auto auto auto;
    }
    
    .model-hub-panel {
        order: -1;
        grid-column: 1 / -1;
        grid-row: 1;
    }
    
    .chat-container {
        grid-row: 2;
    }
    
    .settings-panel {
        grid-column: 2;
        grid-row: 2 / -1;
    }
    
    .settings-panel:has(h3 [class*="fa-robot"]) {
        grid-column: 1;
        grid-row: 3;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        gap: 15px;
    }
    
    .chat-container {
        order: 2;
        grid-row: 2;
    }
    
    .model-hub-panel {
        order: 1;
        grid-row: 1;
    }
    
    .settings-panel {
        order: 4;
        grid-column: 1;
        grid-row: 4;
    }
    
    .settings-panel:has(h3 [class*="fa-robot"]) {
        order: 3;
        grid-row: 3;
    }
    
    .model-metrics {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .parameter-field {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .button-container {
        flex-direction: column;
    }
    
    .modal-content {
        padding: 20px;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .performance-summary {
        gap: 8px;
    }
    
    .metric-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .chat-messages {
        max-height: 300px;
        min-height: 250px;
    }
    
    .model-actions {
        flex-direction: column;
    }
}

/* Modal Details specific styles */
.model-details-modal .modal-content {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.model-details-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.model-details-icon {
    font-size: 2em;
    color: var(--accent-color);
}

.model-details-title {
    font-size: 1.4em;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.model-details-content {
    display: grid;
    gap: 15px;
}

.model-detail-section {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

.detail-label {
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 5px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    color: var(--text-color);
    margin-bottom: 10px;
    word-wrap: break-word;
}

.performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.performance-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 6px;
    text-align: center;
}

.performance-label {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.performance-value {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--accent-color);
}

/* Video and Webcam Styles */
.video-upload-container {
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.video-preview {
    position: relative;
    margin-top: 10px;
    width: 100%;
    max-width: 400px;
}

.video-preview video {
    width: 100%;
    max-height: 300px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.5);
}

/* Object Detection Results */
.detection-results {
    margin: 15px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border-left: 4px solid var(--accent-color);
}

.detection-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.detection-stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
    min-width: 100px;
}

.detection-stat-label {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.detection-stat-value {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--accent-color);
}

.detected-objects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.detected-object {
    background: rgba(255, 255, 255, 0.08);
    padding: 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.object-class {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
}

.object-confidence {
    font-size: 0.9em;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.object-bbox {
    font-size: 0.8em;
    color: var(--text-muted);
    font-family: monospace;
}

.annotated-image {
    margin: 15px 0;
    text-align: center;
}

.annotated-image img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Ensure tables and long inline content don't expand layout */
/* Keep overflow hidden for assistant bubbles; tables fit within bubble dims */
.message.assistant { overflow-x: hidden; }
.model-table { max-width: 100%; }

/* Video Detection Results */
.video-detection-results {
    margin: 15px 0;
}

.video-detection-results .annotated-video {
    margin: 10px 0 6px 0;
}

.video-detection-results .annotated-video-hint {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.video-summary {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.video-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.detected-classes .class-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.detected-classes .class-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 12px;
    color: var(--text-color);
}

.frame-results {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.frame-result {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 15px;
}

.frame-result:last-child {
    border-bottom: none;
}

.frame-thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.frame-info {
    flex: 1;
}

.frame-timestamp {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.frame-detections {
    font-size: 0.8em;
    color: var(--text-color);
}

/* Responsive adjustments for new features */
@media (max-width: 768px) {
    .video-upload-container {
        flex-direction: column;
    }
    
    .detection-summary {
        flex-direction: column;
    }
    
    .detected-objects-list {
        grid-template-columns: 1fr;
    }
    
    .video-info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Real-time Detection Styles */
.realtime-detection-container {
    margin: 12px 0 16px 75px; /* align with assistant bubble gutter */
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(17, 12, 30, 0.10);
    background: rgba(255,255,255,0.48);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid rgba(255,255,255,0.38);
    max-width: min(85%, 70ch); /* match assistant bubble width */
    width: fit-content;
    position: relative;
    z-index: 3; /* above murmuration orb */
}

.detection-video-wrapper {
    position: relative;
    display: block;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

#realtime-webcam {
    width: 100%;
    max-width: 800px;
    height: auto;
    display: block;
    background: #000;
}

#detection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.detection-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 20;
}

.stop-detection-btn {
    background: #ff4757;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stop-detection-btn:hover {
    background: #ff3742;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 71, 87, 0.3);
}

.detection-stats {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #00ff00;
    padding: 10px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    z-index: 20;
    min-width: 200px;
}

.stats-line {
    display: flex;
    gap: 15px;
    margin-bottom: 5px;
}

.stat-item {
    white-space: nowrap;
}

.objects-line {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #00ff0050;
    font-size: 11px;
}

.object-count {
    display: inline-block;
    margin-right: 10px;
    color: #ffffff;
}

.detection-status {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #00ff00;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 20;
}

.status-ready {
    color: #00ff00;
    font-weight: bold;
}

/* Animation for detection startup */
.realtime-detection-container {
    animation: slideInFromBottom 0.5s ease-out;
}

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

/* Bounding box animation effects */
#detection-overlay {
    animation: fadeIn 0.3s ease-in;
}

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

/* Loading state for detection */
.detection-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    z-index: 30;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 8px;
}

.detection-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

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

/* Multi-stream live detection grid */
.live-streams-wrapper {
    margin: 16px 0 20px 75px;
    padding: 16px 18px 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.58);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    box-shadow: 0 18px 35px rgba(17, 12, 30, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.4);
    max-width: min(95%, 1100px);
}

.live-streams-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.live-streams-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

.stop-all-streams-btn {
    border: none;
    background: #ff4757;
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 6px 14px rgba(255, 71, 87, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stop-all-streams-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(255, 71, 87, 0.35);
}

.live-stream-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
}

.live-stream-tile {
    flex: 1 1 0;
    min-width: 240px;
    background: rgba(10, 10, 10, 0.92);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.live-stream-header {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.65);
    color: #f5f5f5;
    align-items: flex-start;
    gap: 8px;
}

.live-stream-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.live-stream-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
}

.stop-stream-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
}

.stop-stream-btn:hover {
    background: rgba(255, 71, 87, 0.85);
    border-color: rgba(255, 71, 87, 0.6);
    transform: scale(1.05);
}

.live-stream-body {
    position: relative;
    background: #000;
    min-height: 180px;
}

.live-stream-frame {
    width: 100%;
    display: block;
    object-fit: cover;
}

.live-stream-stats {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    color: #9ef16c;
    flex-wrap: wrap;
    gap: 8px;
}

.live-stream-caption {
    padding: 6px 12px 4px;
    font-size: 0.8rem;
    color: #ffffff;
}

.live-stream-status {
    padding: 10px 12px 14px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 1200px) {
    .live-stream-grid {
        flex-wrap: wrap;
    }
    .live-stream-tile {
        flex: 1 1 calc(50% - 12px);
    }
}

@media (max-width: 768px) {
    .live-streams-wrapper {
        margin-left: 0;
    }
    .live-stream-tile {
        flex: 1 1 100%;
    }
}

/* ===== MODEL RATING WIDGET STYLES ===== */

.rating-widget {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border: 1px solid #e1e8ff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.rating-widget:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.rating-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rating-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rating-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.rating-widget .model-name {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.inference-time {
    color: #7f8c8d;
    font-size: 12px;
    font-style: italic;
}

.star-rating {
    display: flex;
    gap: 4px;
    align-items: center;
    user-select: none;
}

.star {
    font-size: 28px;
    color: #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.star:hover {
    transform: scale(1.1);
}

.star.active {
    color: #ffd700;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6));
}

.star.selected {
    color: #ffb300;
}

.rating-description {
    margin-top: -8px;
    margin-bottom: 4px;
}

.rating-description small {
    color: #666;
    font-size: 12px;
    line-height: 1.4;
}

.feedback-section {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #e8ecf0;
}

.feedback-input {
    width: 100%;
    min-height: 60px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 12px;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.feedback-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.rating-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.submit-rating-btn, .skip-rating-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-rating-btn {
    background: #667eea;
    color: white;
}

.submit-rating-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.skip-rating-btn {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.skip-rating-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.rating-submitting {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    text-align: center;
    color: #667eea;
    font-weight: 500;
}

.rating-submitting .spinner.small {
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.rating-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    text-align: center;
    color: #27ae60;
}

.success-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.rating-summary {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.avg-rating {
    color: #666;
    font-size: 11px;
}

.rating-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    text-align: center;
    color: #e74c3c;
}

.error-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.retry-btn {
    margin-top: 8px;
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #495057;
    cursor: pointer;
    font-size: 12px;
}

.retry-btn:hover {
    background: #e9ecef;
}

/* Responsive rating widget */
@media (max-width: 768px) {
    .rating-widget {
        margin-top: 12px;
        padding: 12px;
    }
    
    .star {
        font-size: 24px;
    }
    
    .rating-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .rating-buttons {
        flex-direction: column;
    }
    
    .submit-rating-btn, .skip-rating-btn {
        width: 100%;
        justify-content: center;
    }
} 

/* ===== AGENT STATUS UI STYLES ===== */

.agent-status-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: var(--border-radius);
    border: 1px solid rgba(102, 126, 234, 0.2);
    font-family: 'Inter', 'Space Grotesk', system-ui, sans-serif;
}

.agent-status-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.agent-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.agent-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    font-family: 'Inter', 'Space Grotesk', system-ui, sans-serif;
    transition: var(--transition);
}

.agent-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.agent-name {
    font-weight: 600;
    color: var(--primary-color);
    text-transform: capitalize;
    font-size: 14px;
}

.agent-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.agent-status.enabled {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.agent-status.disabled {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.agent-description {
    font-size: 12px;
    color: var(--secondary-color);
    margin-bottom: 8px;
    line-height: 1.3;
}

.agent-capabilities {
    font-size: 11px;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.agent-capabilities strong {
    color: var(--accent-1);
}

.agent-stats {
    display: flex;
    gap: 10px;
    font-size: 10px;
    color: var(--secondary-color);
}

.agent-stats .stat {
    background: var(--light-color);
    padding: 2px 5px;
    border-radius: 3px;
}

.workflow-status {
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.status-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--dark-color);
}

.status-value {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 8px;
}

.status-value.ready {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.status-value.active {
    background: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
    animation: pulse 2s infinite;
}

/* Agent workflow indicators in chat */
.message.workflow-step {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border-left: 4px solid var(--primary-color);
    font-style: italic;
}

.workflow-summary {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 15px;
    margin: 10px 0;
}

.workflow-summary h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.workflow-step-list {
    font-size: 13px;
    line-height: 1.5;
}

.workflow-step-list li {
    margin-bottom: 5px;
}

/* Responsive adjustments for agent UI */
@media (max-width: 768px) {
    .agent-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .agent-stats {
        flex-wrap: wrap;
    }
    
    .status-indicator {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
} 

/* ===== AGENT ORCHESTRATION PANEL STYLES ===== */

/* Agent panel styling in right column */
.settings-panel:has(h3 [class*="fa-robot"]) {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.agent-status-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: var(--border-radius);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.workflow-status {
    margin-bottom: 15px;
}

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

.status-label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.status-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.workflow-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    transition: all 0.3s ease;
}

.workflow-indicator.active {
    background: var(--primary-color);
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.4);
}

.status-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    transition: color 0.3s ease;
}

.agent-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.loading-agents {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px;
    color: #666;
    font-size: 0.9rem;
}

.agent-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif;
}

.agent-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.agent-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agent-name {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.agent-description {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.3;
}

.agent-tasks {
    font-size: 0.75rem;
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 2px;
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.agent-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
}

.agent-status-indicator.busy {
    background: #FF9800;
}

.agent-status-indicator.error {
    background: #f44336;
}

.agent-status-text {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.agent-performance {
    padding: 15px;
    background: #f8f9ff;
    border-radius: var(--border-radius);
    border: 1px solid #e1e8ff;
}

.agent-performance h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.agent-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.agent-stat-card {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    text-align: center;
}

.agent-stat-label {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.agent-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.no-agents-message {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* Responsive adjustments for agent elements */
@media (max-width: 768px) {
    .agent-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .agent-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
} 

.demo-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.demo-section h3 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.example-btn {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,123,255,0.2);
    text-align: left;
    line-height: 1.4;
}

.example-btn:hover {
    background: linear-gradient(45deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.3);
}

.example-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,123,255,0.2);
}

/* ===== FILE UPLOAD STYLES ===== */
.file-upload-container {
    margin-bottom: 15px;
    z-index: 3;
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
}

.file-preview {
    margin-top: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px;
    background: rgba(248, 249, 250, 0.8);
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.file-icon {
    font-size: 18px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 12px;
    margin-bottom: 2px;
    word-break: break-word;
}

.file-type {
    font-size: 11px;
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 2px;
}

.file-size {
    font-size: 10px;
    color: var(--secondary-color);
}

.media-preview {
    margin-top: 10px;
}

.media-preview img {
    max-width: 160px;
    max-height: 120px;
    border-radius: var(--border-radius);
    object-fit: cover;
}

.media-preview video {
    max-width: 200px;
    max-height: 120px;
    border-radius: var(--border-radius);
}

/* File type specific icons */
.file-icon .fa-file-csv { color: #28a745; }
.file-icon .fa-file-excel { color: #1d7044; }
.file-icon .fa-file-pdf { color: #dc3545; }
.file-icon .fa-file-alt { color: #6c757d; }
.file-icon .fa-image { color: #fd7e14; }
.file-icon .fa-video { color: #6f42c1; }
.file-icon .fa-calculator { color: #20c997; }

/* File processing results */
.file-processing-result {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.file-processing-result h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 16px;
}

.data-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.data-summary .metric {
    background: var(--light-color);
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
}

.data-summary .metric .value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    display: block;
}

.data-summary .metric .label {
    font-size: 12px;
    color: var(--secondary-color);
}

.sample-data {
    max-height: 200px;
    overflow-y: auto;
    background: var(--light-color);
    border-radius: 6px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.sample-data table {
    width: 100%;
    border-collapse: collapse;
}

.sample-data th,
.sample-data td {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.sample-data th {
    background: rgba(102, 126, 234, 0.1);
    font-weight: 600;
}

/* Math calculation results */
.math-result {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: var(--border-radius);
    margin: 10px 0;
}

.math-result .expression {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    margin-bottom: 8px;
}

.math-result .result {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
}

.math-result .variables {
    font-size: 12px;
    margin-top: 8px;
    opacity: 0.9;
} 

 
/* Auth Pages Styling */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); /* Subtle gradient background */
}

.auth-glass-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 2rem;
    color: #111;
    margin: 0 0 0.5rem 0;
}

.auth-header p {
    color: #666;
    font-size: 1rem;
    margin: 0;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #444;
    font-weight: 500;
    font-size: 0.9rem;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.auth-input:focus {
    outline: none;
    border-color: #7C3AED;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
    background: #fff;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(124, 58, 237, 0.25);
}

.auth-links {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #666;
}

.auth-links a {
    color: #7C3AED;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: #6D28D9;
    text-decoration: underline;
}

.error-message {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: none;
    text-align: center;
}
