/*
 * PUBLIC CHARLIE — Placeholder styles
 * =====================================
 * ChatGPT / Cowork aesthetic. Premium, restrained, calm.
 * Own classes only. No frameworks. Uses tokens.css where sensible.
 *
 * Pages: /charlie (gate), /charlie/chat (chat)
 */

/* ---------- Page shell ---------- */

.pc-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fafaf9;        /* off-white, warmer than pure white */
    color: #1a1a1a;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

/* ---------- Gate page header (simple) ---------- */

.pc-header {
    padding: 20px 32px;
    border-bottom: 1px solid #ececec;
    display: flex;
    align-items: center;
}

.pc-firm-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pc-firm-name {
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: #1a1a1a;
    text-decoration: none;
    transition: opacity 0.2s ease;
}
a.pc-firm-name:hover { opacity: 0.6; }

/* ---------- Gate page body ---------- */

.pc-gate-main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 48px 24px;
}

.pc-gate-card {
    width: 100%;
    max-width: 620px;
    background: #ffffff;
    border: 1px solid #ececec;
    border-radius: 14px;
    padding: 40px 40px 32px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 8px 24px rgba(0,0,0,0.04);
}

.pc-hero-title {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
    color: #111;
}

.pc-hero-sub {
    color: #4a4a4a;
    margin: 0 0 24px;
    font-size: 16px;
}

.pc-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #f0f0f0;
}

.pc-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b6b6b;
    margin: 0 0 12px;
}

.pc-muted {
    color: #4a4a4a;
    margin: 0 0 12px;
}

.pc-tiny {
    font-size: 12px;
    color: #999;
    margin: 8px 0 0;
}

/* ---------- Input row (gate) ---------- */

.pc-input-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.pc-input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #d8d8d8;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.15s ease;
}

.pc-input:focus {
    outline: none;
    border-color: #1a1a1a;
}

.pc-btn-primary {
    padding: 12px 20px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.pc-btn-primary:hover:not(:disabled) {
    background: #333;
}

.pc-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- Details / T&Cs ---------- */

.pc-details {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.pc-details summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #4a4a4a;
    padding: 4px 0;
}

.pc-details-body {
    padding: 12px 0 4px;
    color: #6b6b6b;
    font-size: 14px;
}

/* ---------- Footer ---------- */

.pc-footer,
.pc-chat-footer {
    padding: 16px 32px;
    font-size: 12px;
    color: #999;
    text-align: center;
    border-top: 1px solid #ececec;
}

.pc-chat-footer {
    margin-top: 12px;
    border-top: none;
    background: transparent;
    padding: 10px 16px 14px;
}

/* =========================================================== */
/*  CHAT PAGE                                                  */
/* =========================================================== */

.pc-chat {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fafaf9;
}

.pc-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid #ececec;
    background: #fafaf9;
    z-index: 10;
}

.pc-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pc-verified {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6b6b6b;
    padding: 6px 12px;
    background: #f3f4f2;
    border-radius: 999px;
}

.pc-verified-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    flex: 0 0 auto;
}

.pc-voice-select {
    padding: 5px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 12px;
    color: #1a1a1a;
    background: #fff;
    max-width: 200px;
}
.pc-voice-select:focus { outline: none; border-color: #b0b0b0; }

.pc-mute-btn { font-size: 15px; }
.pc-mute-btn.is-muted { opacity: 0.45; }

/* Listening state is carried by the End/waveform pill, not the mic icon. */
.pc-mic-btn.is-listening {
    background: #f0efeb;
    color: #1a1a1a;
}

/* ---------- About Charlie dropdown ---------- */

.pc-about-menu {
    position: relative;
}

.pc-about-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: #1a1a1a;
    cursor: pointer;
}

.pc-about-btn:hover {
    background: #f3f4f2;
}

.pc-about-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    display: none;                   /* toggle via JS later */
    font-size: 13px;
    color: #4a4a4a;
}

.pc-about-menu:hover .pc-about-panel,
.pc-about-menu:focus-within .pc-about-panel {
    display: block;
}

.pc-about-list {
    margin: 10px 0;
    padding-left: 18px;
    color: #1a1a1a;
}

.pc-about-list li {
    padding: 3px 0;
}

.pc-voice-row,
.pc-model-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    font-size: 12px;
    color: #6b6b6b;
}

.pc-voice-row span,
.pc-model-row span {
    flex: 0 0 56px;
    font-weight: 500;
    color: #4a4a4a;
}

.pc-chip {
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 999px;
    font-size: 12px;
    font-family: inherit;
    color: #4a4a4a;
    cursor: pointer;
}

