/* ==========================================================================
   Sales Agent -- gate + chat UI. Builds on the marketing site's own design
   tokens (site.css :root) so this feels like one product, not a bolt-on.
   ========================================================================== */

.sales-body {
    min-height: 100vh;
}

.sales-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 18px 0;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(5, 6, 10, 0.72);
    backdrop-filter: blur(14px);
}

.sales-nav-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
}

.sales-nav-row .brand img {
    height: 28px;
}

.sales-nav-badge {
    padding: 5px 12px;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sales-nav-exit {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
}

.sales-nav-exit:hover {
    color: var(--text);
}

.sales-main {
    padding: 20px 0 clamp(40px, 8vw, 90px);
}

.sales-shell {
    display: flex;
    justify-content: center;
}

/* ---------- Gate ---------- */

.gate-wrap {
    width: 100%;
    max-width: 480px;
}

.gate-card {
    padding: 40px 34px;
    text-align: center;
}

.gate-step-hidden {
    display: none;
}

.gate-title {
    margin-top: 14px;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}

.gate-copy {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.gate-card .btn {
    margin-top: 24px;
}

.gate-error {
    min-height: 1.2em;
    margin: 14px 0 0;
    color: #ff8a8a;
    font-size: 0.84rem;
}

.code-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

.code-input {
    width: 220px;
    padding: 14px 12px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.5em;
    text-align: center;
}

.code-input:focus {
    outline: none;
    border-color: var(--cyan);
}

.code-form .btn {
    margin-top: 0;
    width: 100%;
}

.gate-resend {
    margin-top: 14px;
    color: var(--muted);
    border: 0;
    background: none;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

.gate-resend:hover:not(:disabled) {
    color: var(--text);
}

.gate-resend:disabled {
    color: var(--muted-soft);
    cursor: default;
    text-decoration: none;
}

/* ---------- Agent chat ---------- */

.agent-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 900px;
    height: min(72vh, 780px);
}

/* Two-column body: avatar stage (left) + conversation (right). Both border
   and rounding live HERE, not on the two children -- overflow:hidden clips
   them to the shared bottom corners, so neither child needs its own radius. */
.agent-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    border-top: 0;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* !important is deliberate here: .agent-hidden is a state utility applied
   ALONGSIDE a component's own layout class on the same element (e.g.
   class="voice-idle agent-hidden"), and without it, whichever of the two
   equal-specificity single-class rules happens to sit LATER in this file
   silently wins the cascade regardless of which one is semantically meant
   to win -- this exact bug has already shipped twice (the 3D-avatar
   fallback, then the voice-idle/voice-call toggle both rendering at once).
   !important makes "hidden" unconditionally win, every time, regardless of
   source order, so this class of bug can't recur a third time. */
.agent-hidden {
    display: none !important;
}

.agent-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    border: 1px solid var(--border-soft);
    border-bottom: 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: rgba(255, 255, 255, 0.03);
}

.agent-header-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.agent-header-title {
    font-weight: 800;
    font-size: 1rem;
}

.agent-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.78rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(83, 230, 166, 0.2);
}

.agent-header .btn {
    margin-left: auto;
}

/* ---------- Avatar stage (left column) ---------- */

.agent-stage {
    position: relative;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 280px;
    border-right: 1px solid var(--border-soft);
    /* The dark scrim sits between the photo and the transparent-canvas avatar
       (see .agent-avatar-stage below) -- without it the avatar and the
       stage-status text lose contrast against the photo's bright LED strips. */
    background:
        linear-gradient(180deg, rgba(5, 6, 10, 0.4), rgba(5, 6, 10, 0.6)),
        url('/images/pantherSIS-hallway.jpeg') center / cover no-repeat;
}

/* TalkingHead creates its own <canvas> inside this div and sizes it to fill
   the div -- unlike the removed Anam integration, there's no <video> element
   here at all, just a plain container the library owns. */
.agent-avatar-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.agent-stage-status {
    position: relative;
    z-index: 1;
    max-width: 200px;
    padding: 10px 14px;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
    background: rgba(5, 6, 10, 0.55);
    border-radius: var(--radius-sm);
}

.agent-stage.avatar-ready .agent-stage-status {
    display: none;
}

/* ---------- Conversation (right column) ---------- */

.agent-conversation {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.agent-chat {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    overflow-y: auto;
    padding: 22px;
    background: rgba(10, 12, 20, 0.4);
}

.chat-row {
    display: flex;
    gap: 10px;
    max-width: 88%;
}

.chat-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    display: grid;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    font-size: 0.82rem;
    font-weight: 800;
}

.chat-avatar.ai {
    background: linear-gradient(135deg, var(--violet), var(--cyan));
    color: white;
}

.chat-avatar.user {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

.chat-bubble {
    padding: 12px 16px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.chat-row.user .chat-bubble {
    border-color: rgba(157, 92, 255, 0.35);
    background: linear-gradient(120deg, rgba(157, 92, 255, 0.16), rgba(45, 168, 255, 0.1));
}

.chat-row.error .chat-bubble {
    border-color: rgba(255, 138, 138, 0.4);
    background: rgba(255, 138, 138, 0.08);
    color: #ffb3b3;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
    animation: typing-blink 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-blink {
    0%, 80%, 100% { opacity: 0.25; }
    40%           { opacity: 1; }
}

.agent-input-row {
    display: flex;
    flex-shrink: 0;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.03);
}

.agent-input {
    flex: 1;
    padding: 12px 14px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.9rem;
}

.agent-input:focus {
    outline: none;
    border-color: var(--cyan);
}

.agent-input-row .btn {
    min-width: 0;
    padding: 12px 20px;
}

/* Icon-only (no label) -- square instead of the text buttons' wide padding. */
.agent-mic-btn {
    flex-shrink: 0;
    width: 44px;
    padding: 0 !important;
    font-size: 1.1rem;
}

.agent-mic-btn.mic-active {
    color: white;
    border-color: var(--cyan);
    background: var(--cyan);
    animation: mic-pulse 1.4s infinite ease-in-out;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(56, 242, 220, 0.45); }
    50%      { box-shadow: 0 0 0 8px rgba(56, 242, 220, 0); }
}

.agent-note {
    margin-top: 12px;
    color: var(--muted-soft);
    font-size: 0.76rem;
    text-align: center;
}

@media (max-width: 640px) {
    .agent-wrap {
        height: min(80vh, 780px);
    }
    /* The two-column layout needs real width for the avatar column to make
       sense -- below it, stack avatar-on-top like the original layout. */
    .agent-body {
        flex-direction: column;
    }
    .agent-stage {
        width: 100%;
        height: 200px;
        border-right: 0;
        border-bottom: 1px solid var(--border-soft);
    }
    .code-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sales-nav-badge {
        display: none;
    }
}
