/* ============================================
   YouJue's Office — 「午夜樓層圖」場景
   設計來源：design_handoff_midnight_floor（高保真，按值重現）
   命名空間規範沿用 YJ-02 §14：.desk-* / .voice-* / .login-* / .floor-*
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --office-bg-1: #0c1120;
    --office-bg-2: #141c33;
    --office-bg-3: #1c2640;
    --office-card: rgba(255, 255, 255, 0.06);
    --office-card-border: rgba(255, 255, 255, 0.10);
    --office-text: #eef1f8;
    --office-text-dim: #9aa3b8;
    --office-warm: #f5b971;
    --office-green: #34d399;
    --office-red: #f87171;
}

html, body { height: 100%; }

body {
    font-family: "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", -apple-system, sans-serif;
    background: linear-gradient(180deg, var(--office-bg-1) 0%, var(--office-bg-2) 60%, var(--office-bg-3) 100%);
    color: var(--office-text);
    min-height: 100vh;
}

/* ============ 進入碼登入閘 ============ */

.login-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: linear-gradient(180deg, var(--office-bg-1), var(--office-bg-2));
    display: flex; align-items: center; justify-content: center; padding: 24px;
}

.login-card {
    width: 100%; max-width: 370px; text-align: center;
    background: var(--office-card);
    border: 1px solid var(--office-card-border);
    border-radius: 22px; padding: 42px 32px;
    backdrop-filter: blur(8px);
}

