/* ============================================================
   floating-banner.css — 카카오톡 / 전화 / 채팅 / TOP 플로팅 배너
   ============================================================ */

.fb-wrap {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9990;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
    letter-spacing: -0.25px;
    color: #191f28;
    pointer-events: none;
}
.fb-wrap > * { pointer-events: auto; }

/* ===== 버튼 스택 ===== */
.fb-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.fb-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    min-width: 56px;
    padding: 0;
    background: #ffffff;
    color: #191f28;
    border: 0;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(17, 24, 39, 0.14), 0 2px 6px rgba(17, 24, 39, 0.06);
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: -0.3px;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
    white-space: nowrap;
    overflow: hidden;
}
.fb-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(17, 24, 39, 0.18), 0 4px 10px rgba(17, 24, 39, 0.08);
}
.fb-btn:active { transform: translateY(0); }
.fb-btn svg { flex-shrink: 0; margin-left: 16px; }
.fb-btn__label {
    padding: 0 18px 0 10px;
    line-height: 1;
    color: inherit;
}

.fb-btn--kakao { background: #FEE500; color: #191f28; }
.fb-btn--kakao:hover { background: #ffec1a; }
.fb-btn--phone { background: #ffffff; color: #191f28; }
.fb-btn--phone:hover { background: #f9fafb; }
.fb-btn--chat { background: #191f28; color: #ffffff; }
.fb-btn--chat:hover { background: #2a3037; }
.fb-btn--top {
    background: #ffffff;
    color: #4e5968;
    height: 44px;
    min-width: 44px;
    margin-bottom: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .15s ease, box-shadow .15s ease;
}
.fb-btn--top svg { margin: 0; }
.fb-btn--top.is-visible {
    opacity: 1;
    pointer-events: auto;
}
.fb-btn--top:hover { background: #f9fafb; color: #191f28; }

.fb-btn__badge {
    position: absolute;
    top: 6px;
    right: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #E83B4B;
    color: #ffffff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #ffffff;
}

/* ===== 전화 팝오버 ===== */
.fb-popover {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: 280px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(17, 24, 39, 0.16), 0 4px 12px rgba(17, 24, 39, 0.06);
    border: 1px solid #f1f3f5;
    overflow: hidden;
    transform: scale(0.95) translateY(8px);
    opacity: 0;
    pointer-events: none;
    transition: transform .18s ease, opacity .18s ease;
    transform-origin: bottom right;
    z-index: 10;
}
.fb-popover.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.fb-popover--phone {
    bottom: 180px;
}
.fb-popover__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #191f28 0%, #2a3037 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}
.fb-popover__head .fa { margin-right: 6px; }
.fb-popover__close {
    background: transparent;
    border: 0;
    color: #ffffff;
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity .15s ease;
}
.fb-popover__close:hover { opacity: 1; }
.fb-popover__body { padding: 18px 16px 16px; }
.fb-popover__sub {
    font-size: 12px;
    color: #6b7684;
    margin-bottom: 12px;
    text-align: center;
}
.fb-popover__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 52px;
    background: #E83B4B;
    color: #ffffff !important;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.3px;
    text-decoration: none;
    transition: background-color .15s ease, transform .05s ease;
    box-shadow: 0 4px 12px rgba(232, 59, 75, 0.25);
}
.fb-popover__cta:hover { background: #c92e3d; color: #ffffff !important; text-decoration: none; }
.fb-popover__cta:active { transform: translateY(1px); }
.fb-popover__hint {
    font-size: 11.5px;
    color: #8b95a1;
    margin-top: 10px;
    text-align: center;
}

/* ===== 채팅 위젯 ===== */
.fb-chat {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: 360px;
    z-index: 10;
    max-width: calc(100vw - 36px);
    height: 540px;
    max-height: calc(100vh - 100px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.20), 0 6px 16px rgba(17, 24, 39, 0.08);
    border: 1px solid #f1f3f5;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .18s ease;
    transform-origin: bottom right;
}
.fb-chat.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.fb-chat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #3182f6 0%, #1b64da 100%);
    color: #ffffff;
    flex-shrink: 0;
}
.fb-chat__head-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.fb-chat__avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 800;
    font-size: 15px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}
.fb-chat__avatar img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    position: relative;
    z-index: 1;
}
.fb-chat__avatar span {
    position: absolute;
}
.fb-chat__title {
    font-size: 14.5px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}
.fb-chat__sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: rgba(255,255,255,0.85);
    margin-top: 3px;
    font-weight: 500;
}
.fb-chat__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 2px rgba(52,211,153,0.3);
    display: inline-block;
    flex-shrink: 0;
    animation: fbDotPulse 2s infinite;
}
@keyframes fbDotPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(52,211,153,0.3); }
    50% { box-shadow: 0 0 0 5px rgba(52,211,153,0.0); }
}
.fb-chat__close {
    background: transparent;
    border: 0;
    color: #ffffff;
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
    transition: opacity .15s ease;
}
.fb-chat__close:hover { opacity: 1; }

