/* ─── Prior Terminal Animations ──────────────────────────────────────────── */
/* Covers: AI think, file upload, voice TTS terminals,
   model-switch overlay, message appear, chat fade, typing indicator */

/* ── shared terminal window ─────────────────────────────────────────────── */

.pt-win {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.78rem;
    background: #0d0f14;
    border: 1px solid rgba(141, 224, 252, 0.22);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.85rem;
    box-shadow: 0 0 18px rgba(141, 224, 252, 0.06), 0 2px 12px rgba(0,0,0,0.4);
    animation: pt-slide-in 0.22s ease;
}

.pt-win.pt-fade-out {
    animation: pt-fade 0.36s ease forwards;
}

/* ── model switch floating overlay ─────────────────────────────────────── */

.pt-model-overlay {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.78rem;
    position: fixed;
    bottom: 5.5rem;
    right: 1.5rem;
    width: 340px;
    background: #0d0f14;
    border: 1px solid rgba(0, 255, 204, 0.3);
    border-radius: 8px;
    overflow: hidden;
    z-index: 9999;
    box-shadow: 0 0 24px rgba(0, 255, 204, 0.12), 0 4px 20px rgba(0,0,0,0.6);
    animation: pt-slide-up 0.25s ease;
}

.pt-model-overlay.pt-fade-out {
    animation: pt-fade 0.38s ease forwards;
}

@keyframes pt-slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── animations ─────────────────────────────────────────────────────────── */

@keyframes pt-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pt-fade {
    to { opacity: 0; transform: translateY(-4px); max-height: 0; margin: 0; padding: 0; }
}

/* ── title bar ──────────────────────────────────────────────────────────── */

.pt-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.38rem 0.75rem;
    background: #13161e;
    border-bottom: 1px solid rgba(141, 224, 252, 0.1);
    user-select: none;
}

.pt-dots {
    display: flex;
    gap: 5px;
    margin-right: 4px;
}

.pt-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.pt-dot.red    { background: #ff5f57; }
.pt-dot.yellow { background: #febc2e; }
.pt-dot.green  { background: #28c840; }

.pt-title {
    flex: 1;
    color: rgba(255,255,255,0.5);
    font-size: 0.73rem;
    letter-spacing: 0.03em;
}

.pt-status {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.32);
}

.pt-blink {
    animation: pt-blink 0.9s step-start infinite;
    color: #febc2e;
}

@keyframes pt-blink {
    50% { opacity: 0; }
}

.pt-active    { color: #8de0fc; }
.pt-connected { color: #28c840; }

/* ── log area ───────────────────────────────────────────────────────────── */

.pt-log {
    padding: 0.55rem 0.85rem 0.6rem;
    max-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    scrollbar-width: thin;
    scrollbar-color: rgba(141, 224, 252, 0.15) transparent;
}

.pt-log::-webkit-scrollbar       { width: 3px; }
.pt-log::-webkit-scrollbar-thumb { background: rgba(141, 224, 252, 0.18); border-radius: 2px; }

/* ── log lines ──────────────────────────────────────────────────────────── */

.pt-line {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    color: rgba(141, 224, 252, 0.82);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
    animation: pt-row-in 0.12s ease;
}

@keyframes pt-row-in {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}

.pt-pfx { color: rgba(141, 224, 252, 0.3); flex-shrink: 0; }

.pt-dim { color: rgba(255,255,255,0.38); }
.pt-ok  { color: #28c840; }
.pt-err { color: #ff4455; font-weight: 600; }

.pt-guest-cta { margin-top: 6px; }

.pt-guest-signin {
    color: #00ffcc;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
}

.pt-guest-signin:hover { opacity: 0.75; }

.pt-done {
    color: #28c840;
    font-weight: 600;
    margin-top: 3px;
    padding-left: 1.1rem;
}

/* ── progress bar (ripper live download) ────────────────────────────────── */

.pt-progress-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 5px;
    padding-left: 1.1rem;
    animation: pt-row-in 0.12s ease;
}

.pt-progress-track {
    flex: 1;
    height: 5px;
    background: rgba(141, 224, 252, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.pt-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ffcc, #8de0fc);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.pt-progress-label {
    font-size: 0.72rem;
    color: #8de0fc;
    min-width: 2.8rem;
    text-align: right;
}

.pt-progress-meta {
    font-size: 0.67rem;
    color: rgba(255,255,255,0.3);
    min-width: 8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Message appear animation
   Applied to every chat-message when it's appended to the DOM
   ═══════════════════════════════════════════════════════════════════════════ */

.chat-message {
    animation: msg-appear 0.28s ease;
}

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

/* User messages slide in from right */
.chat-message.user-message {
    animation: msg-appear-right 0.26s ease;
}

@keyframes msg-appear-right {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Chat area fade when switching chats
   ═══════════════════════════════════════════════════════════════════════════ */

#chatArea.chat-switching {
    animation: chat-fade-out 0.18s ease forwards;
}

#chatArea.chat-fading-in {
    animation: chat-fade-in 0.22s ease forwards;
}

@keyframes chat-fade-out {
    to { opacity: 0; }
}

@keyframes chat-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Typing indicator reskin
   ═══════════════════════════════════════════════════════════════════════════ */

.loading-dots {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.1rem 0;
}

/* Hide the original 3 dots */
.loading-dot {
    display: none;
}

/* Replace with a terminal-style "Prior is thinking…" line */
.loading-dots::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color, #00ffcc);
    animation: pt-pulse 1.1s ease-in-out infinite;
}

.loading-dots::after {
    content: 'Prior is thinking…';
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--primary-color, #00ffcc);
    opacity: 0.75;
    animation: pt-typing-cursor 1.1s step-start infinite;
}

@keyframes pt-pulse {
    0%, 100% { transform: scale(1);   opacity: 0.6; }
    50%       { transform: scale(1.4); opacity: 1; }
}

@keyframes pt-typing-cursor {
    0%, 100% { opacity: 0.75; }
    50%       { opacity: 0.35; }
}