.login-logo {
    font-size: 29px; font-weight: 900; letter-spacing: 0.5px;
    background: linear-gradient(135deg, #ffd9a0, var(--office-warm));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.login-sub { color: var(--office-text-dim); font-size: 13px; margin: 8px 0 28px; }

.login-card input {
    width: 100%; padding: 13px 16px; font-size: 15px;
    border-radius: 12px; border: 1px solid var(--office-card-border);
    background: rgba(0, 0, 0, 0.25); color: var(--office-text);
    outline: none; text-align: center; letter-spacing: 2px;
}
.login-card input:focus { border-color: var(--office-warm); }

.login-btn {
    width: 100%; margin-top: 14px; padding: 13px 0; font-size: 15px; font-weight: 700;
    border: none; border-radius: 12px; cursor: pointer;
    background: linear-gradient(135deg, #f7c98b, #e8985a); color: #3a2410;
    transition: filter 0.15s ease;
}
.login-btn:hover { filter: brightness(1.08); }
.login-btn:disabled { opacity: 0.6; cursor: wait; }

.login-error { color: var(--office-red); font-size: 13px; margin-top: 12px; }

/* ============ 主場景 ============ */

.office-page {
    max-width: 1120px; margin: 0 auto; padding: 30px 24px 44px;
    position: relative;
}

.office-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 16px; flex-wrap: wrap;
    position: relative; z-index: 3;
}

.office-title {
    font-size: 34px; font-weight: 900; letter-spacing: 0.5px;
    background: linear-gradient(135deg, #ffe2b8, var(--office-warm));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.office-subtitle { color: var(--office-text-dim); font-size: 14px; margin-top: 4px; }

.office-header-right { text-align: right; }

.office-clock {
    font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums;
    color: var(--office-text);
}

.office-online {
    color: var(--office-text-dim); font-size: 13px; margin-top: 2px;
    display: flex; align-items: center; gap: 6px; justify-content: flex-end;
}

.online-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--office-green);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
}

/* ============ 落地窗夜景（含吊燈） ============ */

.office-window {
    position: relative; height: 130px; border-radius: 16px; overflow: hidden;
    background: linear-gradient(180deg, #070c18 0%, #101830 100%);
    border: 1px solid var(--office-card-border);
    margin-top: 22px;
}

.window-moon {
    position: absolute; top: 16px; right: 60px;
    width: 32px; height: 32px; border-radius: 50%;
    background: #fdf3d8; box-shadow: 0 0 26px rgba(253, 243, 216, 0.5);
}

.window-skyline {
    position: absolute; inset: 0;
    display: flex; align-items: flex-end; gap: 9px; padding: 0 18px;
}

.window-skyline i {
    flex: 1; display: block;
    border-radius: 3px 3px 0 0;
    background:
        repeating-linear-gradient(0deg,
            rgba(245, 185, 113, 0.32) 0 3px,
            transparent 3px 11px),
        #1f2c50;
}
.window-skyline i:nth-child(1) { height: 52%; }
.window-skyline i:nth-child(2) { height: 80%; }
.window-skyline i:nth-child(3) { height: 42%; }
.window-skyline i:nth-child(4) { height: 68%; }
.window-skyline i:nth-child(5) { height: 90%; }
.window-skyline i:nth-child(6) { height: 50%; }
.window-skyline i:nth-child(7) { height: 72%; }
.window-skyline i:nth-child(8) { height: 38%; }
.window-skyline i:nth-child(9) { height: 62%; }

.window-frame {
    position: absolute; inset: 0; display: flex; pointer-events: none;
}
.window-frame i {
    flex: 1; border-right: 3px solid rgba(8, 12, 22, 0.85);
}
.window-frame i:last-child { border-right: none; }

/* 吊燈（掛在窗框內，像辦公室天花板垂下） */
.office-lamps {
    position: absolute; inset: 0;
    display: flex; justify-content: space-around;
    pointer-events: none;
}
.office-lamps i {
    display: block; width: 16px; position: relative;
}
.office-lamps i::before {
    content: ""; position: absolute; left: 50%; top: 0; transform: translateX(-50%);
    width: 2px; height: 20px; background: rgba(255, 255, 255, 0.22);
}
.office-lamps i::after {
    content: ""; position: absolute; left: 50%; top: 20px; transform: translateX(-50%);
    width: 18px; height: 12px;
    background: #c9a96a; border-radius: 3px 3px 9px 9px;
    box-shadow: 0 10px 22px 4px rgba(245, 185, 113, 0.45);
}

/* ============ 服務暫停提示 ============ */

.voice-disabled-banner {
    background: rgba(245, 185, 113, 0.12);
    border: 1px solid rgba(245, 185, 113, 0.35);
    color: #f3cfa0; font-size: 13px;
    border-radius: 12px; padding: 10px 16px; margin-top: 18px;
    position: relative; z-index: 3;
}

/* ============ 木地板樓層 ============ */

.office-floor {
    margin-top: 24px; border-radius: 24px; position: relative;
    padding: 36px 32px 30px;
    background:
        repeating-linear-gradient(90deg, transparent 0 88px, rgba(0, 0, 0, 0.10) 88px 91px),
        linear-gradient(180deg, #5b452f 0%, #4a3826 100%);
    box-shadow: inset 0 2px 18px rgba(0, 0, 0, 0.45);
}

.floor-carpet {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 72%; height: 64%; border-radius: 28px;
    background: rgba(20, 28, 51, 0.55);
    border: 2px dashed rgba(245, 185, 113, 0.18);
    pointer-events: none;
}

.floor-plant {
    position: absolute; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #3f9d6b, #1d5c3a 70%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}
.plant-a { left: 16px; top: 14px; width: 40px; height: 40px; }
.plant-b { right: 16px; bottom: 14px; width: 46px; height: 46px; }

.floor-entrance {
    margin: 22px auto 0; width: max-content;
    font-size: 11px; letter-spacing: 4px; color: rgba(255, 255, 255, 0.45);
    border-top: 2px solid rgba(245, 185, 113, 0.35);
    padding: 6px 26px 0;
    position: relative;
}

/* ============ 桌位格（auto-fit 自動 3→2→1 欄） ============ */

.desk-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 24px; position: relative;
}

/* ============ 俯視桌位卡 ============ */

.desk-card {
    display: flex; flex-direction: column; align-items: center;
    padding: 20px 14px 18px; border-radius: 18px; cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}
.desk-card:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-4px);
}
.desk-card.desk-disabled { cursor: not-allowed; }
.desk-card.desk-disabled:hover { background: none; transform: none; }

/* 俯視桌面 + CSS 桌面小物（筆電 / 咖啡 / 文件） */
.desk-top {
    width: 160px; height: 60px; border-radius: 12px;
    background: linear-gradient(180deg, #8a6748, #6e5037);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
    position: relative;
}
.desk-laptop {
    position: absolute; left: 14px; top: 12px;
    width: 46px; height: 34px; border-radius: 5px;
    background: #11182c; border: 2px solid #2a3450;
    box-shadow: 0 0 12px rgba(120, 160, 255, 0.35);
}
.desk-laptop-screen {
    position: absolute; left: 23px; top: 20px;
    width: 28px; height: 17px; border-radius: 2px;
    background: linear-gradient(135deg, #3a5a9e, #6fa0e8);
}
.desk-coffee {
    position: absolute; right: 18px; top: 17px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #e8e2d4; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.desk-doc {
    position: absolute; right: 40px; top: 14px;
    width: 27px; height: 19px; border-radius: 2px;
    background: rgba(255, 255, 255, 0.75);
}

/* 座位：椅背 + 頭像（主題色邊框）+ 在線點 */
.desk-seat { position: relative; margin-top: -16px; width: 74px; height: 74px; }

.desk-chairback {
    position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
    width: 58px; height: 31px; border-radius: 0 0 29px 29px;
    background: #232c45;
    border: 2px solid rgba(255, 255, 255, 0.10); border-top: none;
}

.desk-avatar {
    position: absolute; left: 50%; top: 0; transform: translateX(-50%);
    width: 64px; height: 64px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700; color: #fff;
    border: 3px solid rgba(255, 255, 255, 0.25);  /* 主題色由 JS 以 borderColor 覆寫 */
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* 頭像照片蓋在字母占位上；載入失敗 onerror 移除即露出字母 */
.desk-avatar-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; border-radius: 50%;
}

.desk-online-dot {
    position: absolute; right: -1px; top: 2px;
    width: 13px; height: 13px; border-radius: 50%;
    background: var(--office-green);
    border: 2px solid #0c1120;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.9);
}

/* 名牌 pill：名字白 + 職稱主題色 */
.desk-nameplate {
    margin-top: 11px; display: flex; align-items: center; gap: 7px;
    background: rgba(12, 17, 32, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px; padding: 6px 15px;
}
.desk-nameplate .desk-name { font-size: 14.5px; font-weight: 700; color: var(--office-text); }
.desk-nameplate .desk-title { font-size: 12px; font-weight: 600; }  /* color 由 JS 帶主題色 */

.desk-tagline {
    font-size: 12px; color: var(--office-text-dim); margin-top: 8px;
    text-align: center; line-height: 1.6; min-height: 38px; max-width: 210px;
}

/* 分機通話 pill */
.desk-call-pill {
    margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 700; color: #06281a;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    border: none; border-radius: 999px; padding: 8px 16px;
    cursor: pointer; transition: filter 0.15s ease;
    font-family: inherit;
}
.desk-call-pill:hover { filter: brightness(1.1); }
.desk-call-pill:disabled {
    background: rgba(255, 255, 255, 0.12); color: var(--office-text-dim);
    cursor: not-allowed; filter: none;
}

.office-footer {
    margin-top: 30px; text-align: center;
    color: rgba(154, 163, 184, 0.55); font-size: 12px;
    position: relative; z-index: 3;
}

/* ============ 通話 modal（DOM id 全保留，只改皮） ============ */

.voice-overlay {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(8, 11, 22, 0.78);
    display: flex; align-items: center; justify-content: center; padding: 20px;
    backdrop-filter: blur(4px);
    overflow-y: auto;  /* 通話中頭像放大後超出視窗高時可捲動到按鈕 */
}

.voice-modal-card {
    width: 100%; max-width: 390px; text-align: center;
    background: linear-gradient(180deg, #1d2540, #161d33);
    border: 1px solid var(--office-card-border);
    border-radius: 22px; padding: 34px 26px 26px;
    margin: auto;  /* 配合 overlay overflow 捲動時維持置中 */
    transition: max-width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.voice-avatar-wrap {
    position: relative; width: 100px; height: 100px; margin: 0 auto;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                height 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.voice-avatar {
    width: 100%; height: 100%; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 700; color: #fff;
    border: 3px solid var(--agent-color, rgba(255, 255, 255, 0.25));
    position: relative; z-index: 2;
}

/* 通話 modal 的照片 / 影片，蓋在字母圓上（z-index 3 > .voice-avatar 的 2） */
.voice-avatar-media {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; border-radius: 50%;
    border: 3px solid var(--agent-color, rgba(255, 255, 255, 0.25));
    box-sizing: border-box;
    z-index: 3;
}

/* ── 通話中頭像影片放大 4 倍（源自 Jennie-SaaS FAB scale(5) 的視覺概念，
   styles.css:2015 fab-video-playing；2026-06-12 使用者回饋 5 倍太大改 4 倍）──
   工程調整：用「實際尺寸」放大而非 transform——transform 不推擠版面，
   大圓會蓋住掛斷鈕；實際放大則按鈕被推到下方、保持可點。
   觸發：鉤在 office-voice.js 既有的 .speaking 狀態（session_started→cleanup），
   用 :has() 純 CSS 達成，office-voice.js 零改動。
   尺寸：min(400px, 62vh, 86vw)——桌機正好 4 倍，小螢幕以視窗封頂。 */
.voice-modal-card:has(.voice-avatar-ring.speaking) {
    max-width: 480px;
}
.voice-modal-card:has(.voice-avatar-ring.speaking) .voice-avatar-wrap {
    width: min(400px, 62vh, 86vw);
    height: min(400px, 62vh, 86vw);
}
.voice-modal-card:has(.voice-avatar-ring.speaking) .voice-avatar-media {
    box-shadow: 0 0 60px rgba(245, 185, 113, 0.35), 0 0 120px rgba(245, 185, 113, 0.18);
}

.voice-avatar-ring {
    position: absolute; inset: -9px; border-radius: 50%;
    border: 2px solid rgba(74, 222, 128, 0.0);
    z-index: 1;
}
.voice-avatar-ring.speaking {
    border-color: rgba(74, 222, 128, 0.6);
    animation: officePulse 1.6s ease-out infinite;
}

@keyframes officePulse {
    0%   { transform: scale(1);   opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

.voice-header h3 { margin-top: 15px; font-size: 21px; font-weight: 700; }

.voice-subtitle {
    color: var(--agent-color, var(--office-text-dim));
    font-size: 13px; font-weight: 600; margin-top: 4px;
}

.voice-status { margin-top: 14px; font-size: 14px; color: var(--office-text-dim); min-height: 20px; }

.voice-timer {
    margin-top: 8px; font-size: 32px; font-weight: 600;
    font-variant-numeric: tabular-nums; letter-spacing: 1px;
}
.voice-timer.office-voice-urgent {
    color: var(--office-red);
    animation: officeUrgent 1s ease infinite;
}
@keyframes officeUrgent {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.voice-error { margin-top: 10px; color: var(--office-red); font-size: 13px; line-height: 1.5; }

.voice-actions {
    display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px;
}

.voice-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 12px 20px; font-size: 14px; font-weight: 600;
    border: none; border-radius: 12px; cursor: pointer;
    transition: filter 0.15s ease;
    font-family: inherit;
}
.voice-btn-primary,
.voice-btn-danger { padding: 12px 22px; font-size: 14.5px; font-weight: 700; }
.voice-btn-primary { background: linear-gradient(135deg, #4ade80, #22c55e); color: #06281a; }
.voice-btn-primary:disabled { background: rgba(255,255,255,0.12); color: var(--office-text-dim); cursor: not-allowed; }
.voice-btn-danger { background: linear-gradient(135deg, #f87171, #ef4444); color: #fff; }
.voice-btn-toggle, .voice-btn-secondary {
    background: rgba(255, 255, 255, 0.10); color: var(--office-text);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.voice-btn-primary:hover, .voice-btn-danger:hover { filter: brightness(1.08); }
.voice-btn-toggle:hover, .voice-btn-secondary:hover { filter: brightness(1.15); }

.voice-hint {
    margin-top: 17px; color: rgba(154, 163, 184, 0.8); font-size: 12px; line-height: 1.6;
}

/* ============ 響應式（欄數交給 auto-fit，其餘 ≤640px 收緊） ============ */

@media (max-width: 640px) {
    .office-page { padding: 20px 14px 30px; }
    .office-title { font-size: 26px; }
    .office-clock { font-size: 20px; }
    .office-window { height: 110px; }
    .office-floor { padding: 24px 16px 20px; }
    .desk-tagline { min-height: 0; }
    .voice-modal-card { max-width: 100%; }
}
