/*
 * 채팅상담(고객 쪽 위젯). central-support-chat.js 가 그린다.
 * 커뮤니티 다크 틀(.qz-site)의 색을 그대로 쓴다. .qz-site 의 요소 초기화(p·h2 여백, button 배경)를 이기도록
 * 선택자는 늘 .qz-site 로 시작한다.
 */

/* ------------------------------------------------------------ 단추(빠른 메뉴 위) */

.qz-site .qz-floating {
    align-items: flex-end;
}

.qz-site .qz-floating .qz-chat-launch {
    position: relative;
    width: auto;
    height: 44px;
    padding: 0 16px 0 13px;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #ffb43c, #ff9200 55%, #ff6a00);
    color: #1b1b1b;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: -.01em;
    white-space: nowrap;
    box-shadow: 0 10px 24px rgba(255, 128, 0, .28), 0 6px 14px rgba(0, 0, 0, .45);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.qz-site .qz-floating .qz-chat-launch:hover {
    background: linear-gradient(135deg, #ffc25e, #ffa21f 55%, #ff7a14);
    color: #111;
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(255, 128, 0, .34), 0 8px 16px rgba(0, 0, 0, .45);
}

.qz-site .qz-floating .qz-chat-launch:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.qz-site .qz-chat-launch i {
    font-size: 19px;
    line-height: 1;
}

.qz-site .qz-chat-launch.is-waiting::after,
.qz-site .qz-chat-launch.is-active::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1b1b1b;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .55);
}

.qz-site .qz-chat-launch.is-active::after {
    background: #1fbf5f;
}

.qz-site .qz-chat-launch.is-waiting::after {
    animation: qz-chat-blink 1.2s ease-in-out infinite;
}

.qz-site .qz-chat-launch.is-pulse {
    animation: qz-chat-pop .8s ease-out 2;
}

.qz-site .qz-chat-launch__badge {
    position: absolute;
    top: -6px;
    left: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #ff3b30;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px #272727;
}

.qz-site .qz-chat-launch__badge[hidden] {
    display: none;
}

.qz-site .qz-chat-launch__close {
    display: none;
}

/* 창이 열린 동안(넓은 화면): 알약을 44px "창 내리기" 원으로 접는다. 창은 그 왼쪽에 붙는다. */
@media (min-width: 641px) {
    body.qz-site.qz-chat-open .qz-floating .qz-chat-launch {
        width: 44px;
        padding: 0;
        justify-content: center;
        background: #3a3a3a;
        color: var(--qz-text);
        box-shadow: 0 8px 18px rgba(0, 0, 0, .4);
    }

    body.qz-site.qz-chat-open .qz-floating .qz-chat-launch:hover {
        background: var(--qz-accent);
        color: #272727;
    }

    body.qz-site.qz-chat-open .qz-chat-launch .qz-chat-launch__label,
    body.qz-site.qz-chat-open .qz-chat-launch .qz-chat-launch__icon,
    body.qz-site.qz-chat-open .qz-chat-launch::after {
        display: none;
    }

    body.qz-site.qz-chat-open .qz-chat-launch .qz-chat-launch__close {
        display: block;
        font-size: 24px;
    }
}

/* 남은 시간 안내(창이 닫혀 있을 때). 단추 왼쪽에 말풍선으로 뜬다. */
.qz-site .qz-chat-hint {
    position: absolute;
    right: calc(100% + 12px);
    bottom: 58px;
    width: max-content;
    max-width: 300px;
    white-space: nowrap;
    padding: 9px 12px;
    border: 1px solid rgba(255, 146, 0, .55);
    border-radius: 12px;
    background: #1d1d1d;
    color: #ffd08a;
    font-size: 12.5px;
    line-height: 18px;
    box-shadow: 0 12px 26px rgba(0, 0, 0, .5);
    pointer-events: none;
}

.qz-site .qz-chat-hint[hidden] {
    display: none;
}

@keyframes qz-chat-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: .25; }
}

@keyframes qz-chat-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* ------------------------------------------------------------------ 창 */

.qz-site .qz-chat {
    position: fixed;
    right: 80px;
    bottom: 24px;
    z-index: 80;
    width: 380px;
    height: min(640px, calc(100vh - 48px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--qz-line);
    border-radius: 16px;
    background: var(--qz-bg-deep);
    color: var(--qz-text);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .62);
    font-size: 13.5px;
    line-height: 1.55;
}

