@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Space+Grotesk:wght@500;700&display=swap');

:root {
    --teradata-orange: #F15F22;
    --teradata-orange-dark: #D9501A;
    --dark-bg: #262626;
    --medium-bg: #333333;
    --light-text: #F0F0F0;
    --medium-text: #999999;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--dark-bg);
    background-image: radial-gradient(circle, #4a4a4a, var(--dark-bg));
    color: var(--light-text);
    overflow: hidden;
}

.glass-panel {
    background: rgba(51, 51, 51, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Scrollbar styling */
#chat-container::-webkit-scrollbar,
.category-panel::-webkit-scrollbar,
#status-window-content::-webkit-scrollbar,
#session-list::-webkit-scrollbar,
.table-container::-webkit-scrollbar,
#prompt-editor-textarea::-webkit-scrollbar,
#system-prompt-popup-text::-webkit-scrollbar,
#chat-modal-log::-webkit-scrollbar {
    width: 6px;
}
#chat-container::-webkit-scrollbar-track,
.category-panel::-webkit-scrollbar-track,
#status-window-content::-webkit-scrollbar-track,
#session-list::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track,
#prompt-editor-textarea::-webkit-scrollbar-track,
#system-prompt-popup-text::-webkit-scrollbar-track,
#chat-modal-log::-webkit-scrollbar-track {
    background: transparent;
}
#chat-container::-webkit-scrollbar-thumb,
.category-panel::-webkit-scrollbar-thumb,
#status-window-content::-webkit-scrollbar-thumb,
#session-list::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb,
#prompt-editor-textarea::-webkit-scrollbar-thumb,
#system-prompt-popup-text::-webkit-scrollbar-thumb,
#chat-modal-log::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.message-bubble {
    animation: fadeIn 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000) both;
}

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

.header-title { font-family: 'Space Grotesk', sans-serif; }

.category-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
}
.category-panel.open {
    max-height: 15rem;
    overflow-y: auto;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}
.category-tab.active {
    background-color: var(--teradata-orange);
    color: white;
}

details.resource-item > summary { list-style: none; cursor: pointer; }
details.resource-item > summary::-webkit-details-marker { display: none; }
details.resource-item .chevron { transition: transform 0.2s ease-in-out; }
details.resource-item[open] > summary .chevron { transform: rotate(90deg); }

details.resource-selected > summary {
    background-color: var(--teradata-orange-dark) !important;
    box-shadow: 0 0 12px 2px rgba(241, 95, 34, 0.3);
    border-left: 4px solid var(--teradata-orange);
}

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

/* Modal transitions */
#prompt-modal-overlay, #info-modal-overlay, #config-modal-overlay, #prompt-editor-overlay, #confirm-modal-overlay, #system-prompt-popup-overlay, #chat-modal-overlay, #view-prompt-modal-overlay { transition: opacity 0.3s ease-in-out; }
#prompt-modal-content, #info-modal-content, #config-modal-content, #prompt-editor-content, #confirm-modal-content, #system-prompt-popup-content, #chat-modal-content, #view-prompt-modal-content { transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out; }
#prompt-modal-overlay.hidden, #info-modal-overlay.hidden, #config-modal-overlay.hidden, #prompt-editor-overlay.hidden, #confirm-modal-overlay.hidden, #system-prompt-popup-overlay.hidden, #chat-modal-overlay.hidden, #view-prompt-modal-overlay.hidden { pointer-events: none; opacity: 0; }
#prompt-modal-overlay.hidden #prompt-modal-content,
#info-modal-overlay.hidden #info-modal-content,
#config-modal-overlay.hidden #config-modal-content,
#prompt-editor-overlay.hidden #prompt-editor-content,
#confirm-modal-overlay.hidden #confirm-modal-content,
#system-prompt-popup-overlay.hidden #system-prompt-popup-content,
#chat-modal-overlay.hidden #chat-modal-content,
#view-prompt-modal-overlay.hidden #view-prompt-modal-content { transform: scale(0.95); opacity: 0; }

.status-step {
    transition: all 0.3s ease-in-out;
    border-left: 4px solid transparent;
}
.status-step.active {
    border-left-color: var(--teradata-orange);
    background-color: rgba(241, 95, 34, 0.1);
}
.status-step.completed {
    border-left-color: #10b981;
    opacity: 0.7;
}
.status-step.workaround {
    border-left-color: #facc15; /* yellow-400 */
    background-color: rgba(250, 204, 21, 0.1);
}
.status-step.error {
    border-left-color: #f87171; /* red-400 */
    background-color: rgba(248, 113, 113, 0.1);
}
.status-step.plan-optimization {
    border-left-color: #06b6d4; /* cyan-500 */
    background-color: rgba(6, 182, 212, 0.1);
}

.response-card {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
}
.response-card.summary-card {
    background-color: transparent;
    border: none;
    padding: 0;
}
.sql-code-block {
    background-color: #1E1E1E;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
}
.sql-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    color: #ccc;
}
.sql-code-block pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
}
.sql-code-block code {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    color: #d4d4d4;
    white-space: pre;
}
.copy-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.copy-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}
.copy-button.copied {
    background-color: #10b981;
}

.table-container {
    overflow-x: auto;
    max-width: 100%;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-height: 500px;
    overflow-y: auto;
}
.assistant-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.assistant-table th, .assistant-table td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1rem;
    text-align: left;
    white-space: nowrap;
}
.assistant-table th {
    background-color: rgba(241, 95, 34, 0.2);
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}
.assistant-table tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Chart container styling */
.chart-render-target {
    min-height: 400px;
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

#status-window, #session-history-panel {
    transition: width 0.3s ease-in-out, padding 0.3s ease-in-out, border 0.3s ease-in-out;
    flex-shrink: 0;
    overflow: hidden;
}
#status-window.collapsed, #session-history-panel.collapsed {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    border-width: 0;
}
#status-window.collapsed > *, #session-history-panel.collapsed > * {
    opacity: 0;
    pointer-events: none;
}
#status-window > *, #session-history-panel > * {
     transition: opacity 0.2s ease-in-out;
}

