/* Chat Header Container */
.chat-header {
    border-bottom: 1px solid #e5e7eb;
    background-color: white;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.mobile-drawer-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid #dbeafe;
    background-color: #eef2ff;
    color: #1d4ed8;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    position: relative;
    z-index: 1205;
}

.mobile-drawer-toggle span {
    pointer-events: none;
}

.mobile-drawer-toggle:hover,
.mobile-drawer-toggle:focus-visible {
    background-color: #e0e7ff;
    border-color: #c7d2fe;
    color: #111827;
}

.mobile-drawer-toggle:focus-visible {
    outline: 2px solid #c7d2fe;
    outline-offset: 2px;
}

.dropdown-item.refresh-item {
    justify-content: flex-start;
    gap: 0.5rem;
    font-weight: 500;
}

.dropdown-item.refresh-item:disabled {
    color: #9ca3af;
    cursor: not-allowed;
}

.dropdown-item .spinner {
    width: 0.85rem;
    height: 0.85rem;
    border: 2px solid #d1d5db;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: selectorSpinner 0.9s linear infinite;
}

@keyframes selectorSpinner {
    to {
        transform: rotate(360deg);
    }
}


.chat-header-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
}

.chat-header-left {
    flex: 1;
    min-width: 0;
}

.chat-header-context {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex-wrap: wrap;
}
.chat-header-context > * {
    min-width: 0;
}
.chat-header-context .context-breadcrumbs {
    flex: 0 0 auto;
}

.chat-header-context .artifact-state-badge {
    flex-shrink: 0;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    margin-left: auto;
}

.chat-header-flip-link {
    border: 1px solid #dbeafe;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    color: #1f2937;
    background-color: #eef2ff;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chat-header-flip-link:hover,
.chat-header-flip-link:focus-visible {
    border-color: #c7d2fe;
    background-color: #e0e7ff;
}

.chat-participants {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
}

.chat-participants:focus-visible {
    outline: 2px solid #c7d2fe;
    outline-offset: 2px;
}

.participant-avatar-list {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #1f2937;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.participant-glyph {
    display: none;
    font-size: 1.05rem;
}

.chat-header-execution {
    justify-self: end;
    min-width: 0;
}

/* Context Breadcrumbs */
.context-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
}

.context-breadcrumbs::-webkit-scrollbar {
    display: none;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    color: #6b7280;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex: 0 0 auto;
}

.breadcrumb-item:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.breadcrumb-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.breadcrumb-name {
    white-space: nowrap;
}

.breadcrumb-separator {
    color: #9ca3af;
    font-size: 1rem;
    user-select: none;
}

/* Execution Controls */
.execution-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-shrink: 0;
    min-width: 0;
}

.execution-panel {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.execution-controls.collapsed {
    gap: 0;
}

.settings-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: #475467;
    font-size: 0.9rem;
    padding: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.settings-toggle:hover,
.settings-toggle:focus-visible {
    background-color: #eef2ff;
    color: #1f2937;
}

.settings-toggle:focus-visible {
    outline: 2px solid #c7d2fe;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.execution-controls.expanded {
    gap: 0.75rem;
}

.execution-close {
    border: none;
    background: transparent;
    color: #475467;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.execution-close:hover,
.execution-close:focus-visible {
    background-color: #f1f5f9;
    color: #1f2937;
}

/* Selector Controls (Provider & Model) */
.selector-control {
    position: relative;
}

.selector-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    color: #1f2937;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    min-width: 120px;
}

.selector-button:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.selector-button:active {
    background-color: #f3f4f6;
}

.selector-label {
    flex: 1;
    text-align: left;
}

.selector-chevron {
    color: #6b7280;
    font-size: 0.75rem;
    transition: transform 0.15s ease;
}

.selector-control .selector-button:hover .selector-chevron {
    color: #374151;
}

/* Dropdown Menu */
.selector-dropdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    left: auto;
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: transparent;
    border: none;
    color: #1f2937;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.dropdown-item.selected {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 500;
}

.dropdown-item.capability-disabled,
.dropdown-item:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.dropdown-item:disabled .model-name {
    color: #9ca3af;
}

.model-item-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.model-name {
    font-weight: 500;
}

.model-capabilities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.capability-badge {
    font-size: 0.6875rem;
    padding: 0.125rem 0.4rem;
    border-radius: 999px;
    background-color: #e5e7eb;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.capability-badge.capability-chat {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.capability-badge.capability-vision {
    background-color: #fce7f3;
    color: #be185d;
}

.capability-badge.capability-image {
    background-color: #e0f2fe;
    color: #0369a1;
}

.capability-badge.capability-video {
    background-color: #ede9fe;
    color: #5b21b6;
}

.capability-badge.capability-realtime {
    background-color: #fef9c3;
    color: #b45309;
}

.capability-badge.capability-audio {
    background-color: #ecfccb;
    color: #3f6212;
}

.capability-badge.capability-embeddings {
    background-color: #fee2e2;
    color: #b91c1c;
}