.qz-site .qz-chat[hidden] {
    display: none;
}

.qz-site .qz-chat__head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 12px 14px;
    border-bottom: 1px solid var(--qz-line);
    background: linear-gradient(180deg, #2d2926, #242220);
}

.qz-site .qz-chat__mark {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #ffb43c, #ff7a00);
    color: #1b1b1b;
    font-size: 19px;
}

.qz-site .qz-chat__titles {
    flex: 1 1 auto;
    min-width: 0;
}

.qz-site .qz-chat__title {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    line-height: 20px;
}

.qz-site .qz-chat__sub {
    font-size: 12px;
    color: var(--qz-dim);
    line-height: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qz-site .qz-chat__iconbtn {
    flex: 0 0 auto;
    height: 32px;
    min-width: 32px;
    padding: 0 8px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--qz-dim);
    font-size: 12px;
    font-weight: 700;
}

.qz-site .qz-chat__iconbtn i {
    font-size: 18px;
}

.qz-site .qz-chat__iconbtn:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.qz-site .qz-chat__leave:hover {
    background: rgba(255, 80, 80, .14);
    color: #ff8f8f;
}

.qz-site .qz-chat__iconbtn[hidden] {
    display: none;
}

.qz-site .qz-chat__body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ------------------------------------------------------------ 공통 조각 */

.qz-site .qz-chat__center {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 26px;
    text-align: center;
    color: var(--qz-dim);
}

.qz-site .qz-chat__center > i {
    font-size: 34px;
    color: var(--qz-accent);
}

.qz-site .qz-chat__lead {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.qz-site .qz-chat__muted {
    font-size: 12.5px;
    color: var(--qz-muted);
}

.qz-site .qz-chat__row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 6px;
}

.qz-site .qz-chat__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--qz-line);
    border-radius: 10px;
    background: #2a2a2e;
    color: var(--qz-text);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.qz-site .qz-chat__btn:hover {
    border-color: #666;
    color: #fff;
}

.qz-site .qz-chat__btn.is-primary {
    border-color: transparent;
    background: var(--qz-accent);
    color: #1b1b1b;
}

.qz-site .qz-chat__btn.is-primary:hover {
    background: #ffa726;
    color: #111;
}

.qz-site .qz-chat__btn.is-danger {
    border-color: transparent;
    background: #e5484d;
    color: #fff;
}

.qz-site .qz-chat__btn.is-wide {
    width: 100%;
    height: 42px;
    font-size: 14px;
}

.qz-site .qz-chat__btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.qz-site .qz-chat__link {
    color: var(--qz-blue);
    font-size: 12.5px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.qz-site .qz-chat__dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #777;
}

.qz-site .qz-chat__dot.is-on {
    background: #1fbf5f;
    box-shadow: 0 0 0 3px rgba(31, 191, 95, .18);
}

.qz-site .qz-chat__dot.is-wait {
    background: var(--qz-accent);
    animation: qz-chat-blink 1.2s ease-in-out infinite;
}

.qz-site .qz-chat__spin {
    animation: qz-chat-spin 1s linear infinite;
}

@keyframes qz-chat-spin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------ 시작 폼 */

.qz-site .qz-chat__start {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 16px 18px;
}

.qz-site .qz-chat__hello {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border-radius: 14px 14px 14px 4px;
    background: #2f2f35;
}

.qz-site .qz-chat__hello b {
    color: #fff;
    font-size: 14px;
}

.qz-site .qz-chat__hello span {
    color: var(--qz-dim);
    font-size: 13px;
}

.qz-site .qz-chat__availability {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--qz-dim);
    margin: 2px 0 4px;
}

.qz-site .qz-chat__label {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--qz-muted);
}

.qz-site .qz-chat__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.qz-site .qz-chat__chip {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--qz-line);
    border-radius: 16px;
    background: #26262a;
    color: var(--qz-text);
    font-size: 12.5px;
}

.qz-site .qz-chat__chip:hover {
    border-color: #777;
}

.qz-site .qz-chat__chip.is-on {
    border-color: var(--qz-accent);
    background: rgba(255, 146, 0, .16);
    color: #ffc070;
    font-weight: 700;
}

