@charset "utf-8";

/* ==========================================================================
   층간소음 이웃사이센터 챗봇 위젯
   - 메인 메뉴가 스크롤 없이 한 화면에 들어오도록 크기/여백 조정
   ========================================================================== */

#chatbotWidget {
    --cb-green: #7cb342;
    --cb-green-dark: #689f38;
    --cb-green-light: #f1f8e9;
    --cb-header: #ffffff;
    --cb-header-text: #333333;
    --cb-body-bg: #f5f6f8;
    --cb-bubble-bot: #ffffff;
    --cb-bubble-user: #7cb342;
    --cb-text: #333333;
    --cb-text-sub: #7a8495;
    --cb-border: #e3e7ec;

    box-sizing: border-box;
    font-family: "맑은 고딕", "Malgun Gothic", sans-serif;
}

#chatbotWidget *,
#chatbotWidget *::before,
#chatbotWidget *::after {
    box-sizing: border-box;
}


/* ==========================================================================
   상담절차 안내 - 세로형
   ========================================================================== */

#chatbotWidget .procedure_flow {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}


/* 각 단계 박스 */
#chatbotWidget .procedure_step {
    width: 100%;
    border: 1px solid #b8c1ca;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}


/* 위쪽 박스 - 단계 제목 */
#chatbotWidget .procedure_step_title {
    padding: 8px 12px;

    background: #dce6ee;

    color: #333333;
    font-size: 14px;
    font-weight: 700;

    line-height: 1.15;
    text-align: center;
}


/* 아래쪽 박스 - 단계 내용 */
#chatbotWidget .procedure_step_content {
    padding: 8px 12px;

    color: #333333;
    font-size: 14px;

    line-height: 1.15;
    text-align: center;
}


/* 세로 화살표 */
#chatbotWidget .procedure_arrow {
    padding: 1px 0;

    color: #7a8495;

    font-size: 18px;
    font-weight: 700;

    line-height: 1;
    text-align: center;
}
/* ==========================================================================
   1. 위젯 위치 / 플로팅 버튼
   ========================================================================== */

#chatbotWidget.chatbot_widget {
    position: fixed;
    right: 30px;
    bottom: 30px;
    z-index: 9999;
}

#chatbotWidget .chatbot_toggle_btn {
    display: block;
    width: 100px;
    height: 100px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    transition: transform .2s ease;
}

#chatbotWidget .chatbot_toggle_btn:hover {
    background: transparent;
    box-shadow: none;
    transform: scale(1.03);
}

#chatbotWidget .chatbot_toggle_btn:focus {
    outline: none;
}

#chatbotWidget .chatbot_toggle_btn:focus-visible {
    outline: 3px solid var(--cb-green-dark);
    outline-offset: 3px;
}

#chatbotWidget.panel_open .chatbot_toggle_btn {
    transform: none;
}

#chatbotWidget #chatbotBtnIcon {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ==========================================================================
   2. 챗봇 패널
   - 높이: 큰 화면은 최대 640px, 작은 화면은 화면 높이에 맞춰 자동 축소
   ========================================================================== */

#chatbotWidget .chatbot_panel {
    position: absolute;
    right: 0;
    bottom: 110px;

    display: flex;
    flex-direction: column;

    width: 380px;
    height: 640px;                               /* 구형 브라우저 폴백 */
    height: min(640px, calc(100dvh - 140px));    /* 화면 높이에 맞춤 */

    overflow: hidden;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 10px 32px rgba(0, 0, 0, .18);

    transform-origin: bottom right;
    transform: translateY(8px) scale(.98);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
            transform .22s ease,
            opacity .18s ease,
            visibility 0s linear .22s;
}

#chatbotWidget .chatbot_panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transition:
            transform .22s ease,
            opacity .18s ease,
            visibility 0s;
}

/* ==========================================================================
   3. 헤더
   ========================================================================== */

#chatbotWidget .chat_header {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 64px;

    width: 100%;
    padding: 0 24px;
    border-bottom: 1px solid var(--cb-border);
    background: var(--cb-header);

    color: var(--cb-header-text);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

/* ==========================================================================
   5. 대화 영역
   ========================================================================== */

#chatbotWidget .chat_body {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;

    padding: 20px 22px 22px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;

    background: var(--cb-body-bg);
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

#chatbotWidget .chat_row {
    display: flex;
    align-items: flex-start;
    width: 100%;
    margin: 0 0 14px;
}

