/* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: Apache-2.0
 *
 * Layout and styling adapted from aws-samples/sample-voice-agent-on-aws (MIT-0).
 */

.livekit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: #ffffff;
    letter-spacing: -0.03em;
}

.subtitle {
    font-size: 1rem;
    color: #888;
    margin-bottom: 0.8rem;
}

.badges {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-weight: 500;
}

.badge-model {
    background: rgba(255, 152, 0, 0.15);
    color: #ffb74d;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.badge-server {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.3);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Main layout */
.main-content {
    width: 100%;
    max-width: 1400px;
}

.layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

/* Conference panel (left) */
.conference-container {
    background: #1a1a24;
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid #2a2a3a;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.conference-container .panel-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    margin-bottom: 1rem;
}

/* Transcription panel (right) */
.transcription-panel {
    background: #1a1a24;
    border-radius: 20px;
    border: 1px solid #2a2a3a;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    height: 520px;
}

[data-lk-theme="default"] {
    --lk-border-radius: 12px;
    --lk-bg: #1a1a24;
    --lk-fg: #e0e0e0;
}

/* Transcription panel (right) */
.transcription-panel {
    background: #1a1a24;
    border-radius: 20px;
    border: 1px solid #2a2a3a;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    height: 520px;
}

.panel-header {
    padding: 1.2rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #ccc;
    border-bottom: 1px solid #2a2a3a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-header .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.empty-state {
    color: #555;
    font-size: 0.9rem;
    text-align: center;
    padding: 4rem 1rem;
    line-height: 1.6;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.5;
    animation: fadeIn 0.2s ease;
}

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

.message-user {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.2);
}

.message-assistant {
    background: rgba(156, 39, 176, 0.1);
    border: 1px solid rgba(156, 39, 176, 0.2);
}

.message-tool {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.2);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
}

.message-icon {
    flex-shrink: 0;
    font-size: 1rem;
    margin-top: 0.1rem;
}

.message-text {
    flex: 1;
    color: #ddd;
}