.pc-chip-on {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

.pc-link-danger {
    display: block;
    margin-top: 14px;
    padding: 6px 0;
    background: transparent;
    border: none;
    font-size: 12px;
    color: #b91c1c;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
}

/* ---------- Chat main / empty state ---------- */

.pc-chat-main {
    flex: 1;
    min-height: 0;               /* let the child scroller actually scroll */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    width: 100%;
}

.pc-empty {
    width: 100%;
    max-width: 720px;
    margin: auto;                /* centre vertically in main */
    padding: 32px 16px;
    text-align: center;
}

/* ---------- Thread (after first message) ----------
   Scroll container is full viewport width so its scrollbar sits at the
   right edge of the screen, ChatGPT-style. An inner wrapper centres the
   messages in a 760px band.
*/

.pc-thread {
    flex: 1;
    width: 100%;
    max-width: none;
    overflow-y: auto;
    padding: 24px 0 20vh;          /* bottom gap so the latest line never kisses the composer */
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;           /* centres each .pc-msg via its own mx:auto */
    scroll-behavior: smooth;
}

.pc-msg {
    width: 100%;
    max-width: 760px;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-sizing: border-box;
}

.pc-msg-user {
    width: auto;                   /* user bubble sizes to content */
    max-width: min(85%, 640px);
    align-self: flex-end;
    margin-right: calc(max(0px, (100vw - 760px) / 2) + 16px);
    background: #1a1a1a;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.pc-msg-charlie {
    background: transparent;
    color: #1a1a1a;
    border: none;
    padding: 4px 16px;
    border-radius: 0;
    /* inherits width 100% + max-width 760px from .pc-msg */
}

.pc-msg-pending {
    opacity: 0.7;
    font-style: italic;
}

.pc-retry-row {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #fff8e6 !important;
    border: 1px solid #f0dca0;
    color: #8a6d2a;
    border-radius: 10px;
    padding: 10px 14px;
    font-style: italic;
}

.pc-retry-btn {
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 5px 14px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}
.pc-retry-btn:hover { background: #333; }

/* Docked composer — used once a conversation is in progress.
   Outer wrapper matches the 760px thread band and adds side gutters on mobile
   so the composer never kisses the screen edges. */
.pc-composer-docked {
    width: calc(100% - 32px);
    max-width: 760px;
    margin: 12px auto 0;
    padding: 12px 18px 10px;
    background: #fff;
}

@media (max-width: 640px) {
    .pc-composer-docked {
        width: calc(100% - 24px);
        margin: 10px auto 0;
    }
    .pc-msg {
        padding: 12px 14px;
    }
    .pc-msg-user {
        margin-right: 12px;
        max-width: min(85%, 640px);
    }
    .pc-msg-charlie {
        padding: 4px 14px;
    }
    .pc-thread {
        padding: 16px 0 8px;
    }
}

.pc-empty-title {
    font-size: 34px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #111;
    margin: 0 0 12px;
}

.pc-empty-sub {
    color: #6b6b6b;
    font-size: 15px;
    margin: 0 0 32px;
}

/* ---------- Composer (input area) ----------

   ChatGPT-style single rounded container. Textarea has no border of its own;
   the container IS the visual box. Textarea auto-grows via JS (autogrow.js).
*/

.pc-composer {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 26px;
    padding: 12px 18px 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 6px 20px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pc-composer:focus-within {
    border-color: #b0b0b0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 8px 28px rgba(0,0,0,0.06);
}

.pc-composer-input {
    width: 100%;
    border: none;
    outline: none;
    box-shadow: none;
    resize: none;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    color: #1a1a1a;
    background: transparent;
    padding: 6px 2px 2px;
    min-height: 28px;
    max-height: 40vh;           /* cap at 40% viewport — then it scrolls */
    overflow-y: auto;
    -webkit-appearance: none;
    appearance: none;
}

.pc-composer-input:focus,
.pc-composer-input:focus-visible,
.pc-composer-input:hover,
.pc-composer-input:active {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.pc-composer-input::placeholder {
    color: #9a9a9a;
}

.pc-composer-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pc-composer-tools-left,
.pc-composer-tools-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pc-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #1a1a1a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.pc-icon-btn:hover:not(:disabled) {
    background: #e8e8e3;
}

/* Dictate mic — visible circle background like ChatGPT so the icon reads with weight */
.pc-icon-btn.pc-mic-btn {
    background: #f0efeb;
    color: #1a1a1a;
}
.pc-icon-btn.pc-mic-btn:hover:not(:disabled) { background: #e4e3de; }
.pc-icon-btn.pc-mic-btn svg { width: 20px; height: 20px; }

/* Voice-mode entry button — solid black circle, prominent */
.pc-send-btn.pc-voice-mode-btn {
    background: #1a1a1a;
    color: #fff;
}
.pc-send-btn.pc-voice-mode-btn svg { width: 18px; height: 18px; }

/* Send button slightly larger icon for parity */
.pc-send-btn svg { width: 18px; height: 18px; }

.pc-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.pc-send-btn:hover:not(:disabled) {
    background: #333;
}

/* Stop button — swaps in for Send while Charlie is speaking.
   Visually distinct so the interrupt affordance is obvious. */
.pc-send-btn.pc-stop-btn {
    background: #b91c1c;
    animation: pc-stop-pulse 1.4s ease-in-out infinite;
}
.pc-send-btn.pc-stop-btn:hover { background: #991616; }
@keyframes pc-stop-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(185,28,28,0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(185,28,28,0); }
    100% { box-shadow: 0 0 0 0 rgba(185,28,28,0); }
}

/* Voice mode (phone-call style) — distinct from single-turn dictate. Black circle
   with a wave-bars glyph; pulses while active. */
.pc-send-btn.pc-voice-btn {
    background: #1a1a1a;
    color: #fff;
}
.pc-send-btn.pc-voice-btn:hover:not(:disabled) { background: #333; }
.pc-send-btn.pc-voice-btn.is-active {
    background: #1a1a1a;
    color: #fff;
    animation: pc-voice-pulse 1.8s ease-in-out infinite;
}
@keyframes pc-voice-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(26,26,26,0.35); }
    70%  { box-shadow: 0 0 0 10px rgba(26,26,26,0); }
    100% { box-shadow: 0 0 0 0 rgba(26,26,26,0); }
}

/* Dictation active — × (cancel) and ✓ (confirm) */
.pc-dictate-cancel {
    color: #6b6b6b;
    font-size: 18px;
}
.pc-dictate-cancel:hover:not(:disabled) {
    background: #fdecec;
    color: #b91c1c;
}
.pc-send-btn.pc-dictate-confirm {
    background: #10b981;
    color: #fff;
}
.pc-send-btn.pc-dictate-confirm:hover { background: #0e9f6e; }

/* Voice-mode entry button (text mode idle) */
.pc-icon-btn.pc-voice-mode-btn {
    background: #1a1a1a;
    color: #fff;
}
.pc-icon-btn.pc-voice-mode-btn:hover { background: #333; color: #fff; }

/* End-voice pill — visible only while in voice conversation mode */
.pc-end-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    border: none;
    border-radius: 999px;
    background: #1e90ff;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease;
}
.pc-end-pill:hover { background: #1a7ad9; }
.pc-end-pill svg { margin-right: 2px; }
.pc-end-pill span { line-height: 1; }
/* End pill pulses while voice mode is active — this is the visual indicator,
   not the mic. Mic stays quiet. */
.pc-end-pill { animation: pc-voice-pulse 1.8s ease-in-out infinite; }

/* Mute-mic pill — shown next to the End pill while in voice conversation.
   Label + icon so the user can read what it does, not just guess.
   Grey default = "click to mute", red = "currently muted, click to unmute". */
.pc-mic-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: 999px;
    background: #f0efeb;
    color: #1a1a1a;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.pc-mic-pill:hover { background: #e4e3de; }
.pc-mic-pill svg { width: 16px; height: 16px; }
.pc-mic-pill span { line-height: 1; }

.pc-mic-pill.is-muted {
    background: #d94a4a;
    color: #fff;
}
.pc-mic-pill.is-muted:hover { background: #c43e3e; }

/* Spinner animation for the polish step and send-while-waiting */
@keyframes pc-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.pc-spin { animation: pc-spin 0.9s linear infinite; transform-origin: center; }

/* Live transcription bubble in voice mode — italic, dashed, with a small tag */
.pc-msg-interim {
    opacity: 0.75;
    font-style: italic;
    border: 1px dashed rgba(255,255,255,0.25);
    background: #1a1a1a;
}
.pc-transcribing-tag {
    display: inline-block;
    margin-right: 8px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-style: normal;
}

/* Icon buttons hold SVGs — ensure the svg sits centred with no baseline offset */
.pc-icon-btn svg,
.pc-send-btn svg { display: block; }

.pc-send-btn:disabled,
.pc-icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ---------- Starter chips ---------- */

.pc-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pc-starter-chip {
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 999px;
    font-size: 13px;
    font-family: inherit;
    color: #4a4a4a;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.pc-starter-chip:hover:not(:disabled) {
    background: #f3f4f2;
    border-color: #d0d0d0;
    color: #1a1a1a;
}

.pc-starter-chip:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---------- Responsive niceties ---------- */

@media (max-width: 640px) {

    .pc-chat-header,
    .pc-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 8px;
        row-gap: 10px;
    }

    /* On narrow screens the firm name + the right-hand controls don't fit in
       one row. Let the right-hand cluster wrap onto its own line below the
       firm name, and let its items also wrap (model picker, voice style,
       speaker icon, verified badge, clear-chat). */
    .pc-header-right {
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 8px;
        row-gap: 8px;
        justify-content: flex-start;
    }

    .pc-voice-select,
    .pc-voice-select:nth-of-type(1) {
        max-width: 100%;
        flex: 1 1 auto;
    }

    .pc-gate-card {
        padding: 28px 22px 24px;
    }

    .pc-hero-title {
        font-size: 26px;
    }

    .pc-empty-title {
        font-size: 26px;
    }

    .pc-about-panel {
        width: 280px;
    }
}