#chatbotWidget .chat_row.bot {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

/* 봇 메시지 왼쪽 캐릭터 */
#chatbotWidget .bot_avatar_wrap {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
}

#chatbotWidget .bot_avatar {
    display: block;
    width: 52px;
    height: 52px;
    object-fit: contain;
}

#chatbotWidget .chat_row.user {
    justify-content: flex-end;
}

#chatbotWidget .chat_bubble {
    max-width: 100%;
    padding: 14px 16px;
    border-radius: 18px;

    font-size: 14px;
    line-height: 1.65;
    word-break: keep-all;
    overflow-wrap: anywhere;
}


/* 봇 말풍선 - 내용 높이에 맞춤 (min-height 제거로 빈 공간 없앰) */
#chatbotWidget .chat_row.bot .chat_bubble {
    width: 100%;
    max-width: 100%;
    border-radius: 20px;
    border-top-left-radius: 6px;
    background: var(--cb-bubble-bot);
    color: var(--cb-text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

#chatbotWidget .chat_row.user .chat_bubble {
    max-width: 82%;
    border-top-right-radius: 5px;
    background: var(--cb-bubble-user);
    color: #ffffff;
}

#chatbotWidget .bot_title {
    margin: 0 0 6px;
    color: var(--cb-green-dark);
    font-size: 15px;
    font-weight: 700;
}

#chatbotWidget .bot_desc {
    color: var(--cb-text);
}

#chatbotWidget .bot_desc p {
    margin: 0 0 10px;
}

#chatbotWidget .bot_desc p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   6. 메뉴 / 액션 영역
   - 버튼 높이/여백을 줄여 4개가 한 화면에 들어오게
   ========================================================================== */

#chatbotWidget .chat_action_box {
    width: 100%;
    margin: 12px 0 14px;
}

#chatbotWidget .menu_btn,
#chatbotWidget .link_btn,
#chatbotWidget .auth_btn,
#chatbotWidget .search_btn {
    display: block;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
    border-radius: 12px;
    text-decoration: none;
    font-family: inherit;
}

/* 메인/하위 메뉴 버튼 */
#chatbotWidget .menu_btn {
    min-height: 56px;
    margin-top: 0;
    margin-bottom: 12px;
    padding: 12px 16px;

    border: 1.5px solid var(--cb-green);
    background: #ffffff;
    color: var(--cb-green-dark);

    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;

    transition:
            background .15s ease,
            color .15s ease;
}

#chatbotWidget .menu_btn:last-child {
    margin-bottom: 0;
}

#chatbotWidget .menu_btn:hover {
    background: var(--cb-green);
    color: #ffffff;
}

/* 일반 링크 버튼 */
#chatbotWidget .link_btn {
    margin-top: 10px;
    padding: 13px 15px;
    border: 0;
    background: var(--cb-green);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    transition: background .15s ease;
}

#chatbotWidget .link_btn:hover {
    background: var(--cb-green-dark);
}

/* 접수번호 입력 */
#chatbotWidget .receipt_input {
    display: block;
    width: 100%;
    height: 48px;
    margin-top: 10px;
    padding: 0 13px;

    border: 1.5px solid var(--cb-border);
    border-radius: 11px;
    background: #ffffff;

    color: var(--cb-text);
    font-family: inherit;
    font-size: 15px;
}

#chatbotWidget .receipt_input:focus {
    outline: none;
    border-color: var(--cb-green);
}

/* 조회 버튼 */
#chatbotWidget .search_btn {
    margin-top: 9px;
    padding: 13px;
    border: 0;
    background: var(--cb-green);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    transition: background .15s ease;
}

#chatbotWidget .search_btn:hover {
    background: var(--cb-green-dark);
}

/* 본인인증 버튼 */
#chatbotWidget .auth_btn {
    margin-top: 10px;
    padding: 14px;

    border: 1.5px solid var(--cb-green);
    background: #ffffff;
    color: var(--cb-green-dark);

    font-size: 15px;
    font-weight: 700;
    text-align: center;

    transition:
            background .15s ease,
            color .15s ease;
}

#chatbotWidget .auth_btn:hover {
    background: var(--cb-green);
    color: #ffffff;
}

#chatbotWidget .auth_btn span {
    display: block;
    margin-top: 3px;
    color: var(--cb-text-sub);
    font-size: 12px;
    font-weight: 400;
}

