/* Concierge dock — scoped styles. Lives inside the right-side dock panel. */

.concierge-dock * { box-sizing: border-box; }

.concierge-dock {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 360px;
    background: #0b0d12;
    color: #d9d9d5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 40;
    border-left: 1px solid #1c1f26;
    transition: width .3s ease, height .3s ease, top .3s ease,
                bottom .3s ease, right .3s ease, background .3s ease,
                border-color .3s ease, transform .3s ease;
    display: flex;
}

.concierge-dock[data-state="collapsed"][data-display="maximized"] {
    transform: translateX(312px);
}

/* --- Display: RESTORED (avatar only, floating bottom-right) ------- */
.concierge-dock[data-display="restored"] {
    top: auto; left: auto;
    right: 0; bottom: 0;
    width: 240px;
    height: 360px;
    background: transparent;
    border: 0;
    overflow: visible;
}
.concierge-dock[data-display="restored"] .concierge-dock__tab { display: none; }
.concierge-dock[data-display="restored"] #concierge-root { display: block; }
.concierge-dock[data-display="restored"] .dock-inner {
    padding: 0;
    gap: 0;
    overflow: visible;
}
.concierge-dock[data-display="restored"] .dock-topbar,
.concierge-dock[data-display="restored"] .tool-indicator,
.concierge-dock[data-display="restored"] .transcript,
.concierge-dock[data-display="restored"] .input-bar,
.concierge-dock[data-display="restored"] .dock-flash { display: none; }
.concierge-dock[data-display="restored"] .avatar-panel {
    height: 100%;
    background: transparent;
    border: 0;
    border-radius: 0;
    cursor: pointer;
    overflow: hidden;   /* clip the oversized canvas at the viewport edge */
}
/* Oversize the canvas below the panel and clip so Eleanor's torso
   reaches the panel bottom (i.e. the viewport bottom). */
.concierge-dock[data-display="restored"] .avatar-mount {
    margin-top: 0;
    height: calc(100% + 80px);
}
.concierge-dock[data-display="restored"] .avatar-panel:hover {
    filter: drop-shadow(0 0 14px rgba(212,175,55,.25));
}
.concierge-dock[data-display="restored"][data-mic="active"] .avatar-panel {
    filter: drop-shadow(0 0 18px rgba(212,175,55,.4));
}

/* --- Display: MINIMIZED (mic icon only) --------------------------- */
.concierge-dock[data-display="minimized"] {
    top: auto; left: auto;
    right: 20px; bottom: 20px;
    width: 64px;
    height: 64px;
    background: transparent;
    border: 0;
    overflow: visible;
}
.concierge-dock[data-display="minimized"] .concierge-dock__tab { display: none; }
.concierge-dock[data-display="minimized"] #concierge-root { display: none; }
.concierge-dock[data-display="minimized"] .dock-mini-mic { display: flex; }

/* Collapsed pull-tab */
.concierge-dock__tab {
    position: absolute;
    top: 24px;
    left: -1px;
    width: 44px;
    height: 112px;
    border: 1px solid #1c1f26;
    border-right: 0;
    background: #0b0d12;
    color: #d9d9d5;
    cursor: pointer;
    border-radius: 8px 0 0 8px;
    transform: translateX(-100%);
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 14px;
    letter-spacing: 0.1em;
}
.concierge-dock__tab-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: inline-block;
    text-transform: uppercase;
    color: #D4AF37;
}

#concierge-root {
    width: 100%;
    height: 100%;
    display: flex;
}

.dock-inner {
    display: flex;
    flex-direction: column;
    padding: 8px 14px 14px;
    gap: 10px;
    width: 100%;
    height: 100%;
    overflow: hidden;          /* stop outer scrollbar at 1080p */
    position: relative;
}

/* --- Avatar panel ------------------------------------------------- */
.avatar-panel {
    position: relative;
    flex: 0 0 auto;
    height: 280px;
    border-radius: 10px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 30%, rgba(212,175,55,.08) 0%, transparent 60%),
        linear-gradient(180deg, #14161d 0%, #0b0d12 100%);
    border: 1px solid #1c1f26;
    display: flex;
    align-items: stretch;
    justify-content: center;
}
.avatar-mount {
    width: 100%;
    height: 100%;
    /* Shift the 3D canvas up slightly to crop the empty space above
       Eleanor's head without changing the avatar framing itself. */
    margin-top: -24px;
    /* No mouse interaction with the model — visual only. */
    pointer-events: none;
    user-select: none;
}
.avatar-mount canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    pointer-events: none;
}