.qz-site .qz-chat__chip:focus-visible,
.qz-site .qz-chat__btn:focus-visible,
.qz-site .qz-chat__iconbtn:focus-visible,
.qz-site .qz-chat__send:focus-visible,
.qz-site .qz-chat__star:focus-visible {
    outline: 2px solid var(--qz-accent);
    outline-offset: 2px;
}

.qz-site .qz-chat__start-text,
.qz-site .qz-chat__comment {
    width: 100%;
    resize: vertical;
    min-height: 88px;
    padding: 10px 12px;
    border: 1px solid var(--qz-line);
    border-radius: 10px;
    background: #151517;
    color: var(--qz-text);
    font: inherit;
    font-size: 13.5px;
}

.qz-site .qz-chat__comment {
    min-height: 56px;
}

.qz-site .qz-chat__start-text:focus,
.qz-site .qz-chat__comment:focus,
.qz-site .qz-chat__input:focus {
    outline: none;
    border-color: var(--qz-accent);
    box-shadow: 0 0 0 3px rgba(255, 146, 0, .16);
}

.qz-site .qz-chat__counter {
    align-self: flex-end;
    font-size: 11px;
    color: var(--qz-muted);
}

.qz-site .qz-chat__error {
    min-height: 18px;
    font-size: 12.5px;
    color: #ff8f8f;
}

.qz-site .qz-chat__rules {
    margin: 6px 0 0;
    padding: 10px 12px 10px 26px;
    border-radius: 10px;
    background: #202023;
    color: var(--qz-muted);
    font-size: 11.5px;
    line-height: 17px;
    list-style: disc;
}

/* ------------------------------------------------------------ 대화 */

.qz-site .qz-chat__room {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.qz-site .qz-chat__notice,
.qz-site .qz-chat__warn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 8px 14px;
    font-size: 12.5px;
}

.qz-site .qz-chat__notice {
    border-bottom: 1px solid rgba(255, 146, 0, .25);
    background: rgba(255, 146, 0, .09);
    color: #ffd08a;
}

.qz-site .qz-chat__warn {
    border-top: 1px solid rgba(255, 90, 90, .3);
    background: rgba(255, 90, 90, .1);
    color: #ffb3b3;
    font-weight: 700;
}

.qz-site .qz-chat__notice[hidden],
.qz-site .qz-chat__warn[hidden],
.qz-site .qz-chat__typing[hidden],
.qz-site .qz-chat__composer[hidden],
.qz-site .qz-chat__end[hidden],
.qz-site .qz-chat__confirm[hidden] {
    display: none;
}

.qz-site .qz-chat__log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 14px 8px;
}

.qz-site .qz-chat__log:focus-visible {
    outline: 2px solid rgba(255, 146, 0, .5);
    outline-offset: -2px;
}

.qz-site .qz-chat__day {
    margin: 10px 0 8px;
    text-align: center;
    font-size: 11.5px;
    color: var(--qz-muted);
}

.qz-site .qz-chat__sys {
    display: flex;
    justify-content: center;
    margin: 8px 0;
}

.qz-site .qz-chat__sys span {
    max-width: 92%;
    padding: 5px 12px;
    border-radius: 12px;
    background: #26262b;
    color: var(--qz-dim);
    font-size: 12px;
    text-align: center;
}

.qz-site .qz-chat__msg {
    display: flex;
    margin: 4px 0;
}

.qz-site .qz-chat__msg.is-mine {
    justify-content: flex-end;
}

.qz-site .qz-chat__stack {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 82%;
}

.qz-site .qz-chat__msg.is-mine .qz-chat__stack {
    align-items: flex-end;
}

.qz-site .qz-chat__who {
    font-size: 11.5px;
    font-weight: 700;
    color: #ffc070;
    margin: 2px 0 1px 2px;
}

.qz-site .qz-chat__bubble {
    padding: 9px 13px;
    border-radius: 16px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 13.5px;
    line-height: 1.6;
}

.qz-site .qz-chat__msg.is-theirs .qz-chat__bubble {
    border-bottom-left-radius: 5px;
    background: #2f2f35;
    color: var(--qz-text);
}

.qz-site .qz-chat__msg.is-mine .qz-chat__bubble {
    border-bottom-right-radius: 5px;
    background: var(--qz-accent);
    color: #1b1b1b;
}

.qz-site .qz-chat__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    color: var(--qz-muted);
}