#chatbotWidget .auth_btn:hover span {
    color: rgba(255, 255, 255, .88);
}

/* ==========================================================================
   7. 조회 결과 / 안내
   ========================================================================== */

#chatbotWidget .result_box {
    margin-top: 10px;
    padding: 14px;
    border: 1px solid var(--cb-border);
    border-radius: 12px;
    background: #F5F9E8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

#chatbotWidget .result_list {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: 7px;
    margin: 0;
    font-size: 13px;
}

#chatbotWidget .result_list dt {
    color: var(--cb-green-dark);
    font-weight: 700;
}

#chatbotWidget .result_list dd {
    margin: 0;
    color: var(--cb-text);
    word-break: break-all;
}

#chatbotWidget .result_message {
    margin-top: 10px;
    padding: 12px;

    border: 1px solid var(--cb-border);
    border-radius: 10px;
    background: #ffffff;

    color: var(--cb-text-sub);
    font-size: 13px;
    text-align: center;
}

/* ==========================================================================
   8. 입력 중 표시
   ========================================================================== */

#chatbotWidget .typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 3px;
    border-radius: 50%;
    background: var(--cb-green);
    animation: chatbotTyping 1.1s infinite ease-in-out;
}

#chatbotWidget .typing span:nth-child(2) {
    animation-delay: .12s;
}

#chatbotWidget .typing span:nth-child(3) {
    animation-delay: .24s;
}

@keyframes chatbotTyping {
    0%, 60%, 100% {
        opacity: .35;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

/* ==========================================================================
   9. 하단 고정 버튼
   ========================================================================== */

#chatbotWidget .chat_footer {
    display: flex;
    flex: 0 0 60px;
    width: 100%;

    border-top: 1px solid var(--cb-border);
    background: #ffffff;
}

#chatbotWidget .footer_btn {
    flex: 1;
    height: 60px;
    margin: 0;
    padding: 0;

    border: 0;
    border-radius: 0;
    background: #ffffff;

    color: #777777;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    text-align: center;

    appearance: none;
    -webkit-appearance: none;

    transition:
            background .15s ease,
            color .15s ease;
}

#chatbotWidget .footer_btn + .footer_btn {
    border-left: 1px solid var(--cb-border);
}

#chatbotWidget .footer_btn:hover {
    background: #f7f8f9;
    color: var(--cb-green-dark);
}

#chatbotWidget .footer_btn:focus {
    outline: none;
}

#chatbotWidget .footer_btn:focus-visible {
    outline: 2px solid var(--cb-green);
    outline-offset: -3px;
}

#chatbotWidget .process_step_wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.8;
}

#chatbotWidget .process_step {
    flex: 0 1 auto;
    min-width: 0;
    color: #333333;
    text-align: center;
    white-space: nowrap;
}

#chatbotWidget .process_step.current {
    color: var(--cb-green-dark);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 4px;
}

#chatbotWidget .process_arrow {
    flex: 0 0 auto;
    margin: 0 4px;
    color: #777777;
}

#chatbotWidget .process_status_message {
    margin-top: 8px;
    color: #333333;
    font-size: 13px;
    line-height: 1.6;
}

.chatbot_quick_help {
    position: absolute;
    right: 0;
    bottom: 100px;

    padding: 10px 16px;

    /* 노란색 말풍선 */
    background: #f4f06a;
    border: 1px solid #e5df4f;
    border-radius: 20px;

    color: #333;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 10;
}

/* 말풍선 꼬리도 동일한 노란색 */
.chatbot_quick_help::after {
    content: "";
    position: absolute;
    right: 22px;
    bottom: -6px;

    width: 10px;
    height: 10px;

    background: #f4f06a;
    border-right: 1px solid #e5df4f;
    border-bottom: 1px solid #e5df4f;

    transform: rotate(45deg);
}

/* 챗봇 열리면 안내 말풍선 숨김 */
.chatbot_widget.panel_open .chatbot_quick_help {
    display: none;
}