/* --- Top bar (maximized only) ------------------------------------ */
.dock-topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px 4px 10px;
    min-height: 28px;
}
.dock-topbar__label {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9aa0ab;
    flex: 1 1 auto;
}
.dock-topbar__actions {
    display: flex;
    gap: 2px;
    align-items: center;
}
.dock-topbar__btn {
    width: 26px; height: 26px;
    border: 0;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.dock-topbar__btn:hover { background: #14161d; color: #D4AF37; }

/* Status dot (used in topbar, and as a fallback indicator) */
.avatar-status {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #4b5563;
    box-shadow: 0 0 0 2px rgba(0,0,0,.35);
    transition: background .2s, box-shadow .2s;
    flex: 0 0 auto;
}
.avatar-status[data-state="connected"] {
    background: #4ade80;
    box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 0 10px rgba(74,222,128,.5);
}
.avatar-status[data-state="error"]     { background: #f87171; }
.avatar-status[data-state="busy"]      { background: #D4AF37; }

/* --- Tool indicator ---------------------------------------------- */
.tool-indicator {
    background: #161a22;
    border: 1px solid #1c1f26;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: #c8b88e;
    display: none;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.tool-indicator.visible { display: flex; }
.tool-spinner {
    width: 12px; height: 12px;
    border: 2px solid #333;
    border-top-color: #D4AF37;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Transcript --------------------------------------------------- */
.transcript {
    background: transparent;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 2px;
    scrollbar-width: thin;
    scrollbar-color: #2a2f3a transparent;
    position: relative;      /* anchor for the centered intro overlay */
}
.transcript::-webkit-scrollbar { width: 6px; }
.transcript::-webkit-scrollbar-thumb { background: #2a2f3a; border-radius: 3px; }
.transcript::-webkit-scrollbar-track { background: transparent; }

.transcript-entry {
    font-size: 13.5px;
    line-height: 1.5;
    padding: 9px 13px;
    border-radius: 10px;
    max-width: 85%;
    box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.18);
    animation: msgFadeIn .18s ease-out;
}
.transcript-entry.user {
    background: linear-gradient(180deg, #2a2140 0%, #1f1a33 100%);
    color: #d7cef7;
    align-self: flex-end;
    border: 1px solid rgba(124, 58, 237, .2);
}
.transcript-entry.agent {
    background: linear-gradient(180deg, #141b27 0%, #0f1520 100%);
    color: #c9d8ee;
    align-self: flex-start;
    border: 1px solid rgba(212, 175, 55, .08);
}
.transcript-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2px;
    opacity: 0.5;
}
@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Intro welcome ------------------------------------------------ */
/* Absolutely positioned inside the transcript area so it sits
   centered between the avatar and the input bar. Fades out on
   first message. */
.dock-intro {
    position: absolute;
    top: 50%;
    left: 8px;
    right: 8px;
    transform: translateY(-50%);
    padding: 18px 20px;
    border: 1px solid rgba(212, 175, 55, .22);
    border-radius: 12px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(212,175,55,.08) 0%, transparent 70%),
        linear-gradient(180deg, rgba(24,26,34,.92) 0%, rgba(14,16,22,.92) 100%);
    box-shadow:
        0 0 0 1px rgba(212,175,55,.05),
        0 1px 2px rgba(0,0,0,.4),
        0 8px 24px rgba(0,0,0,.35),
        0 0 28px rgba(212,175,55,.12);
    text-align: center;
    transition: opacity .3s ease, transform .3s ease;
    backdrop-filter: blur(2px);
    pointer-events: none;
}
.dock-intro__hello {
    margin: 0 0 8px;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 17px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #D4AF37;
}
.dock-intro__body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.55;
    color: #b6bcc7;
}
.dock-intro.is-hidden {
    opacity: 0;
    transform: translateY(calc(-50% - 6px));
    display: none;
}

/* --- Input bar (always shows text + mic + send) ------------------- */
.input-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #14161d;
    border: 1px solid #1c1f26;
    border-radius: 999px;
    padding: 4px 4px 4px 14px;
    transition: border-color .2s;
}
.input-bar:focus-within { border-color: #D4AF37; }

.input-bar input[type="text"] {
    flex: 1 1 auto;
    background: transparent;
    border: 0;
    color: #d9d9d5;
    font: inherit;
    font-size: 14px;
    padding: 10px 0;
    outline: none;
    min-width: 0;
}
.input-bar input[type="text"]::placeholder { color: #6b7280; }

/* Mic button — the PRIMARY action. Bright gold, stands out. */
.mic-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 0;
    background: #D4AF37;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .25s ease;
    position: relative;
    flex: 0 0 auto;
    box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 0 12px rgba(212,175,55,.18);
}
.mic-btn:hover {
    background: #e3c24a;
    box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 0 18px rgba(212,175,55,.3);
}
.mic-btn.active {
    background: #f0d15a;
    box-shadow:
        0 0 0 4px rgba(212,175,55,.18),
        0 0 22px rgba(212,175,55,.45);
}
.mic-btn .pulse { display: none; }
.mic-btn.active .pulse {
    position: absolute; inset: -2px;
    border-radius: 50%;
    border: 2px solid #D4AF37;
    animation: pulse 2s ease-out infinite;
    display: block !important;
}
@keyframes pulse {
    0%   { transform: scale(1);   opacity: 0.55; }
    100% { transform: scale(1.5); opacity: 0; }
}
.mic-icon { width: 18px; height: 18px; fill: #0b0d12; transition: fill .25s ease; }
.mic-btn.active .mic-icon { fill: #0b0d12; }

/* Send button — SECONDARY action. Subtle dark treatment. */
.send-btn {
    flex: 0 0 auto;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid #2a2f3a;
    background: #0f1218;
    color: #8b8f99;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.send-btn:hover   {
    background: #1a1d27;
    color: #c8b88e;
    border-color: #3a3f4a;
}
.send-btn:active  { transform: scale(0.96); }
.send-btn svg     { fill: currentColor; }

/* --- Flash overlay for CTAs -------------------------------------- */
.dock-flash {
    position: absolute;
    bottom: 88px;
    left: 14px; right: 14px;
    padding: 10px 12px;
    background: #14161d;
    border: 1px solid #D4AF37;
    border-radius: 8px;
    font-size: 12px;
    color: #D4AF37;
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
    z-index: 2;
    text-align: center;
}
.dock-flash.visible { opacity: 1; }

/* --- Floating mic puck (minimized state) ------------------------- */
.dock-mini-mic {
    display: none;
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 0;
    background: #D4AF37;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 6px 18px rgba(0,0,0,.4), 0 0 18px rgba(212,175,55,.25);
    transition: background .25s, box-shadow .25s, transform .1s;
}
.dock-mini-mic:hover {
    background: #e3c24a;
    box-shadow: 0 6px 20px rgba(0,0,0,.45), 0 0 26px rgba(212,175,55,.4);
}
.dock-mini-mic:active { transform: scale(0.97); }
.dock-mini-mic .mic-icon {
    width: 26px; height: 26px;
    fill: #0b0d12;
}
.concierge-dock[data-display="minimized"][data-mic="active"] .dock-mini-mic {
    background: #f0d15a;
    box-shadow: 0 6px 20px rgba(0,0,0,.45), 0 0 32px rgba(212,175,55,.55);
}
.dock-mini-mic .pulse { display: none; }
.concierge-dock[data-display="minimized"][data-mic="active"] .dock-mini-mic .pulse {
    display: block;
    position: absolute; inset: -2px;
    border-radius: 50%;
    border: 2px solid #D4AF37;
    animation: pulse 2s ease-out infinite;
}

/* --- Compact hover menu (restored + minimized) ------------------- */
.dock-compact-menu {
    position: absolute;
    display: none;
    gap: 2px;
    background: rgba(11,13,18,.92);
    border: 1px solid #1c1f26;
    border-radius: 8px;
    padding: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    backdrop-filter: blur(6px);
    z-index: 3;
    white-space: nowrap;
}

/* Restored — menu floats INSIDE the dock at the top-right, over the
   transparent upper portion of the canvas. Stays inside the hover
   region so the cursor never leaves the dock on the way to it. */
.concierge-dock[data-display="restored"] .dock-compact-menu {
    display: flex;
    top: 8px;
    right: 8px;
    transform: translateY(-4px);
}

/* Minimized — menu sits directly above the puck. Uses a negative
   offset so it overlaps the puck by 2px, leaving no cursor gap. */
.concierge-dock[data-display="minimized"] .dock-compact-menu {
    display: flex;
    bottom: calc(100% - 2px);
    right: 0;
    transform: translateY(4px);
}

.concierge-dock[data-display="restored"]:hover .dock-compact-menu,
.concierge-dock[data-display="minimized"]:hover .dock-compact-menu,
.concierge-dock[data-display="restored"]:focus-within .dock-compact-menu,
.concierge-dock[data-display="minimized"]:focus-within .dock-compact-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.dock-menu-btn {
    width: 26px; height: 26px;
    border: 0;
    background: transparent;
    color: #8b8f99;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.dock-menu-btn:hover { background: #14161d; color: #D4AF37; }

/* Hide the compact-menu button that matches the current display */
.concierge-dock[data-display="restored"]  [data-display-target="restored"],
.concierge-dock[data-display="minimized"] [data-display-target="minimized"],
.concierge-dock[data-display="maximized"] .dock-compact-menu [data-display-target="maximized"] {
    display: none;
}

/* --- Mobile ------------------------------------------------------- */
@media (max-width: 767px) {
    .concierge-dock {
        top: auto;
        bottom: 16px; right: 16px; left: auto;
        width: 56px; height: 56px;
        border-radius: 28px;
        border: 1px solid #D4AF37;
        overflow: hidden;
        transition: width .3s ease, height .3s ease, bottom .3s ease, right .3s ease, border-radius .3s ease;
    }
    .concierge-dock[data-state="collapsed"] { transform: none; }
    .concierge-dock[data-state="mobile-expanded"] {
        width: calc(100vw - 16px);
        height: 72vh;
        right: 8px; bottom: 8px;
        border-radius: 12px;
    }
    .concierge-dock:not([data-state="mobile-expanded"]) #concierge-root { display: none; }
    .concierge-dock__tab {
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        transform: none;
        border: 0;
        border-radius: 28px;
        background: transparent;
    }
    .concierge-dock[data-state="mobile-expanded"] .concierge-dock__tab { display: none; }
    .concierge-dock__tab-label { writing-mode: horizontal-tb; transform: none; font-size: 11px; }
    .avatar-panel { height: 220px; }
}
