/* prompt.css - Extended Thinking Block Styles */

/* Thinking block container */
.thinking-block {
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.875rem;
}

.thinking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    cursor: pointer;
    user-select: none;
}

.thinking-header:hover {
    background: #f0f1f3;
}

.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
}

.thinking-label {
    font-weight: 500;
}

.thinking-duration {
    font-weight: 500;
    color: #6c757d;
}

.thinking-chevron {
    transition: transform 0.2s ease;
    color: #6c757d;
}

.thinking-block.collapsed .thinking-chevron {
    transform: rotate(-90deg);
}

.thinking-content {
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: inherit;
    color: #495057;
    line-height: 1.5;
    border-top: 1px solid #e0e0e0;
}

.thinking-block.collapsed .thinking-content {
    display: none;
}

/* Pulsing dots animation */
.thinking-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6c757d;
    animation: thinking-pulse 1.4s infinite ease-in-out;
}

.thinking-dots span:nth-child(1) {
    animation-delay: 0s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinking-pulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Extended Thinking Toggle */
.extended-thinking-toggle {
    display: flex;
    align-items: center;
}

.extended-thinking-toggle .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.extended-thinking-toggle .form-check-input {
    margin-top: 0;
}

.extended-thinking-toggle .form-check-label {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    cursor: pointer;
}

.thinking-toggle-label {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.thinking-toggle-desc {
    font-size: 11px;
    color: #888;
}

/* ============================================================================
   Compact Model Selector & Thinking Toggle in Input Area
   Relocated from navbar into .icon-group via jQuery detach/insertBefore
   ============================================================================ */

/* Strip <li> styling when inside icon-group */
.icon-group .mode-selector-wrapper {
    list-style: none;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

/* Hide "Model" label in compact mode */
.icon-group .mode-selector-wrapper > label {
    display: none;
}

/* Compact pill-style Kendo dropdown */
.icon-group .k-dropdownlist {
    width: auto !important;
    min-width: unset;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 15px;
    font-size: 13px;
    box-shadow: none;
    transition: background 0.15s ease;
}

.icon-group .k-dropdownlist:hover,
.icon-group .k-dropdownlist.k-focus {
    background: rgba(0, 0, 0, 0.06);
}

.icon-group .k-dropdownlist .k-input-inner {
    padding: 2px 4px 2px 10px;
}

.icon-group .k-dropdownlist .k-input-button {
    padding: 0 6px;
}

.icon-group .selected-title {
    font-size: 13px;
    font-weight: 500;
}

/* Strip <li> styling for thinking toggle */
.icon-group #extendedThinkingToggle {
    list-style: none;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

/* Hide subtitle in compact mode */
.icon-group .thinking-toggle-desc {
    display: none;
}

/* Smaller label */
.icon-group .thinking-toggle-label {
    font-size: 12px;
}

/* Smaller switch */
.icon-group #extendedThinkingToggle .form-check-input {
    width: 28px;
    height: 16px;
}

/* Compact gap between form-check elements */
.icon-group .extended-thinking-toggle .form-check {
    gap: 5px;
}

/* ============================================================================
   Dark Mode: Compact Model Selector & Thinking Toggle
   ============================================================================ */

.prompt-page.dark-mode .icon-group .k-dropdownlist {
    color: #e0e0e0;
}

.prompt-page.dark-mode .icon-group .k-dropdownlist:hover,
.prompt-page.dark-mode .icon-group .k-dropdownlist.k-focus {
    background: rgba(255, 255, 255, 0.1);
}

.prompt-page.dark-mode .icon-group .selected-title {
    color: #e0e0e0;
}

.prompt-page.dark-mode .icon-group .k-input-inner {
    color: #e0e0e0;
}

.prompt-page.dark-mode .icon-group .k-input-button {
    color: #aaa;
}

.prompt-page.dark-mode .icon-group .thinking-toggle-label {
    color: #e0e0e0;
}

/* ============================================================================
   Mobile: Truncate long model names
   ============================================================================ */

@media (max-width: 576px) {
    .icon-group .selected-title {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
    }
}

/* ============================================================================
   Provider Badge Styles
   Phase 22-04: Shows which AI model generated each response
   ============================================================================ */

.provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    margin-bottom: 6px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.provider-badge:hover {
    opacity: 1;
}

.provider-badge i {
    font-size: 10px;
}

/* Provider-specific colours */
.provider-openai {
    background: rgba(16, 163, 127, 0.12);
    color: #10a37f;
}

.provider-anthropic {
    background: rgba(217, 119, 87, 0.12);
    color: #d97757;
}

.provider-google {
    background: rgba(66, 133, 244, 0.12);
    color: #4285f4;
}

.provider-perplexity {
    background: rgba(32, 178, 170, 0.12);
    color: #20b2aa;
}

/* ============================================================================
   Inline Error Bubble Styles
   Phase 22-04: Errors appear as chat bubbles instead of modals
   ============================================================================ */

.chat-error-bubble {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    margin-top: 8px;
    border-radius: 8px;
    background: rgba(220, 53, 69, 0.08);
    border-left: 3px solid #dc3545;
    color: #721c24;
    font-size: 13px;
    line-height: 1.5;
}

.chat-error-bubble i {
    margin-top: 2px;
    flex-shrink: 0;
}

.chat-error-bubble.provider-switch-suggestion {
    flex-wrap: wrap;
    background: rgba(255, 193, 7, 0.08);
    border-left-color: #ffc107;
    color: #856404;
}

/* ============================================================================
   Provider Switch Button Styles
   Phase 22-04: One-click button to switch to suggested alternative model
   ============================================================================ */

.provider-switch-btn {
    margin-top: 8px;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 16px;
    white-space: nowrap;
    width: auto;
    flex-basis: 100%;
}

.provider-switch-btn i {
    margin-right: 4px;
}

.provider-switch-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================================================
   Capability Badges in Model Selector Dropdown
   Phase 26-02: Shows what each model can do (code execution, image generation)
   ============================================================================ */

.capability-badges {
    display: inline-flex;
    gap: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.capability-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    font-size: 9px;
    line-height: 1;
    opacity: 0.7;
}

.capability-badge.cb-code {
    background: #e8f4f8;
    color: #0077b3;
}

.capability-badge.cb-image {
    background: #f0f8e8;
    color: #009e3c;
}

/* ============================================================================
   Dark Mode Overrides
   Uses .prompt-page.dark-mode pattern consistent with commandPalette.css
   ============================================================================ */

.prompt-page.dark-mode .provider-badge {
    opacity: 0.8;
}

.prompt-page.dark-mode .provider-badge:hover {
    opacity: 1;
}

.prompt-page.dark-mode .provider-openai {
    background: rgba(16, 163, 127, 0.2);
    color: #3dd9a6;
}

.prompt-page.dark-mode .provider-anthropic {
    background: rgba(217, 119, 87, 0.2);
    color: #e8a58a;
}

.prompt-page.dark-mode .provider-google {
    background: rgba(66, 133, 244, 0.2);
    color: #7baaf7;
}

.prompt-page.dark-mode .provider-perplexity {
    background: rgba(32, 178, 170, 0.2);
    color: #5cd5cf;
}

.prompt-page.dark-mode .chat-error-bubble {
    background: rgba(220, 53, 69, 0.15);
    color: #f5a6ae;
    border-left-color: #dc3545;
}

.prompt-page.dark-mode .chat-error-bubble.provider-switch-suggestion {
    background: rgba(255, 193, 7, 0.15);
    color: #ffe083;
    border-left-color: #ffc107;
}

.prompt-page.dark-mode .capability-badge.cb-code {
    background: rgba(0, 119, 179, 0.2);
    color: #4db8e0;
}

.prompt-page.dark-mode .capability-badge.cb-image {
    background: rgba(0, 158, 60, 0.2);
    color: #4dce7a;
}

/* ============================================================================
   Stop Button State During AI Streaming
   Phase 32: Send button transforms to stop icon while AI is generating
   ============================================================================ */

#askQuestion.streaming,
.v2-askQuestion.streaming {
    cursor: pointer;
    opacity: 1;
}

#askQuestion.streaming i,
.v2-askQuestion.streaming i {
    color: #ef4444;
    font-size: 16px;
}

#askQuestion.streaming:hover i,
.v2-askQuestion.streaming:hover i {
    color: #dc2626;
}

/* Dark mode: stop button */
.prompt-page.dark-mode #askQuestion.streaming i,
.prompt-page.dark-mode .v2-askQuestion.streaming i {
    color: #f87171;
}

.prompt-page.dark-mode #askQuestion.streaming:hover i,
.prompt-page.dark-mode .v2-askQuestion.streaming:hover i {
    color: #fca5a5;
}