@media screen and (max-width: 500px) {

    #chatbotWidget.chatbot_widget {
        right: 10px;
        bottom: 10px;
    }

    #chatbotWidget .chatbot_panel {
        position: fixed;
        left: 10px;
        right: 10px;
        top: 10px;
        bottom: 10px;
        width: auto;
        max-width: none;
        height: auto;
        border-radius: 18px;
    }

    /* 빠른 도움 말풍선 */
    #chatbotWidget .chatbot_quick_help {
        right: 0;
        bottom: 50px;
        padding: 7px 11px;
        border-radius: 16px;
        font-size: 11px;
        line-height: 1.4;
    }

    /* 말풍선 꼬리 */
    #chatbotWidget .chatbot_quick_help::after {
        right: 14px;
        bottom: -5px;
        width: 8px;
        height: 8px;
    }

    /* 헤더 */
    #chatbotWidget .chat_header {
        flex: 0 0 64px;
        min-height: 64px;
        font-size: 19px;
    }

    /* 대화 영역 */
    #chatbotWidget .chat_body {
        flex: 1 1 0;
        height: 0;
        min-height: 0;
        width: 100%;

        padding: 20px;

        overflow-x: hidden;
        overflow-y: scroll;

        touch-action: pan-y;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: auto;

        position: relative;
        z-index: 1;
    }

    /* 전체 말풍선 글씨 */
    #chatbotWidget .chat_bubble {
        padding: 16px 18px;
        font-size: 16px;
        line-height: 1.7;
    }

    /* 챗봇 제목 */
    #chatbotWidget .bot_title {
        font-size: 17px;
    }

    /* 챗봇 설명 */
    #chatbotWidget .bot_desc {
        font-size: 16px;
        line-height: 1.7;
    }

    /* 메뉴 버튼 */
    #chatbotWidget .menu_btn {
        min-height: 64px;
        margin-bottom: 14px;
        padding: 15px 18px;

        font-size: 17px;
        line-height: 1.5;
    }

    /* 바로가기 버튼 */
    #chatbotWidget .link_btn {
        padding: 15px 18px;
        font-size: 16px;
    }

    /* 본인인증 버튼 */
    #chatbotWidget .auth_btn {
        padding: 16px;
        font-size: 17px;
    }

    #chatbotWidget .auth_btn span {
        font-size: 14px;
    }

    /* 접수번호 입력 */
    #chatbotWidget .receipt_input {
        height: 54px;
        font-size: 16px;
    }

    /* 조회 버튼 */
    #chatbotWidget .search_btn {
        padding: 15px;
        font-size: 16px;
    }

    /* 조회 결과 */
    #chatbotWidget .result_list {
        font-size: 15px;
    }

    #chatbotWidget .result_message {
        font-size: 15px;
    }

    #chatbotWidget .process_step_wrap {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: nowrap;
        font-size: 12px;
        line-height: 1.4;
    }

    #chatbotWidget .process_step {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        white-space: normal;
        word-break: keep-all;
        text-align: center;
    }

    #chatbotWidget .process_arrow {
        flex: 0 0 auto;
        margin: 0 1px;
        font-size: 10px;
    }

    #chatbotWidget .process_status_message {
        font-size: 15px;
    }

    /* 하단 버튼 */
    #chatbotWidget .chat_footer {
        flex: 0 0 64px;
        min-height: 64px;
        position: relative;
        z-index: 2;
    }

    #chatbotWidget .footer_btn {
        height: 64px;
        font-size: 17px;
    }

    /* 플로팅 아이콘 */
    #chatbotWidget .chatbot_toggle_btn {
        width: 52px;
        height: 52px;
    }

    #chatbotWidget #chatbotBtnIcon {
        width: 52px;
        height: 52px;
    }
}

/* ==========================================================================
   11. 모션 최소화
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    #chatbotWidget .chatbot_toggle_btn,
    #chatbotWidget .chatbot_panel,
    #chatbotWidget .chatbot_panel.open,
    #chatbotWidget .menu_btn,
    #chatbotWidget .link_btn,
    #chatbotWidget .auth_btn,
    #chatbotWidget .search_btn,
    #chatbotWidget .footer_btn {
        transition: none;
    }

    #chatbotWidget .typing span {
        animation: none;
    }

    #chatbotWidget .chat_body {
        scroll-behavior: auto;
    }
}


/* ==========================================================================
   12. 하단 버튼 - 이전으로 / 처음으로(대화 초기화) / 닫기
   ========================================================================== */

#chatbotWidget .chat_footer {
    display: flex;
    align-items: stretch;
}

#chatbotWidget .footer_btn {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
}

#chatbotWidget .footer_main_text {
    display: block;
    font-size: inherit;
    font-weight: 600;
    line-height: 1.2;
}

#chatbotWidget .footer_sub_text {
    display: block;
    margin-top: 2px;
    color: #999999;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.15;
}