.session-item.active {
    background-color: var(--teradata-orange-dark);
    box-shadow: 0 0 12px 2px rgba(241, 95, 34, 0.3);
    border-left: 4px solid var(--teradata-orange);
}

#tool-header {
    transition: max-height 0.4s ease-in-out, padding 0.4s ease-in-out, border-bottom-width 0.4s ease-in-out, opacity 0.3s ease-in-out;
    overflow: hidden;
    max-height: 500px;
}
#tool-header.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-width: 0;
    opacity: 0;
}

.menu-item {
    position: relative;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 50;
    background: rgba(40, 40, 40, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.dropdown-menu.open {
    display: block;
}

select:disabled, input:disabled, button:disabled, fieldset:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Connection status dot styling */
@keyframes blink {
    50% { background-color: #facc15; box-shadow: 0 0 8px #facc15; } /* yellow-400 */
}

.connection-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: background-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}
.connection-dot.disconnected {
    background-color: #ef4444; /* red-500 */
}
.connection-dot.connected {
    background-color: #10b981; /* green-500 */
    box-shadow: 0 0 8px #10b981;
}
.connection-dot.idle {
    background-color: #10b981; /* green-500 */
    box-shadow: 0 0 8px #10b981;
}
.connection-dot.busy {
    background-color: #facc15; /* yellow-400 */
    box-shadow: 0 0 8px #facc15;
    animation: blink 1s infinite;
}
.connection-dot.context-last-turn-temp {
    background-color: #facc15; /* yellow-400 */
    box-shadow: 0 0 8px #facc15;
}
.connection-dot.context-last-turn-locked {
    background-color: var(--teradata-orange);
    box-shadow: 0 0 8px var(--teradata-orange);
}

#send-icon {
    transition: transform 0.2s ease-in-out;
    transform: rotate(-90deg); /* Default to West (Last Turn) */
}
#send-icon.flipped {
    transform: rotate(90deg); /* East for full context (New Default) */
}

.input-hint {
    color: #9ca3af; /* gray-400 */
    font-size: 0.75rem; /* text-xs */
    text-align: center;
    margin-top: 0.5rem; /* mt-2 */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}
.input-hint kbd {
    background-color: #4b5563; /* gray-600 */
    border-radius: 0.25rem;
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
    border: 1px solid #6b7280; /* gray-500 */
    box-shadow: 0 1px 0 #374151; /* gray-700 */
}
.hint-icon {
    position: relative;
    cursor: help;
    border: 1px solid #6b7280; /* gray-500 */
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    font-size: 0.7rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-style: normal;
    font-weight: bold;
    color: #9ca3af; /* gray-400 */
}
.hint-icon .tooltip {
    visibility: hidden;
    opacity: 0;
    width: 240px;
    background-color: #1f2937; /* gray-800 */
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 150%;
    left: 50%;
    margin-left: -120px;
    transition: opacity 0.2s;
    font-size: 0.75rem;
    font-weight: normal;
    line-height: 1.5;
}

.hint-icon .tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.hint-icon:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

#status-window-content .status-kv-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
    font-size: 0.75rem;
    line-height: 1.5;
}
#status-window-content .status-kv-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
    font-size: 0.75rem;
    line-height: 1.5;
    margin-bottom: 0.25rem;
}
#status-window-content .status-kv-key {
    font-weight: 600;
    color: #9ca3af; /* gray-400 */
    text-align: right;
}
#status-window-content .status-kv-value {
    color: #d1d5db; /* gray-300 */
    word-break: break-all;
}

#status-window-content .status-code {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    background-color: rgba(56, 189, 248, 0.1); /* light-blue-400 with 10% opacity */
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    color: #7dd3fc; /* light-blue-300 */
}

#status-window-content .status-text-block {
    background-color: rgba(0,0,0,0.2);
    padding: 0.5rem;
    border-radius: 0.25rem;
    color: #d1d5db; /* gray-300 */
    font-size: 0.8rem;
}

.status-phase-container {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}
.status-phase-container > summary {
    list-style: none;
    cursor: pointer;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}
.status-phase-container > summary::-webkit-details-marker {
    display: none;
}
.status-phase-container > summary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
.status-phase-header {
    font-size: 0.875rem;
    color: #d1d5db; /* gray-300 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem; /* Add gap between title and goal */
}
.status-phase-header.phase-start {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.status-phase-header.phase-end {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0,0,0,0.1);
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}
.status-phase-header.phase-end.skipped {
    background-color: rgba(250, 204, 21, 0.1);
    color: #facc15;
}
.status-phase-content {
    padding: 0.5rem 1rem 1rem 1rem;
    border-left: 2px solid #4b5563; /* gray-600 */
    margin-left: 1rem;
    padding-left: 1rem;
}
.status-phase-content .status-step {
    margin-left: -1rem; /* Align with the container edge */
}

.status-phase-container.completed > summary {
    border-left: 4px solid #10b981;
    padding-left: calc(1rem - 4px);
    opacity: 0.7;
}

/* --- MODIFICATION START: Add styles for key observations toggle button --- */
#key-observations-toggle-button.autoplay-on {
    background-color: var(--teradata-orange);
}
#key-observations-toggle-button.autoplay-on:hover {
    background-color: var(--teradata-orange-dark);
}
#key-observations-toggle-button.off {
    opacity: 0.6;
}
/* --- MODIFICATION END --- */

