/* ============================================================
   PixLab Forensic — Shared components
   Inspector tabs, chat, playbar, settings modal, toasts.
   ============================================================ */

/* ---------- Inspector tabs ---------- */

.inspector-tabs {
    display: flex;
    gap: var(--sp-2);
    padding: var(--sp-2);
    border-bottom: 1px solid var(--border-a30);
    background-color: var(--panel-tint);
}

.tab-btn {
    flex: 1;
    padding: 0.375rem 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    transition: color var(--t-fast), background-color var(--t-fast);
}

.tab-btn:hover {
    color: var(--text-high);
}

.tab-btn.active {
    background-color: var(--bg-700);
    color: var(--text-high);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* ---------- Chat history ---------- */

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-4) var(--sp-4) 7.5rem;
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    font-size: 0.875rem;
}

.msg {
    display: flex;
    gap: var(--sp-3);
    margin-top: var(--sp-1);
}

.msg i {
    font-size: 1.125rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.msg.system i {
    color: var(--accent-cyan);
}

.msg.system.error i {
    color: var(--accent-red);
}

.msg.system.success i {
    color: var(--accent-green);
}

.msg.user {
    flex-direction: row-reverse;
    color: var(--text-high);
}

.msg.user i {
    color: var(--text-muted);
}

.bubble {
    padding: var(--sp-3);
    border: 1px solid var(--border-a20);
    width: fit-content;
    max-width: 100%;
    overflow-wrap: break-word;
}

.msg.system .bubble {
    background-color: var(--bubble-system-bg);
    border-top-right-radius: var(--radius-xl);
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-sm);
}

.msg.user .bubble {
    background-color: var(--bg-700);
    border: 1px solid var(--border-a50);
    border-top-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    border-bottom-left-radius: var(--radius-sm);
}

.bubble p {
    margin: 0;
}

.bubble.featured {
    background-color: var(--bg-700);
    border: 1px solid var(--border-a50);
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 28rem;
    padding: var(--sp-4);
}

/* Markdown content inside bubbles */
.md-content ul,
.md-content ol {
    margin: var(--sp-2) 0;
    padding-left: var(--sp-4);
}

.md-content li {
    margin: var(--sp-1) 0;
}

.md-content code {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    background-color: var(--bg-900);
    border: 1px solid var(--border-a20);
    border-radius: var(--radius-sm);
    padding: 0.1em 0.35em;
}

.md-content pre {
    background-color: var(--bg-900);
    border: 1px solid var(--border-a20);
    border-radius: var(--radius-md);
    padding: var(--sp-3);
    overflow-x: auto;
}

.md-content strong {
    font-weight: 600;
    color: var(--text-high);
}

/* Quick action pills under VLM summaries */

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-top: var(--sp-4);
}

.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--radius-pill);
    transition: all var(--t-med), color var(--t-fast);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.quick-action-btn:hover i {
    animation: bounce-icon 0.5s ease-in-out infinite alternate;
}

.qa-blue {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.10);
    border: 1px solid rgba(59, 130, 246, 0.30);
}

.qa-blue:hover {
    background: var(--accent-blue);
    color: #ffffff;
}

.qa-purple {
    color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.10);
    border: 1px solid rgba(139, 92, 246, 0.30);
}

.qa-purple:hover {
    background: var(--accent-purple);
    color: #ffffff;
}

.qa-cyan {
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.10);
    border: 1px solid rgba(6, 182, 212, 0.30);
}

.qa-cyan:hover {
    background: var(--accent-cyan);
    color: #ffffff;
}

/* ---------- Chat input ---------- */

.chat-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--sp-4);
    padding-top: 2.5rem;
    background: linear-gradient(to top, var(--bg-800) 30%, transparent);
    pointer-events: none;
}

.chat-input-area>* {
    pointer-events: auto;
}

.input-shell {
    background-color: var(--bg-900);
    border: 1px solid var(--border-a50);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    transition: border-color var(--t-fast);
    overflow: hidden;
}

.input-shell:focus-within {
    border-color: rgba(6, 182, 212, 0.8);
}

#chat-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--text-high);
    font-size: 0.875rem;
    min-height: 60px;
    max-height: 150px;
    padding: var(--sp-3);
}