#chatbotWidget .footer_btn:hover .footer_sub_text {
    color: var(--cb-green-dark);
}

/* 메인메뉴에서는 이전으로만 숨김. 처음으로/닫기는 유지 */
#chatbotWidget #btnPrev {
    display: none;
}

/* ==========================================================================
   13. PC 전용 가로 크기 조절
   - 패널 왼쪽 끝을 드래그해서 폭 조절
   - JSP 수정 없이 chatbot.js가 .chatbot_resize_handle을 자동 생성
   - 태블릿/모바일에서는 핸들을 숨기고 기존 반응형 폭 유지
   ========================================================================== */

#chatbotWidget .chatbot_panel {
    resize: none;
}

/* 기본 상태에서는 리사이즈 핸들 숨김 */
#chatbotWidget .chatbot_resize_handle {
    display: none;
}

/* PC */
@media screen and (min-width: 1025px) {

    #chatbotWidget .chatbot_panel {
        min-width: 380px;
        max-width: min(900px, calc(100vw - 80px));
    }

    #chatbotWidget .chatbot_resize_handle {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 12px;
        height: 100%;
        z-index: 30;
        cursor: ew-resize;
        background: transparent;
        touch-action: none;
    }

    /* 실제 잡는 영역은 넓게, 화면에는 별도 선을 표시하지 않음 */
    #chatbotWidget .chatbot_resize_handle::after {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 4px;
        height: 100%;
        background: transparent;
    }
}

/* 태블릿 */
@media screen and (min-width: 501px) and (max-width: 1024px) {

    #chatbotWidget .chatbot_panel {
        resize: none;
        max-width: calc(100vw - 40px);
    }

    #chatbotWidget .chatbot_resize_handle {
        display: none;
    }
}

/* 모바일 */
@media screen and (max-width: 500px) {

    #chatbotWidget .footer_sub_text {
        font-size: 12px;
    }

    #chatbotWidget .chatbot_panel {
        resize: none;
    }

    #chatbotWidget .chatbot_resize_handle {
        display: none;
    }
}

/* 키워드 자동 목록은 챗봇 아이콘 없이 말풍선만 표시 */
#chatbotWidget .keyword_list_row {
    gap: 0;
}

/* ==========================================================================
   14. 키워드 검색바 / 상담시간 배너
   - chat_body와 chat_footer 사이, 하단에 고정. 대화 스크롤과 무관하게 항상 노출.
   - chatbot.js의 인라인 style.cssText를 여기로 이관.
   ========================================================================== */

/* 상담시간 안내 배너 (검색창 바로 위) */
#chatbotWidget .chat_consult_hours_bar {
    flex: 0 0 auto;
    width: 100%;
    padding: 8px 16px;
    background: var(--cb-green-light);
    border-top: 1px solid var(--cb-border);
    color: var(--cb-green-dark);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    box-sizing: border-box;
}

/* 키워드 검색바 (입력창 + 검색 버튼, 한 줄 배치) */
#chatbotWidget .chat_keyword_bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    padding: 10px 16px;
    background: #ffffff;
    border-top: 1px solid var(--cb-border);
    box-sizing: border-box;
    overflow: hidden;
}

/*
 * .receipt_input / .search_btn은 기본적으로 display:block, width:100%라
 * 세로로 쌓이는 레이아웃이다. 검색바 안에서만 아래 클래스로 한 줄(입력창+버튼) 배치를 강제한다.
 */
#chatbotWidget .chat_keyword_input {
    flex: 1;
    min-width: 0;
    margin: 0;
    height: 44px;
    width: auto;
}

#chatbotWidget .chat_keyword_search_btn {
    flex: 0 0 auto;
    margin: 0;
    height: 44px;
    width: auto;
    padding: 0 18px;
    white-space: nowrap;
}

/* 키워드 안내 목록의 텍스트 링크 (버튼이 아닌 밑줄 링크 스타일) */
#chatbotWidget .chat_keyword_link {
    color: var(--cb-green-dark);
    text-decoration: underline;
    font-weight: 700;
    cursor: pointer;
}

@media screen and (max-width: 500px) {
    #chatbotWidget .chat_consult_hours_bar {
        font-size: 14px;
    }

    #chatbotWidget .chat_keyword_input,
    #chatbotWidget .chat_keyword_search_btn {
        height: 50px;
        font-size: 16px;
    }
}