.capability-badge.capability-unknown {
    background-color: #f3f4f6;
    color: #6b7280;
}

.capability-note {
    font-size: 0.6875rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dropdown-item .checkmark {
    color: #2563eb;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 0.25rem 0;
}

.dropdown-section-label {
    padding: 0.5rem 0.875rem 0.25rem;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Scrollbar Styling for Dropdowns */
.selector-dropdown::-webkit-scrollbar {
    width: 6px;
}

.selector-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.selector-dropdown::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.selector-dropdown::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Artifact Header Pill */
.artifact-header-pill {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid #dbeafe;
    border-radius: 0.75rem;
    background-color: #f5f7ff;
    color: #1f2937;
    margin-bottom: 0.4rem;
    max-width: 100%;
}

.artifact-pill-type {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e1b4b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Thread Title Inline */
.thread-title-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex: 1 1 auto;
    max-width: 100%;
    background: transparent;
    border: none;
    padding: 0.3rem 0.5rem;
    border-radius: 0.375rem;
    color: #1f2937;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.thread-title-inline:hover,
.thread-title-inline:focus-within {
    background-color: #f3f4f6;
    color: #111827;
}

.thread-title-emoji {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.thread-title-label {
    font-weight: 700;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: text;
    min-width: 0;
    flex: 1 1 auto;
}

.thread-title-input {
    border: thin #f3f4f6;
    border-radius: 0.375rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.95rem;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.thread-title-menu {
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.1rem 0.25rem;
    border-radius: 0.375rem;
    opacity: 0;
    transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    align-self: center;
}

.thread-title-inline:hover .thread-title-menu,
.thread-title-menu:focus-visible,
.thread-title-menu:focus {
    opacity: 1;
}

.thread-title-menu:hover,
.thread-title-menu:focus-visible {
    background-color: #eef2ff;
    color: #1f2937;
    outline: none;
}

/* Source Thread Indicator */
.source-thread-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background-color: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.source-thread-indicator:hover,
.source-thread-indicator:focus-visible {
    background-color: #fde68a;
    border-color: #f59e0b;
    color: #78350f;
    text-decoration: none;
}

.source-thread-indicator:focus-visible {
    outline: 2px solid #fcd34d;
    outline-offset: 2px;
}

.source-indicator-icon {
    font-size: 0.875rem;
    line-height: 1;
}

.source-indicator-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

@media (max-width: 768px) {
    .source-thread-indicator {
        padding: 0.15rem 0.4rem;
    }

    .source-indicator-label {
        display: none;
    }
}

@media (max-width: 1024px) {
    .mobile-drawer-toggle {
        display: inline-flex;
    }

    .chat-header-controls {
        flex: 1;
        min-width: 0;
    }

    .inspector-collapse-toggle {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .chat-header {
        padding: 0.625rem 0.75rem;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .context-breadcrumbs {
        flex: 1 1 100%;
        max-width: 100%;
        flex-wrap: wrap;
        white-space: normal;
        overflow-x: visible;
    }

    .breadcrumb-item {
        font-size: 0.8125rem;
        padding: 0.3125rem 0.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .participant-avatar-list {
        display: none;
    }

    .chat-participants {
        width: 38px;
        height: 38px;
        border-radius: 999px;
        border: none;
        justify-content: center;
        background: transparent;
        padding: 0;
    }

    .chat-participants:hover,
    .chat-participants:focus-visible {
        background-color: #eef2ff;
        color: #1f2937;
    }

    .participant-glyph {
        display: inline-flex;
        font-size: 1rem;
    }

    .chat-header-context {
        gap: 0.5rem;
    }

    .thread-title-inline {
        padding: 0.3rem 0.45rem;
    }

    .thread-title-label {
        cursor: pointer;
    }

    .thread-title-menu {
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .context-breadcrumbs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .breadcrumb-item {
    }

    .chat-header-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .chat-header-left {
        flex: 1 1 auto;
    }

    .chat-header-right {
        flex-shrink: 0;
        gap: 0.4rem;
    }
}

/* Thread Usage Summary (VS3) */
.thread-usage-summary {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    background: transparent;
    border: 1px solid #a7f3d0;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.thread-usage-summary:hover,
.thread-usage-summary:focus-visible {
    background-color: #d1fae5;
    border-color: #6ee7b7;
    outline: none;
}

.thread-usage-summary:focus-visible {
    outline: 2px solid #6ee7b7;
    outline-offset: 2px;
}

.thread-usage-summary .usage-icon {
    font-size: 0.875rem;
    line-height: 1;
}

.thread-usage-summary .usage-charge {
    font-weight: 600;
    color: #047857;
}

.thread-usage-summary .usage-tokens {
    color: #059669;
    font-size: 0.6875rem;
    padding-left: 0.25rem;
    border-left: 1px solid #a7f3d0;
    margin-left: 0.25rem;
}

@media (max-width: 768px) {
    .thread-usage-summary {
        padding: 0.25rem 0.5rem;
    }

    .thread-usage-summary .usage-tokens {
        display: none;
    }
}