#chat-input::placeholder {
    color: var(--text-muted);
}

.input-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-2);
    border-top: 1px solid var(--border-a20);
}

.tool-btns {
    display: flex;
    gap: var(--sp-2);
}

.tool-btn {
    padding: 0.375rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: color var(--t-fast);
}

.tool-btn:hover {
    color: var(--text-high);
}

.tool-btn.attach:hover {
    color: var(--accent-blue);
}

.tool-btn.mic:hover {
    color: var(--accent-purple);
}

.send-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.10);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--t-fast);
}

.send-btn:hover {
    background: var(--accent-blue);
    color: #ffffff;
}

/* ---------- Bottom playbar / zoom controls ---------- */

.playbar {
    height: var(--playbar-h);
    flex-shrink: 0;
    border-top: 1px solid var(--border-a30);
    background-color: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-4);
    z-index: 30;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    color: var(--text-muted);
}

.timeline-controls.disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

#play-btn {
    font-size: 1.375rem;
    cursor: pointer;
    color: inherit;
    transition: color var(--t-fast);
}

#play-btn:hover,
#play-btn.enabled {
    color: var(--text-high);
}

.progress-track {
    width: 16rem;
    height: 4px;
    background-color: var(--bg-600);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-fill {
    width: 0;
    height: 100%;
    background-color: var(--accent-blue);
    transition: width 120ms linear;
}

.time-readout {
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

/* ---------- Settings modal ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.60);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--sp-4);
    opacity: 0;
    transition: opacity var(--t-med);
}

.modal-overlay.visible {
    opacity: 1;
}

.modal-card {
    background-color: var(--bg-800);
    border: 1px solid var(--border-a50);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-pane);
    width: 100%;
    max-width: 32rem;
    transform: scale(0.95);
    transition: transform var(--t-med);
}

.modal-overlay.visible .modal-card {
    transform: scale(1);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-5, 1.25rem);
    border-bottom: 1px solid var(--border-a30);
}

.modal-title {
    font-size: 1.0625rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin: 0;
}

.modal-title i {
    color: var(--accent-blue);
}

.modal-body {
    padding: var(--sp-6);
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
}

.settings-group-title {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0 0 var(--sp-3);
}

.field label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: var(--sp-1);
}

.field input[type="password"],
.field input[type="text"] {
    width: 100%;
    background-color: var(--bg-900);
    border: 1px solid var(--border-a50);
    border-radius: var(--radius-sm);
    padding: 0.5rem var(--sp-3);
    font-size: 0.875rem;
    color: var(--text-high);
    outline: none;
    transition: border-color var(--t-fast);
}

.field input:focus {
    border-color: var(--accent-cyan);
}

.pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-2) 0;
    font-size: 0.875rem;
}

.pref-row+.pref-row {
    border-top: 1px solid var(--border-a20);
}

/* Toggle switch */

.switch {
    position: relative;
    width: 2.5rem;
    height: 1.25rem;
    flex-shrink: 0;
    cursor: pointer;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.switch .slider {
    position: absolute;
    inset: 0;
    background-color: var(--bg-600);
    border-radius: var(--radius-pill);
    transition: background-color var(--t-fast);
}

.switch .slider::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: transform var(--t-fast), background-color var(--t-fast);
}

.switch input:checked+.slider {
    background-color: var(--accent-green);
}

.switch input:checked+.slider::before {
    transform: translateX(1.25rem);
    background-color: #ffffff;
}

.modal-foot {
    padding: var(--sp-4);
    border-top: 1px solid var(--border-a30);
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-3);
    background-color: var(--panel-tint);
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
}

.link-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color var(--t-fast);
}

.link-btn:hover {
    color: var(--text-high);
}

/* ---------- Toasts ---------- */

.toast-stack {
    position: fixed;
    bottom: 4.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    pointer-events: none;
}

.toast {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    background-color: var(--bg-800);
    color: var(--text-high);
    border: 1px solid var(--border-a50);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-card);
    animation: fade-in 200ms ease-out both;
}

.toast.success i {
    color: var(--accent-green);
}

.toast.error i {
    color: var(--accent-red);
}