.fb-chat__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 16px 12px;
    background: #f6f8fa;
    display: flex;
    flex-direction: column;
}
.fb-chat__body::-webkit-scrollbar { width: 6px; }
.fb-chat__body::-webkit-scrollbar-thumb { background: #d1d6db; border-radius: 999px; }
.fb-chat__body::-webkit-scrollbar-track { background: transparent; }

.fb-chat__welcome {
    text-align: center;
    padding: 14px 8px 18px;
}
.fb-chat__welcome-icon {
    font-size: 36px;
    margin-bottom: 10px;
    line-height: 1;
}
.fb-chat__welcome-title {
    font-size: 16px;
    font-weight: 800;
    color: #191f28;
    line-height: 1.4;
    margin-bottom: 8px;
    letter-spacing: -0.4px;
}
.fb-chat__welcome-sub {
    font-size: 12.5px;
    color: #6b7684;
    line-height: 1.6;
}

.fb-chat__messages { display: flex; flex-direction: column; gap: 8px; }
.fb-msg {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 80%;
}
.fb-msg--user { align-self: flex-end; align-items: flex-end; }
.fb-msg--admin { align-self: flex-start; align-items: flex-start; }
.fb-msg--system { align-self: center; max-width: 90%; }
.fb-msg__bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 2px rgba(17,24,39,0.04);
}
.fb-msg--user .fb-msg__bubble {
    background: #3182f6;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}
.fb-msg--admin .fb-msg__bubble {
    background: #ffffff;
    color: #191f28;
    border-bottom-left-radius: 4px;
}
.fb-msg--system .fb-msg__bubble {
    background: rgba(17,24,39,0.06);
    color: #4e5968;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 999px;
}
.fb-msg__time {
    font-size: 10.5px;
    color: #8b95a1;
    padding: 0 4px;
}

.fb-chat__guest {
    padding: 14px 16px 18px;
    background: #ffffff;
    border-top: 1px solid #f1f3f5;
    flex-shrink: 0;
}
.fb-chat__guest-label {
    font-size: 12px;
    color: #4e5968;
    font-weight: 600;
    margin-bottom: 10px;
}
.fb-chat__guest input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: #f2f4f6;
    border: 0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #191f28;
    margin-bottom: 8px;
    outline: 0;
    box-shadow: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: background-color .15s ease, box-shadow .15s ease;
}
.fb-chat__guest input::placeholder { color: #b0b8c1; }
.fb-chat__guest input:focus {
    background: #ffffff;
    box-shadow: 0 0 0 2px #3182f6;
}
.fb-chat__guest-btn {
    width: 100%;
    height: 44px;
    background: #191f28;
    color: #ffffff;
    border: 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
    transition: background-color .15s ease;
}
.fb-chat__guest-btn:hover { background: #2a3037; }

.fb-chat__input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #f1f3f5;
    flex-shrink: 0;
}
.fb-chat__input textarea {
    flex: 1;
    min-height: 40px;
    max-height: 100px;
    padding: 10px 14px;
    background: #f2f4f6;
    border: 0;
    border-radius: 20px;
    font-size: 13.5px;
    color: #191f28;
    font-family: inherit;
    resize: none;
    outline: 0;
    box-shadow: none;
    line-height: 1.4;
    transition: background-color .15s ease, box-shadow .15s ease;
}
.fb-chat__input textarea:focus {
    background: #ffffff;
    box-shadow: 0 0 0 2px #3182f6;
}
.fb-chat__input textarea::placeholder { color: #b0b8c1; }
.fb-chat__send {
    width: 40px;
    height: 40px;
    background: #3182f6;
    color: #ffffff;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color .15s ease, transform .05s ease;
}
.fb-chat__send:hover { background: #1b64da; }
.fb-chat__send:active { transform: scale(0.95); }
.fb-chat__send:disabled { background: #d1d6db; cursor: not-allowed; }

/* 모바일 */
@media (max-width: 575px) {
    .fb-wrap { right: 12px; bottom: 12px; }
    .fb-btn { height: 50px; min-width: 50px; font-size: 12.5px; }
    .fb-btn__label { display: none; }
    .fb-btn svg { margin: 0; }
    .fb-btn--top { height: 40px; min-width: 40px; }

    /* 모바일 채팅 — 풀스크린 모달 방식 (.fb-wrap 외부에서 viewport 고정) */
    .fb-chat {
        position: fixed;
        top: 12px;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        height: auto;
        max-height: none;
        border-radius: 16px;
        z-index: 10001;
        transform-origin: center;
        transform: scale(0.96);
    }
    .fb-chat.is-open {
        transform: scale(1);
    }
    /* 채팅 열린 동안 stack 숨김 (시각적 정리) */
    body.fb-chat-open .fb-stack { opacity: 0; pointer-events: none; }

    .fb-popover {
        width: calc(100vw - 24px);
        max-width: 320px;
    }
    .fb-popover--phone { bottom: 160px; }
}

/* TOP 버튼 모바일 */
@media (max-width: 575px) {
    .fb-btn--top { display: flex; }
}

/* ============================================================
   📌 접기/펼치기 토글 (fb-btn--fold) — 스택 최하단 FAB
   - 펼침 상태: 햄버거(☰) 아이콘
   - 접힘 상태: X(✕) 아이콘
   - SVG path stroke 위치/회전을 부드럽게 전환 (모핑 애니메이션)
   ============================================================ */
.fb-btn--fold {
    height: 48px;
    min-width: 48px;
    width: 48px;
    background: #191f28;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.22), 0 2px 6px rgba(17, 24, 39, 0.10);
    margin-top: 4px;
    padding: 0;
    transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
/* .fb-btn svg 의 margin-left: 16px (라벨용 좌측 여백) 무력화 — 아이콘 중앙 정렬 */
.fb-btn--fold svg,
.fb-btn--fold .fb-fold-icon {
    margin: 0 !important;
}
.fb-btn--fold:hover {
    background: #2a3038;
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(17, 24, 39, 0.28), 0 4px 10px rgba(17, 24, 39, 0.14);
}
.fb-btn--fold:active {
    transform: translateY(0) scale(0.96);
}
.fb-fold-icon {
    display: block;
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
    transform-origin: center;
}
/* 펼침 상태(기본): 아래 화살표 ∨ (회전 0°) — '접기' */
.fb-stack:not(.is-collapsed) .fb-fold-icon {
    transform: rotate(0deg);
}
/* 접힘 상태: 위 화살표 ∧ (회전 180°) — '펼치기' */
.fb-stack.is-collapsed .fb-fold-icon {
    transform: rotate(180deg);
}

/* ============================================================
   📌 스택 자식 버튼 — 펼침/접힘 전환 애니메이션 (stagger)
   ============================================================ */
.fb-stack > .fb-btn:not(.fb-btn--fold) {
    transition:
        opacity .22s ease,
        transform .28s cubic-bezier(.34, 1.56, .64, 1),
        max-height .28s ease,
        margin .22s ease;
    transform-origin: right center;
    will-change: transform, opacity;
}

/* 펼침 상태에서 각 버튼 stagger 등장 (위에서 아래 순) */
.fb-stack:not(.is-collapsed) > .fb-btn--top      { transition-delay: 0ms; }
.fb-stack:not(.is-collapsed) > .fb-btn--chat     { transition-delay: 40ms; }
.fb-stack:not(.is-collapsed) > .fb-btn--phone    { transition-delay: 80ms; }
.fb-stack:not(.is-collapsed) > .fb-btn--kakao    { transition-delay: 120ms; }

/* 접힘 상태 — fold 외 모두 페이드 + 슬라이드 다운 + 높이 0 */
.fb-stack.is-collapsed > .fb-btn:not(.fb-btn--fold) {
    opacity: 0;
    transform: translateY(20px) scale(0.6);
    max-height: 0;
    min-height: 0;
    height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    pointer-events: none;
    transition-delay: 0ms;
}

/* ============================================================
   📱 모바일 보정
   ============================================================ */
@media (max-width: 575px) {
    .fb-btn--fold {
        height: 44px;
        min-width: 44px;
        width: 44px;
    }
    .fb-fold-icon { width: 20px; height: 20px; }
}
