/* 상담 신청 안내 섹션 */
.chat-consult-section {
    padding: 100px 0;
    background-color: #F5FDFD;
    border-top: 1px solid var(--line-color);
}

.chat-consult-section .inner-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.chat-consult-section .consult-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-white);
    padding: 60px;
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
    border: 1px solid var(--line-color);
}

.chat-consult-section .label {
    display: inline-block;
    color: var(--point-blue);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.chat-consult-section .title {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.chat-consult-section .desc {
    font-size: 18px;
    color: var(--text-gray);
    margin-bottom: 25px;
}

.chat-consult-section .time-info {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #EDFAF9;
    border-radius: 50px;
    color: #444;
    font-size: 16px;
}

.chat-consult-section .time-info i {
    color: var(--point-blue);
    font-size: 20px;
}

.chat-consult-section .btn-chat-trigger {
    background: var(--water-gradient);
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 10px 20px rgba(0, 204, 198, 0.3);
}

.chat-consult-section .btn-chat-trigger:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 204, 198, 0.4);
}

/* 채팅 레이어 */
.chat-layer-wrapper {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 380px;
    height: 600px;
    background: var(--bg-white);
    border-radius: 24px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(100px) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-layer-wrapper.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* 모바일 플로팅 버튼 */
.btn-chat-floating {
    position: fixed;
    right: 25px;
    bottom: 100px; /* 푸터 높이 고려 및 우측 하단에서 살짝 위 */
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--water-gradient);
    color: white;
    border: none;
    box-shadow: 0 10px 25px rgba(0, 204, 198, 0.4);
    cursor: pointer;
    z-index: 999;
    display: none; /* 기본 숨김 (모바일에서만 노출) */
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-chat-floating i {
    font-size: 28px;
}

.btn-chat-floating:hover {
    transform: scale(1.1) rotate(5deg);
}

.chat-layer-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 채팅 헤더 */
.chat-header {
    background: var(--water-gradient);
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.chat-header .bot-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header .profile-img {
    position: relative;
    width: 44px;
    height: 44px;
}

.chat-header .profile-img img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.chat-header .status-dot {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 12px;
    height: 12px;
    background: #4ade80;
    border: 2px solid #fff;
    border-radius: 50%;
}

.chat-header .profile-text .name {
    display: block;
    font-weight: 700;
    font-size: 16px;
}

.chat-header .profile-text .status {
    font-size: 12px;
    opacity: 0.8;
}

.chat-header .btn-close-chat {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-header .btn-close-chat:hover {
    background: rgba(255, 255, 255, 0.4);
}

.chat-header .btn-close-chat i {
    font-size: 20px;
}

/* 채팅 바디 */
.chat-body {
    flex: 1;
    padding: 25px;
    background: #f9f9f9;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-date {
    text-align: center;
    margin-bottom: 10px;
}

.chat-date span {
    font-size: 12px;
    color: #999;
    background: #eee;
    padding: 4px 12px;
    border-radius: 10px;
}

.message-item {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.message-item.bot {
    align-self: flex-start;
}

.message-item.user {
    align-self: flex-end;
}

.msg-bubble {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 18px;
    position: relative;
}

.bot .msg-bubble {
    background: #fff;
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.user .msg-bubble {
    background: var(--point-blue);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg-time {
    font-size: 11px;
    color: #bbb;
    margin-top: 5px;
}

.user .msg-time {
    text-align: right;
}

/* 채팅 푸터 */
.chat-footer {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #eee;
}

.chat-footer .input-group {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    padding: 5px 5px 5px 15px;
    border-radius: 30px;
}

.chat-footer input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 14px;
    outline: none;
}

.chat-footer .btn-send {
    width: 40px;
    height: 40px;
    background: var(--point-blue);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-footer .btn-send:hover {
    background: #00A8A3;
    transform: scale(1.05);
}

.chat-footer .btn-send i {
    font-size: 18px;
    margin-left: 2px; /* 종이비행기 아이콘 균형 조정 */
}

/* 반응형 */
@media screen and (max-width: 768px) {
    .chat-consult-section .consult-info {
        flex-direction: column;
        text-align: center;
        padding: 40px 20px;
    }
    
    .chat-consult-section .action-group {
        margin-top: 30px;
    }
    
    .chat-consult-section .title {
        font-size: 28px;
    }

    .chat-layer-wrapper {
        right: 15px;
        bottom: 15px;
        width: calc(100% - 30px);
        height: 80vh;
    }

    .btn-chat-floating {
        display: flex; /* 모바일에서 노출 */
    }
}

/* ── AI 상담창 ─────────────────────────────
   비즈챗 위젯 대신 레이아웃이 직접 그린다. */
.ai-chat {
    position: fixed;
    inset: 0;
    z-index: 10050;
}

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

.ai-chat-dim {
    position: absolute;
    inset: 0;
    background: rgba(6, 20, 30, .45);
    backdrop-filter: blur(2px);
}

.ai-chat-panel {
    position: absolute;
    right: 24px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    width: 400px;
    max-width: calc(100vw - 32px);
    max-height: min(680px, calc(100vh - 48px));
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 30px 70px rgba(6, 25, 35, .35);
    overflow: hidden;
    animation: aiChatUp .3s cubic-bezier(.2, .8, .3, 1);
}

@keyframes aiChatUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
}

.ai-chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px;
    background: linear-gradient(120deg, #067fff, #00ccc6);
    color: #fff;
}

.ai-chat-title strong { display: block; font-size: 1.05rem; font-weight: 900; }
.ai-chat-title span { font-size: .82rem; color: rgba(255, 255, 255, .8); }

.ai-chat-close {
    border: 0;
    background: none;
    font-size: 1.7rem;
    line-height: 1;
    color: #fff;
    cursor: pointer;
}

/* 동의 화면 */
.ai-chat-gate { padding: 26px 24px 24px; overflow-y: auto; }
.ai-chat-gate h3 { margin: 0 0 12px; font-size: 1.15rem; font-weight: 900; color: #0d1f2b; }

.ai-gate-lead {
    margin: 0 0 16px;
    font-size: .92rem;
    line-height: 1.7;
    color: #55636b;
    word-break: keep-all;
}

.ai-gate-list {
    margin: 0 0 20px;
    padding: 16px 18px;
    border-radius: 16px;
    background: #f4f9fa;
    list-style: none;
}

.ai-gate-list li {
    position: relative;
    padding-left: 14px;
    margin-bottom: 8px;
    font-size: .86rem;
    line-height: 1.6;
    color: #55636b;
    word-break: keep-all;
}

.ai-gate-list li:last-child { margin-bottom: 0; }
.ai-gate-list li::before { content: ''; position: absolute; left: 0; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--point-mint); }

.ai-gate-agree {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 18px;
    font-size: .9rem;
    font-weight: 700;
    color: #3d4b53;
    cursor: pointer;
}

.ai-gate-agree input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--point-mint-deep); }

.ai-chat-start {
    width: 100%;
    padding: 16px;
    border: 0;
    border-radius: 999px;
    background: #0d1f2b;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
}

.ai-chat-start:disabled { background: #c3ced3; cursor: default; }

/* 대화 */
.ai-chat-body {
    flex: 1;
    min-height: 220px;
    padding: 20px;
    overflow-y: auto;
    background: #f6fbfc;
}

.ai-msg { margin-bottom: 12px; display: flex; }
.ai-msg p { max-width: 84%; margin: 0; padding: 12px 16px; font-size: .92rem; line-height: 1.65; word-break: keep-all; }

.ai-msg-ai { justify-content: flex-start; }
.ai-msg-ai p { border-radius: 4px 18px 18px 18px; background: #fff; color: #3d4b53; box-shadow: 0 3px 10px rgba(13, 45, 60, .06); }

.ai-msg-me { justify-content: flex-end; }
.ai-msg-me p { border-radius: 18px 4px 18px 18px; background: var(--point-mint); color: #05221f; font-weight: 600; }

.ai-msg-wait p span {
    display: inline-block;
    width: 6px; height: 6px;
    margin-right: 4px;
    border-radius: 50%;
    background: #b6c4ca;
    animation: aiDot 1.2s infinite;
}

.ai-msg-wait p span:nth-child(2) { animation-delay: .2s; }
.ai-msg-wait p span:nth-child(3) { animation-delay: .4s; }

@keyframes aiDot {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

/* 자주 묻는 질문 */
.ai-chat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 20px 14px;
    background: #f6fbfc;
}

.ai-chat-quick button {
    padding: 9px 14px;
    border: 1px solid #d7e6ea;
    border-radius: 999px;
    background: #fff;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 600;
    color: #3d4b53;
    cursor: pointer;
}

.ai-chat-quick button:hover { border-color: var(--point-mint); color: var(--point-mint-deep); }

/* 입력 */
.ai-chat-foot { padding: 14px 18px 16px; border-top: 1px solid #eaf1f3; background: #fff; }
.ai-chat-form { display: flex; gap: 8px; }

.ai-chat-form input {
    flex: 1;
    min-width: 0;
    padding: 13px 16px;
    border: 1px solid #dbe6ea;
    border-radius: 999px;
    background: #fbfeff;
    font-family: inherit;
    font-size: .95rem;
}

.ai-chat-form input:focus { outline: none; border-color: var(--point-mint); }

.ai-chat-form button {
    flex: 0 0 auto;
    width: 46px; height: 46px;
    border: 0;
    border-radius: 50%;
    background: #0d1f2b;
    color: #fff;
    cursor: pointer;
}

.ai-chat-form button:disabled { background: #c3ced3; }

.ai-chat-note { margin: 10px 0 0; font-size: .76rem; text-align: center; color: #93a2a9; }

/* 상담 접수 */
.ai-chat-handoff { padding: 20px; border-top: 1px solid #eaf1f3; background: #fff; }
.ai-chat-handoff h3 { margin: 0 0 6px; font-size: 1rem; font-weight: 900; color: #0d1f2b; }
.ai-chat-handoff > p { margin: 0 0 14px; font-size: .85rem; line-height: 1.6; color: #7b8a92; word-break: keep-all; }

.ai-hand-row { display: flex; gap: 8px; margin-bottom: 8px; }

.ai-chat-handoff input[type="text"],
.ai-chat-handoff input[type="tel"],
.ai-chat-handoff select {
    width: 100%;
    min-width: 0;
    padding: 12px 15px;
    border: 1px solid #dbe6ea;
    border-radius: 14px;
    background: #fbfeff;
    font-family: inherit;
    font-size: .92rem;
}

.ai-chat-handoff select { margin-bottom: 10px; }

.ai-hand-agree {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
    font-size: .8rem;
    line-height: 1.55;
    color: #55636b;
    cursor: pointer;
    word-break: keep-all;
}

.ai-hand-agree input { width: 16px; height: 16px; margin-top: 1px; accent-color: var(--point-mint-deep); }

.ai-hand-btns { display: flex; gap: 8px; }

.ai-hand-send,
.ai-hand-cancel {
    flex: 1;
    padding: 13px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: .92rem;
    font-weight: 800;
    cursor: pointer;
}

.ai-hand-send { background: var(--point-mint); color: #05221f; }
.ai-hand-send:disabled { background: #c3ced3; color: #fff; }
.ai-hand-cancel { border-color: #dbe6ea; background: #fff; color: #55636b; }

.ai-hand-msg { margin: 10px 0 0; font-size: .84rem; font-weight: 700; text-align: center; color: #d94b4b; }

@media (max-width: 640px) {
    .ai-chat-panel {
        right: 0; bottom: 0; left: 0;
        width: auto;
        max-width: none;
        max-height: 88vh;
        border-radius: 24px 24px 0 0;
    }

    .ai-hand-row { flex-direction: column; }
}

/* 창 안에서 각 칸이 제 몫만 차지하도록 못박는다.
   이걸 안 잡으면 접수 폼이 열릴 때 내용이 늘어나 머리말(닫기 버튼)이 화면 위로 밀려난다 */
.ai-chat-head { flex: 0 0 auto; }
.ai-chat-gate { flex: 1 1 auto; min-height: 0; }

.ai-chat-body {
    flex: 1 1 auto;
    min-height: 120px;
}

.ai-chat-quick,
.ai-chat-foot { flex: 0 0 auto; }

/* 접수 폼은 창의 절반을 넘지 않게 두고, 넘치면 자기 안에서 스크롤한다 */
.ai-chat-handoff {
    flex: 0 0 auto;
    max-height: 52%;
    overflow-y: auto;
}

/* 대화 영역 스크롤바 — 둥근 모서리 밖으로 삐져나오지 않게 얇게 둔다 */
.ai-chat-body,
.ai-chat-handoff,
.ai-chat-gate {
    scrollbar-width: thin;
    scrollbar-color: #c9d8dd transparent;
}

.ai-chat-body::-webkit-scrollbar,
.ai-chat-handoff::-webkit-scrollbar,
.ai-chat-gate::-webkit-scrollbar { width: 6px; background: transparent; }

.ai-chat-body::-webkit-scrollbar-thumb,
.ai-chat-handoff::-webkit-scrollbar-thumb,
.ai-chat-gate::-webkit-scrollbar-thumb { border-radius: 999px; background: #c9d8dd; }

.ai-chat-body::-webkit-scrollbar-track,
.ai-chat-handoff::-webkit-scrollbar-track,
.ai-chat-gate::-webkit-scrollbar-track { background: transparent; }

/* 물어보다 말고 바로 신청하려는 사람을 위한 통로 */
.ai-chat-apply {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid #cfe6e5;
    border-radius: 999px;
    background: #f0fbfa;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 800;
    color: var(--point-mint-deep);
    cursor: pointer;
    transition: background .2s;
}

.ai-chat-apply:hover { background: #e2f6f5; }

/* 답변 안의 사이트 링크 */
.ai-msg-ai .ai-link {
    font-weight: 800;
    color: var(--point-mint-deep);
    text-decoration: underline;
}

/* 메뉴로 이어 주는 링크는 알약으로 눌러 보이게 */
.ai-msg-ai .ai-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(0, 204, 198, .14);
    font-size: .85rem;
    font-weight: 800;
    color: var(--point-mint-deep);
    text-decoration: none;
}

.ai-msg-ai .ai-link::after {
    content: '';
    width: 5px;
    height: 5px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
}

.ai-msg-ai .ai-link:hover { background: rgba(0, 204, 198, .24); }
