/* ═══════════════════════════════════════
   현대유비스병원 유비스AI 챗봇 — 스타일시트
   설치 버전 (홈페이지 연동용)
   ═══════════════════════════════════════ */

/* ── 디자인 토큰 ─────────────────────────────── */
:root {
    --brand:        #0057A8;
    --brand-dark:   #003E7E;
    --brand-light:  #E8F1FB;
    --brand-mid:    #4A90D9;
    --accent:       #00B388;
    --accent-dark:  #00906E;
    --warn:         #F05252;
    --bg:           #F4F7FB;
    --surface:      #FFFFFF;
    --border:       #E2E8F0;
    --text-h:       #0F1923;
    --text-b:       #374151;
    --text-m:       #6B7280;
    --text-inv:     #FFFFFF;
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 22px;
    --r-xl: 28px;
    --sh-sm: 0 2px 8px rgba(0,0,0,.07);
    --sh-md: 0 8px 24px rgba(0,0,0,.11);
    --sh-lg: 0 20px 48px rgba(0,87,168,.18);
    --sh-fab:0 8px 28px rgba(0,87,168,.35);
    --font: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ════════════════════════════════════════
   런처 FAB (오른쪽 하단 챗봇 버튼)
════════════════════════════════════════ */
.launcher-area {
    position: fixed;
    bottom: 32px;
    right: 36px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 900;
}
.launcher-bubble {
    background: #fff;
    color: var(--brand);
    font-size: 13px;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 50px;
    box-shadow: var(--sh-md);
    white-space: nowrap;
    animation: bubblePop .4s cubic-bezier(.34,1.56,.64,1) both;
    position: relative;
}
.launcher-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 26px;
    border-width: 8px 7px 0;
    border-style: solid;
    border-color: #fff transparent transparent;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.06));
}
@keyframes bubblePop {
    from { opacity: 0; transform: scale(.7) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.launcher-btn {
    width: 60px; height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    font-size: 22px;
    display: grid;
    place-items: center;
    box-shadow: var(--sh-fab);
    position: relative;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
    cursor: pointer;
}
.launcher-btn:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 14px 36px rgba(0,87,168,.45);
}
.launcher-btn:active { transform: scale(.97); }
.launcher-ping {
    position: absolute;
    top: 0; right: 0;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #F05252;
    border: 2px solid #fff;
    animation: ping 2s cubic-bezier(0,.2,.8,1) infinite;
}
@keyframes ping {
    0%   { box-shadow: 0 0 0 0 rgba(240,82,82,.6); }
    70%  { box-shadow: 0 0 0 10px rgba(240,82,82,0); }
    100% { box-shadow: 0 0 0 0 rgba(240,82,82,0); }
}

/* ════════════════════════════════════════
   챗봇 윈도우
════════════════════════════════════════ */
.cb-window {
    position: fixed;
    bottom: 108px;
    right: 36px;
    width: 390px;
    height: 640px;
    background: var(--bg);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    transform-origin: bottom right;
    transition: opacity .35s cubic-bezier(.4,0,.2,1),
                transform .35s cubic-bezier(.34,1.56,.64,1);
    border: 1px solid rgba(255,255,255,.7);
    font-family: var(--font);
}
.cb-window.hidden {
    opacity: 0;
    transform: scale(.55) translateY(40px);
    pointer-events: none;
}
.cb-window *, .cb-window *::before, .cb-window *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
.cb-window button { font-family: var(--font); cursor: pointer; }
.cb-window a { text-decoration: none; color: inherit; }

/* ── 헤더 ── */
.cb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    flex-shrink: 0;
}
.cb-header-left { display: flex; align-items: center; gap: 12px; }
.cb-bot-avatar {
    width: 42px; height: 42px;
    background: rgba(255,255,255,.18);
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 20px;
    color: #fff;
    position: relative;
    flex-shrink: 0;
}
.cb-online-dot {
    position: absolute;
    bottom: 2px; right: 2px;
    width: 10px; height: 10px;
    background: #4ADE80;
    border-radius: 50%;
    border: 2px solid var(--brand-dark);
    box-shadow: 0 0 6px #4ADE80;
}
.cb-header-info strong {
    display: block;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.3px;
}
.cb-header-info span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: rgba(255,255,255,.75);
    margin-top: 2px;
}
.cb-header-actions { display: flex; gap: 6px; }
.cb-hdr-btn {
    width: 34px; height: 34px;
    border-radius: 10px;
    border: none;
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.85);
    font-size: 14px;
    display: grid;
    place-items: center;
    transition: background .2s;
}
.cb-hdr-btn:hover { background: rgba(255,255,255,.25); color: #fff; }

/* ── 알림 배너 ── */
.cb-notice-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: #FEF3C7;
    font-size: 12px;
    color: #92400E;
    font-weight: 500;
    flex-shrink: 0;
    border-bottom: 1px solid #FDE68A;
}
.cb-notice-bar i { color: #D97706; }

/* ── 메시지 영역 ── */
.cb-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}
.cb-body::-webkit-scrollbar { width: 5px; }
.cb-body::-webkit-scrollbar-track { background: transparent; }
.cb-body::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }

/* ── 메시지 래퍼 ── */
.cb-msg {
    display: flex;
    gap: 10px;
    max-width: 92%;
    animation: msgIn .3s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cb-msg-bot  { align-self: flex-start; }
.cb-msg-user { align-self: flex-end; flex-direction: row-reverse; }

/* 아바타 */
.cb-avatar {
    width: 32px; height: 32px;
    border-radius: 10px;
    background: var(--brand-light);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* 버블 */
.cb-bubble {
    background: var(--surface);
    color: var(--text-b);
    padding: 13px 16px;
    border-radius: var(--r-md);
    border-top-left-radius: 4px;
    font-size: 14px;
    line-height: 1.65;
    box-shadow: var(--sh-sm);
    word-break: keep-all;
    word-wrap: break-word;
    border: 1px solid var(--border);
}
.cb-bubble p { margin-bottom: 8px; }
.cb-bubble p:last-child { margin-bottom: 0; }
.cb-bubble strong { color: var(--brand); }
.cb-msg-user .cb-bubble {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    border: none;
    border-top-right-radius: 4px;
    border-top-left-radius: var(--r-md);
    box-shadow: 0 4px 14px rgba(0,87,168,.25);
}
.cb-msg-user .cb-bubble strong { color: rgba(255,255,255,.9); }
.cb-timestamp {
    font-size: 11px;
    color: var(--text-m);
    text-align: center;
    margin: 4px 0;
    opacity: .7;
}

/* ── 타이핑 인디케이터 ── */
.cb-typing { display: flex; gap: 5px; padding: 4px 2px; align-items: center; }
.cb-typing span {
    width: 8px; height: 8px;
    background: #94A3B8;
    border-radius: 50%;
    animation: dot 1.4s ease-in-out infinite;
}
.cb-typing span:nth-child(2) { animation-delay: .2s; }
.cb-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes dot {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30%            { transform: translateY(-6px); opacity: 1; }
}

/* ── 카드형 답변 ── */
.cb-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--sh-sm);
    margin-top: 8px;
    width: 100%;
}
.cb-card-head {
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 700;
    font-size: 13px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.cb-card-body {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-m);
    line-height: 1.65;
}
.cb-card-body strong { color: var(--text-b); }
.cb-card-actions { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.cb-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 13px 16px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand);
    cursor: pointer;
    transition: background .2s;
    border-bottom: 1px solid var(--border);
}
.cb-card-btn:last-child { border-bottom: none; }
.cb-card-btn:hover { background: var(--brand-light); }
.cb-card-btn.primary { background: var(--accent); color: #fff; font-weight: 700; }
.cb-card-btn.primary:hover { background: var(--accent-dark); }

/* ── 진료과 목록 ── */
.cb-dept-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; width: 100%; }
.cb-dept-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    cursor: pointer;
    transition: all .2s;
    text-align: left;
    width: 100%;
}
.cb-dept-item:hover { border-color: var(--brand); background: var(--brand-light); transform: translateX(3px); }
.cb-dept-icon {
    width: 36px; height: 36px;
    background: var(--brand-light);
    color: var(--brand);
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 16px;
    flex-shrink: 0;
}
.cb-dept-info strong { display: block; font-size: 13px; font-weight: 700; color: var(--text-h); margin-bottom: 2px; }
.cb-dept-info span { font-size: 12px; color: var(--text-m); }
.cb-dept-arrow { margin-left: auto; color: var(--text-m); font-size: 12px; transition: transform .2s; }
.cb-dept-item:hover .cb-dept-arrow { transform: translateX(3px); color: var(--brand); }

