/* /connect/voice — voice-SPECIFIC rules. The page extends connect/_layout.html
 * (brand surface from app.css + landing.css) and LINKS chat.css so deferred
 * actions reuse the .chat-evenergy-message--* bubble style (DRY). This file owns
 * the control strip, the segmented volume meter, the Call/Hang buttons, and the
 * central chat box chrome. Brand palette (from landing/chat.css):
 *   #0e2b2e bg · #11353a surface · #163e44 elevated · #50FB60 primary lime
 *
 * /connect has no CSS custom-property tokens (its brand colours are Tailwind
 * utility classes compiled into app.css), so plain CSS can't read var(--eve-*).
 * We define the palette ONCE here and reference it, instead of repeating hex. */
:root {
    --v-lime: #50FB60;
    --v-red: #ef4444;
    --v-red-hi: #dc2626;
    --v-ink: #0a0f14;
    --v-mute: #8fa0a3;
    --v-line: rgba(255, 255, 255, 0.1);
}

/* ── Control strip (top, light — no heavy card) ───────────────────────── */
.connect-voice-controls {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.25rem 0.25rem 0.5rem;
}
.connect-voice-controls-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
}
.connect-voice-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-align: left;
}
.connect-voice-field > span {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--v-mute);
}
.connect-voice-buttons {
    display: flex;
    gap: 0.6rem;
    margin-left: auto;
}

/* Buttons — colours set here (arbitrary Tailwind hex isn't in the pre-built
 * app.css). Call = brand lime, Hang = red. */
.connect-voice-call,
.connect-voice-hang {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: 0.9rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.connect-voice-call svg { width: 1.05em; height: 1.05em; }
/* Lime CTA — the ONE place the brand-primary button is styled. Shared by the
 * Call button and the in-bubble deferred-action link (.connect-voice-action),
 * so there is a single source for the lime fill + lift-on-hover. */
.connect-voice-call,
.connect-voice-action {
    background: var(--v-lime);
    color: var(--v-ink);
}
.connect-voice-call:hover:not(:disabled),
.connect-voice-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(80, 251, 96, 0.4);
}
/* Hang: solid red when live; a clear red OUTLINE when idle/disabled (never a
 * muddy half-opacity fill). */
.connect-voice-hang {
    background: var(--v-red);
    color: #ffffff;
    border-color: var(--v-red);
}
.connect-voice-hang:hover:not(:disabled) {
    transform: translateY(-1px);
    background: var(--v-red-hi);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.4);
}
.connect-voice-hang:disabled {
    background: transparent;
    color: var(--v-red);
    border-color: rgba(239, 68, 68, 0.5);
    cursor: not-allowed;
    opacity: 0.75;
}
.connect-voice-call:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.connect-voice-status {
    margin: 0;
    font-size: 0.9rem;
    color: #a7b4b8;
    min-height: 1.4em;
}
.connect-voice-hint {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--v-mute);
}

/* AI transparency line — a touch more present than a hint (thin separator above),
   but still calm and muted so it reassures rather than alarms. */
.connect-voice-disclosure {
    margin: 0.85rem 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--v-line);
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--v-mute);
}

/* ── Traditional segmented volume meter (voice.js builds + lights segments) ── */
.connect-voice-vu {
    display: flex;
    align-items: stretch;
    gap: 3px;
    height: 22px;
    padding: 3px;
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.10);
}
.connect-voice-vu span {
    flex: 1;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.07);
    transition: background 0.05s linear;
}
.connect-voice-vu span.on { background: var(--v-lime); }            /* low band — green  */
.connect-voice-vu span.on:nth-child(n + 11) { background: #f5c451; }  /* mid — amber */
.connect-voice-vu span.on:nth-child(n + 14) { background: var(--v-red); }  /* peak — red  */

/* ── Native selects — on-brand (the brand has no select component) ───────── */
.connect-voice-select {
    color-scheme: dark;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: rgba(14, 43, 46, 0.7);
    color: #e7ecf5;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.6rem;
    padding: 0.5rem 1.9rem 0.5rem 0.7rem;
    font: inherit;
    font-size: 0.88rem;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%23a7b4b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
}
.connect-voice-select:focus { outline: none; border-color: var(--v-lime); }
.connect-voice-select:disabled { opacity: 0.5; }
.connect-voice-select option:disabled { color: rgba(167, 180, 184, 0.6); }

/* ── Central chat box — the focal panel; deferred actions land here ──────── */
.connect-voice-chat {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.1rem 1.2rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(17, 53, 58, 0.6);
    min-height: 150px;
}
.connect-voice-chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.connect-voice-chat-title {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--v-mute);
}
.connect-voice-delivery {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.74rem;
    color: var(--v-mute);
}
.connect-voice-delivery .connect-voice-select {
    padding: 0.25rem 1.6rem 0.25rem 0.55rem;
    font-size: 0.76rem;
    border-radius: 0.5rem;
}

/* Thread — a flex column; bubbles inside use chat.css .chat-evenergy-message--*.
 * Must be a scroll container: renderTranscript pins scrollTop to scrollHeight, which
 * grows the page instead of scrolling if nothing bounds the height. Mirrors #conversation. */
.connect-voice-thread {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: none;
}
.connect-voice-thread::-webkit-scrollbar { display: none; }
.connect-voice-thread:empty { display: none; }

.connect-voice-empty {
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--v-mute);
}

/* Action affordance inside a deferred-action bubble. This is a <button> for the
 * device and account-page handoffs (it opens the shared popup) and an <a> for the sign-in
 * link — the shared lime fill + hover lift come from .connect-voice-call above;
 * this block owns the in-bubble layout PLUS the UA resets a <button> needs to
 * match the <a> (no native border/appearance, inherited font, pointer cursor). */
.connect-voice-action {
    display: inline-block;
    margin-top: 0.5rem;
    text-align: center;
    text-decoration: none;
    padding: 0.6rem 1rem;
    border: 0;
    border-radius: 0.7rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.connect-voice-note {
    margin: 0.45rem 0 0;
    font-size: 0.74rem;
    color: rgba(167, 180, 184, 0.8);
}

/* Channel tag on a message bubble (step 1b) — "Voice" on a transcribed call turn,
 * "Chat" on a typed turn — so a mixed thread reads clearly. Inherits the bubble's
 * text colour at reduced opacity to stay legible on both the user and assistant fills. */
.connect-chan {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    opacity: 0.55;
}