.qz-site .qz-chat__meta.is-failed {
    color: #ff8f8f;
}

.qz-site .qz-chat__read {
    color: var(--qz-accent);
    font-weight: 700;
}

.qz-site .qz-chat__mini {
    height: 22px;
    padding: 0 8px;
    border: 1px solid rgba(255, 143, 143, .5);
    border-radius: 6px;
    color: #ffb3b3;
    font-size: 11px;
}

.qz-site .qz-chat__typing {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 16px 6px;
    font-size: 12px;
    color: var(--qz-dim);
}

.qz-site .qz-chat__typing-dots {
    width: 26px;
    height: 8px;
    background:
        radial-gradient(circle, var(--qz-dim) 3px, transparent 3.5px) 0 50% / 8px 8px no-repeat,
        radial-gradient(circle, var(--qz-dim) 3px, transparent 3.5px) 9px 50% / 8px 8px no-repeat,
        radial-gradient(circle, var(--qz-dim) 3px, transparent 3.5px) 18px 50% / 8px 8px no-repeat;
    animation: qz-chat-blink 1s ease-in-out infinite;
}

.qz-site .qz-chat__composer {
    flex: 0 0 auto;
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--qz-line);
    background: #1a1a1c;
}

.qz-site .qz-chat__input {
    flex: 1 1 auto;
    min-height: 40px;
    max-height: 120px;
    resize: none;
    padding: 9px 12px;
    border: 1px solid var(--qz-line);
    border-radius: 12px;
    background: #111113;
    color: var(--qz-text);
    font: inherit;
    font-size: 13.5px;
    line-height: 20px;
}

.qz-site .qz-chat__send {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--qz-accent);
    color: #1b1b1b;
    font-size: 18px;
}

.qz-site .qz-chat__send:hover {
    background: #ffa726;
}

.qz-site .qz-chat__send:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.qz-site .qz-chat__counter.is-inline {
    position: absolute;
    right: 64px;
    top: -18px;
    padding: 0 6px;
    border-radius: 6px;
    background: #1a1a1c;
}

.qz-site .qz-chat__counter.is-inline:empty {
    display: none;
}

.qz-site .qz-chat__end {
    flex: 0 0 auto;
    border-top: 1px solid var(--qz-line);
    background: #1a1a1c;
}

.qz-site .qz-chat__end-box {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 14px 16px 16px;
    text-align: center;
}

.qz-site .qz-chat__end-box > b {
    color: #fff;
    font-size: 14px;
}

.qz-site .qz-chat__stars {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.qz-site .qz-chat__star {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: #4a4a50;
    font-size: 24px;
}

.qz-site .qz-chat__star.is-on {
    color: #ffc233;
}

.qz-site .qz-chat__star:hover {
    background: rgba(255, 255, 255, .06);
}

.qz-site .qz-chat__confirm {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(10, 10, 12, .72);
}

.qz-site .qz-chat__confirm-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--qz-line);
    border-radius: 14px;
    background: #232326;
    text-align: center;
}

.qz-site .qz-chat__confirm-box b {
    color: #fff;
    font-size: 15px;
}

.qz-site .qz-chat__confirm-box p {
    color: var(--qz-dim);
    font-size: 12.5px;
}

/* ------------------------------------------------------------ 좁은 화면 */

@media (max-width: 640px) {
    .qz-site .qz-chat {
        inset: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    body.qz-site.qz-chat-open {
        overflow: hidden;
    }

    body.qz-site.qz-chat-open .qz-floating {
        display: none;
    }

    .qz-site .qz-floating .qz-chat-launch {
        width: 44px;
        padding: 0;
        justify-content: center;
    }

    .qz-site .qz-chat-launch__label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .qz-site .qz-chat-launch.is-waiting::after,
    .qz-site .qz-chat-launch.is-active::after {
        position: absolute;
        right: 1px;
        top: 1px;
    }

    .qz-site .qz-chat-hint {
        bottom: 58px;
        max-width: 60vw;
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    .qz-site .qz-chat-launch,
    .qz-site .qz-chat-launch.is-pulse,
    .qz-site .qz-chat-launch.is-waiting::after,
    .qz-site .qz-chat__dot.is-wait,
    .qz-site .qz-chat__typing-dots,
    .qz-site .qz-chat__spin {
        animation: none;
        transition: none;
    }
}