/* ── 검진 프로그램 카드 ── */
.cb-plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; width: 100%; }
.cb-plan-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 14px 12px;
    cursor: pointer;
    transition: all .2s;
    text-align: center;
}
.cb-plan-card:hover { border-color: var(--brand); box-shadow: 0 4px 16px rgba(0,87,168,.12); transform: translateY(-2px); }
.cb-plan-card .icon { font-size: 22px; margin-bottom: 8px; }
.cb-plan-card strong { display: block; font-size: 12px; font-weight: 700; color: var(--text-h); margin-bottom: 4px; }
.cb-plan-card span { font-size: 11px; color: var(--text-m); }

/* ── 인라인 버튼 그룹 ── */
.cb-btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; width: 100%; }
.cb-inline-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 50px;
    border: 1.5px solid var(--brand);
    background: transparent;
    color: var(--brand);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.cb-inline-btn:hover { background: var(--brand); color: #fff; transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,87,168,.2); }
.cb-inline-btn.accent { border-color: var(--accent); background: var(--accent); color: #fff; }
.cb-inline-btn.accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

/* ── 인포 박스 ── */
.cb-info-box {
    background: var(--brand-light);
    border-left: 3px solid var(--brand);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    padding: 12px 14px;
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-b);
    width: 100%;
}
.cb-info-box strong { color: var(--brand); }
.cb-wide { max-width: 100% !important; }
.cb-wide .cb-bubble { border-radius: var(--r-md) !important; }

/* ════════════════════════════════════════
   예약 플로우 컴포넌트
════════════════════════════════════════ */
.bk-doctor-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; width: 100%; }
.bk-doctor-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px;
    cursor: pointer;
    transition: all .2s;
    text-align: left;
    width: 100%;
}
.bk-doctor-card:hover { border-color: var(--brand); box-shadow: 0 4px 16px rgba(0,87,168,.12); transform: translateX(3px); }
.bk-doc-avatar { width: 46px; height: 46px; border-radius: 14px; font-size: 20px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }
.bk-doc-info { flex: 1; min-width: 0; }
.bk-doc-info strong { display: block; font-size: 14px; font-weight: 700; color: var(--text-h); margin-bottom: 2px; }
.bk-doc-title { font-size: 12px; font-weight: 500; color: var(--brand); background: var(--brand-light); padding: 1px 7px; border-radius: 20px; margin-left: 5px; }
.bk-doc-spec { display: block; font-size: 12px; color: var(--text-m); margin-bottom: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-day-row { display: flex; gap: 4px; flex-wrap: wrap; }
.bk-day { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 20px; background: var(--bg); color: var(--text-m); border: 1px solid var(--border); }
.bk-day.on { background: var(--brand-light); color: var(--brand); border-color: var(--brand-light); }
.bk-arrow { color: var(--text-m); font-size: 12px; flex-shrink: 0; transition: transform .2s, color .2s; }
.bk-doctor-card:hover .bk-arrow { transform: translateX(3px); color: var(--brand); }

/* ── 예약 확인서 ── */
.bk-confirm-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin-top: 10px; box-shadow: var(--sh-sm); width: 100%; }
.bk-confirm-head { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); color: #fff; font-weight: 700; font-size: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 8px; }
.bk-confirm-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.bk-confirm-row { display: flex; align-items: flex-start; gap: 10px; }
.bk-confirm-label { font-size: 12px; color: var(--text-m); font-weight: 600; width: 68px; flex-shrink: 0; padding-top: 2px; }
.bk-confirm-val { font-size: 13px; color: var(--text-h); font-weight: 600; flex: 1; }
.bk-confirm-val small { display: block; font-size: 11px; color: var(--text-m); font-weight: 400; margin-top: 2px; }
.bk-confirm-notice { background: #FEF3C7; border-top: 1px solid #FDE68A; padding: 10px 16px; font-size: 12px; color: #92400E; display: flex; align-items: flex-start; gap: 7px; }
.bk-confirm-notice i { color: #D97706; margin-top: 1px; flex-shrink: 0; }
.bk-confirm-actions { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.bk-confirm-btn { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 14px; border: none; background: transparent; font-size: 14px; font-weight: 700; color: var(--text-m); cursor: pointer; transition: background .2s; border-bottom: 1px solid var(--border); }
.bk-confirm-btn:last-child { border-bottom: none; }
.bk-confirm-btn:hover { background: var(--bg); }
.bk-confirm-btn.primary { background: var(--accent); color: #fff; font-size: 15px; }
.bk-confirm-btn.primary:hover { background: var(--accent-dark); }
.bk-confirm-btn.secondary { color: var(--accent); font-weight: 600; }
.bk-confirm-btn.secondary:hover { background: #EFF6FF; }

/* ════════════════════════════════════════
   푸터 / 입력
════════════════════════════════════════ */
.cb-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 12px 14px 10px; flex-shrink: 0; }
.cb-quick-bar { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; -ms-overflow-style: none; }
.cb-quick-bar::-webkit-scrollbar { display: none; }
.cb-quick-chip { display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; border-radius: 50px; border: 1.5px solid var(--border); background: var(--bg); color: var(--text-b); font-size: 12px; font-weight: 600; white-space: nowrap; flex-shrink: 0; transition: all .2s; cursor: pointer; }
.cb-quick-chip i { color: var(--brand); font-size: 11px; }
.cb-quick-chip:hover { border-color: var(--brand); background: var(--brand-light); color: var(--brand); transform: translateY(-1px); }
.cb-input-row { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 50px; padding: 4px 4px 4px 16px; transition: border-color .2s, box-shadow .2s; }
.cb-input-row:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,87,168,.1); }
.cb-input { flex: 1; border: none; background: transparent; font-family: var(--font); font-size: 14px; color: var(--text-b); outline: none; padding: 8px 0; min-width: 0; }
.cb-input::placeholder { color: #9CA3AF; }
.cb-send-btn { width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--brand); color: #fff; font-size: 14px; display: grid; place-items: center; transition: all .2s; flex-shrink: 0; cursor: pointer; }
.cb-send-btn:hover { background: var(--brand-dark); transform: scale(1.07); }
.cb-send-btn:active { transform: scale(.95); }
.cb-footer-note { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 11px; color: #9CA3AF; margin-top: 8px; }
.cb-footer-note i { font-size: 10px; }

/* ════════════════════════════════════════
   모바일 반응형
════════════════════════════════════════ */
@media (max-width: 480px) {
    .launcher-area { bottom: 20px; right: 20px; }
    .launcher-bubble { font-size: 12px; padding: 8px 14px; }
    .cb-window { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; transform-origin: bottom center; }
    .cb-window.hidden { transform: scale(.9) translateY(60px); }
    .cb-header { padding: 16px; }
    .cb-body { padding: 16px 12px; gap: 14px; }
    .cb-bubble { font-size: 13.5px; padding: 12px 14px; }
    .cb-plan-grid { grid-template-columns: 1fr 1fr; }
    .bk-doc-spec { white-space: normal; }
    .cb-btn-row { flex-direction: column; }
    .cb-inline-btn { justify-content: center; }
    .cb-footer { padding: 10px 12px 8px; }
    .cb-input { font-size: 15px; }
}
@media (min-width: 481px) and (max-width: 768px) {
    .cb-window { width: calc(100vw - 32px); right: 16px; bottom: 96px; }
    .launcher-area { right: 20px; bottom: 24px; }
}