.message-time {
    flex-shrink: 0;
    font-size: 0.65rem;
    color: #555;
    align-self: flex-end;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Footer */
.footer {
    margin-top: 2.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: #555;
}

.footer a {
    color: #64b5f6;
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: #90caf9;
}

/* additions for the plain-JS client */
body { margin: 0; background: #0f0f16; color: #e0e0e0; }
.conference-container { display: flex; flex-direction: column; gap: 1rem; }
.btn { background: #2a2a3a; color: #eee; border: 1px solid #3a3a4a; border-radius: 12px; padding: .8rem 1rem; font-size: .95rem; cursor: pointer; }
.btn:hover { background: #34344a; }
.btn.primary { background: #76b900; color: #111; border-color: #76b900; font-weight: 600; }
.btn.danger { background: #b3261e; border-color: #b3261e; }
.btn:disabled { opacity: .5; cursor: default; }
.status { font-size: .85rem; color: #888; }
.meter { height: 8px; border-radius: 4px; background: #2a2a3a; overflow: hidden; }
.meter > div { height: 100%; width: 0; background: #76b900; transition: width .08s; }
.message-text.interim { opacity: .6; }
.hidden { display: none; }

.field { font-size: .8rem; color: #888; }
.select { background: #2a2a3a; color: #eee; border: 1px solid #3a3a4a; border-radius: 12px; padding: .7rem 1rem; font-size: .95rem; }
.select:disabled { opacity: .5; }
.message-event { background: rgba(255,255,255,.04); border: 1px solid #2a2a3a; font-family: 'SF Mono','Fira Code',monospace; font-size: .78rem; }
.message-event.ok { border-color: rgba(76,175,80,.35); background: rgba(76,175,80,.08); }
.message-event.error { border-color: rgba(244,67,54,.4); background: rgba(244,67,54,.08); }
.message-event.interrupt { border-color: rgba(255,193,7,.4); background: rgba(255,193,7,.08); }
.message-event .message-text { color: #bbb; word-break: break-word; }
.hint { font-size: .78rem; color: #888; line-height: 1.4; }
.hint em { color: #aaa; }
.script { background: rgba(118,185,0,.08); border: 1px solid rgba(118,185,0,.45); border-left: 4px solid #76b900; border-radius: 12px; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.script-title { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #76b900; }
.script-line { font-size: 1rem; line-height: 1.35; color: #f2f2f2; font-weight: 500; }
.empty-examples { margin-top: 1rem; display: flex; flex-direction: column; gap: .5rem; font-size: 1.05rem; color: #e8e8e8; font-weight: 500; }

/* Models in use (compact) */
.models { max-width: 1240px; width: 100%; margin: .8rem auto .6rem; box-sizing: border-box; }
.models > summary { display: block; list-style: none; cursor: pointer; color: #aaa; font-size: .8rem; padding: .35rem .8rem; border: 1px solid #2a2a3a; border-radius: 10px; background: #1a1a24; }
.models > summary::-webkit-details-marker { display: none; }
@media (min-width: 700px) { .models[open] > summary { display: none; } }  /* wide: no toggle while the list is open */
.models > summary::after { content: ' ▾'; }
.models[open] > summary::after { content: ' ▴'; }
.model-strip { display: flex; align-items: stretch; justify-content: center; flex-wrap: wrap; gap: .4rem; box-sizing: border-box; }
.model-card { flex: 1 1 0; min-width: 0; max-width: 400px; box-sizing: border-box; text-align: left; background: #1a1a24; border: 1px solid #2a2a3a; border-left: 3px solid var(--stage, #76b900); border-radius: 10px; padding: .4rem .65rem; }
.model-stt { --stage: #2196f3; } .model-llm { --stage: #76b900; } .model-tts { --stage: #9c27b0; }
.model-top { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.model-kind { font-size: .68rem; font-weight: 800; letter-spacing: .08em; color: var(--stage); flex: none; }
.model-name { font-family: 'SF Mono','Fira Code',monospace; font-size: .76rem; color: #eee; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.model-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .45rem; margin-top: .3rem; }
.pill { font-size: .64rem; padding: .08rem .45rem; border-radius: 999px; background: #262636; color: #aaa; border: 1px solid #33334a; white-space: nowrap; }
.pill-runtime { color: #ddd; }
.model-link { font-size: .7rem; color: #8fd14f; text-decoration: none; white-space: nowrap; }
.model-link:hover { text-decoration: underline; }
.model-arrow { align-self: center; color: #555; font-size: 1.1rem; }
.badge-local { background: rgba(118,185,0,.15); color: #9be15a; border-color: rgba(118,185,0,.4); }
@media (max-width: 899px) { .model-strip { flex-direction: column; } .model-arrow { display: none; } .model-card { flex: none; max-width: none; width: 100%; } .model-name { -webkit-line-clamp: 1; } }
@media (max-width: 699px) {
  .livekit { padding: 1rem; }
  .header { margin-bottom: 1rem; }
  .title { font-size: 1.6rem; margin-bottom: .25rem; }
  .subtitle { font-size: .85rem; margin-bottom: .4rem; }
  .models > summary { display: block; }
  .models[open] > summary { margin-bottom: .4rem; }
}

.phone { background: rgba(118,185,0,.08); border: 1px solid rgba(118,185,0,.45); border-radius: 12px; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.phone.hidden { display: none; }  /* must follow .phone, which sets display: flex */
.phone-number { color: #76b900; font-size: 1.15rem; font-weight: 600; text-decoration: none; }
.phone-number:hover { text-decoration: underline; }
.phone-help summary { cursor: pointer; font-size: .78rem; color: #888; }
.phone-help code { color: #bbb; }
.login { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: rgba(10,10,18,.92); }
.login.hidden { display: none; }
.login-box { width: min(22rem, 90vw); background: #1a1a26; border: 1px solid #2a2a3a; border-radius: 16px; padding: 1.4rem; display: flex; flex-direction: column; gap: .8rem; }
