/* =================================================================
   AI Quote Chat v3 — 150% 스케일 버전
   PC  : 2-panel (사이드 브랜딩 + 센터 챗)
   모바일: 풀스크린 카카오톡 스타일 (하단 입력 고정)
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&display=swap');

:root {
    --aq-bg: #f5f5f7;
    --aq-dark: #0a0e2e;
    --aq-dark-2: #1a1f3a;
    --aq-primary: #5b6cff;
    --aq-primary-lt: #eef1ff;
    --aq-accent: #a675ff;
    --aq-green: #10c98a;
    --aq-pink: #ff5e7e;
    --aq-text: #1a1f3a;
    --aq-text-sub: #5e6580;
    --aq-text-mute: #8b97b3;
    --aq-border: #e6e8f0;
    --aq-surface: #ffffff;
    --aq-radius: 20px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: var(--aq-bg);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

/* ═══════════════ 레이아웃 (PC 2-panel) ═══════════════ */

.aq {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ─── 사이드 (PC only) ─── */
.aq_side {
    width: 380px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #0a0e2e, #1a2166);
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.aq_side_inner {
    padding: 48px 36px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.aq_side_logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 40px;
}
.aq_logo_mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px; height: 54px;
    background: linear-gradient(135deg, #5b6cff, #a675ff);
    border-radius: 14px;
    font-size: 17px;
    font-weight: 900;
    color: #fff;
}
.aq_logo_text strong {
    display: block;
    font-size: 19px;
    font-weight: 800;
}
.aq_logo_text small {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}
.aq_side_desc {
    font-size: 15px;
    line-height: 1.8;
    color: rgba(255,255,255,0.7);
    margin-bottom: 36px;
}
.aq_side_examples {
    list-style: none;
    padding: 0; margin: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.aq_side_examples li {
    padding: 16px 20px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    font-size: 15px;
    color: rgba(255,255,255,0.75);
    line-height: 1.6;
}
.aq_side_trust {
    padding-top: 28px;
    margin-top: 28px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: rgba(255,255,255,0.45);
}

/* ─── 메인 영역 ─── */
.aq_main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
    background: var(--aq-surface);
    position: relative;
}

/* ─── 헤더 (모바일에서만 보임) ─── */
.aq_header {
    display: none;
}

/* ─── 메시지 영역 ─── */
.aq_messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px 28px 14px;
    background: var(--aq-bg);
    -webkit-overflow-scrolling: touch;
}

/* ─── Welcome 카드 ─── */
.aq_welcome {
    text-align: center;
    padding: 80px 24px 48px;
}
.aq_welcome_avi {
    position: relative;
    width: 96px; height: 96px;
    margin: 0 auto 22px;
}
.aq_welcome_avi_inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #5b6cff, #a675ff);
    border-radius: 50%;
    color: #fff;
    font-size: 28px;
    font-weight: 900;
}
.aq_welcome_status {
    position: absolute;
    right: 4px; bottom: 4px;
    width: 18px; height: 18px;
    background: var(--aq-green);
    border: 3px solid var(--aq-bg);
    border-radius: 50%;
}
.aq_welcome_title {
    font-size: 28px;
    font-weight: 800;
    color: var(--aq-text);
    margin: 0 0 12px;
}
.aq_welcome_desc {
    font-size: 17px;
    color: var(--aq-text-sub);
    line-height: 1.75;
    margin: 0 0 24px;
}
.aq_welcome_hints {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.aq_welcome_hints li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: var(--aq-primary-lt);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    color: var(--aq-primary);
}
.aq_welcome_hints i { font-size: 16px; }

/* ═══════════════ 메시지 버블 ═══════════════ */

.aq_msg {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: aqMsgIn 0.3s cubic-bezier(0.22,1,0.36,1);
}
@keyframes aqMsgIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.aq_msg_avi {
    width: 40px; height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5b6cff, #a675ff);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 900;
}

.aq_msg_bubble {
    max-width: 72%;
    padding: 14px 20px;
    font-size: 16px;
    line-height: 1.7;
    border-radius: 20px;
    word-break: keep-all;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

/* bot */
.aq_msg_assistant .aq_msg_bubble {
    background: var(--aq-surface);
    color: var(--aq-text);
    border: 1px solid var(--aq-border);
    border-bottom-left-radius: 4px;
}

/* user */
.aq_msg_user {
    justify-content: flex-end;
}
.aq_msg_user .aq_msg_bubble {
    background: var(--aq-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* typing */
.aq_msg_typing .aq_msg_bubble {
    display: inline-flex;
    gap: 5px;
    padding: 18px 22px;
}
.aq_msg_typing span {
    width: 9px; height: 9px;
    background: var(--aq-text-mute);
    border-radius: 50%;
    animation: aqDot 1.2s ease-in-out infinite;
}
.aq_dot_2 { animation-delay: 0.15s; }
.aq_dot_3 { animation-delay: 0.3s; }
@keyframes aqDot {
    0%,60%,100% { opacity:0.3; transform:translateY(0); }
    30% { opacity:1; transform:translateY(-4px); }
}

/* ═══════════════ 카카오 알림톡 스타일 카드 ═══════════════ */

.aq_msg_card {
    max-width: 420px;
    background: var(--aq-surface);
    border: 1px solid var(--aq-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 6px 20px -8px rgba(10,14,46,0.14);
    animation: aqCardIn 0.4s cubic-bezier(0.22,1,0.36,1);
}
@keyframes aqCardIn {
    from { opacity:0; transform:translateY(10px) scale(0.97); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}

.aq_card_inner {
    padding: 26px;
}
.aq_card_head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    color: var(--aq-primary);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.aq_card_head i { font-size: 20px; }
.aq_card_desc {
    font-size: 15px;
    line-height: 1.7;
    color: var(--aq-text-sub);
    margin-bottom: 20px;
}
.aq_card_desc strong { color: var(--aq-text); font-weight: 700; }

.aq_card_form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.aq_card_field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--aq-primary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.aq_card_field input {
    display: block;
    width: 100%;
    padding: 15px 18px;
    font-size: 16px;
    background: #f7f8fd;
    border: 1.5px solid var(--aq-border);
    border-radius: 12px;
    outline: none;
    color: var(--aq-text);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.aq_card_field input:focus {
    border-color: var(--aq-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(91,108,255,0.1);
}
.aq_card_field input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aq_otp_input {
    font-family: monospace !important;
    text-align: center;
    letter-spacing: 10px;
    font-size: 28px !important;
    font-weight: 800;
}

.aq_card_btn {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--aq-primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s, opacity 0.15s;
}
.aq_card_btn:hover:not(:disabled) { transform: translateY(-1px); }
.aq_card_btn:disabled { opacity: 0.5; cursor: not-allowed; }
.aq_card_btn_green { background: var(--aq-green); }

.aq_card_timer {
    margin-top: 14px;
    font-size: 13px;
    color: #d97706;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.aq_card_timer i { font-size: 16px; }

.aq_card_resend_btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    background: #f7f8fd;
    border: 1.5px solid var(--aq-border);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--aq-primary);
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}
.aq_card_resend_btn:hover:not(:disabled) {
    background: var(--aq-primary-lt);
    border-color: var(--aq-primary);
}
.aq_card_resend_btn:disabled { opacity: 0.5; cursor: not-allowed; }
.aq_card_resend_btn i { margin-right: 4px; }

/* 약관 동의 체크박스 */
.aq_agree_wrap {
    margin: 14px 0 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.aq_agree_item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #5e6580;
    cursor: pointer;
}
.aq_agree_item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--aq-primary, #5b6cff);
    flex-shrink: 0;
}
.aq_agree_link {
    color: var(--aq-primary, #5b6cff);
    font-size: 12px;
    text-decoration: none;
    font-weight: 600;
}
.aq_agree_link:hover { text-decoration: underline; }

/* 약관 팝업 */
.aq_terms_overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.aq_terms_modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.aq_terms_head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #f0f0f0;
}
.aq_terms_head strong { font-size: 16px; color: #1a1f3a; }
.aq_terms_close {
    background: none;
    border: none;
    font-size: 24px;
    color: #8b97b3;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.aq_terms_body {
    padding: 20px 24px;
    overflow-y: auto;
    font-size: 13px;
    color: #3a3f55;
    line-height: 1.7;
}
.aq_terms_body h4 {
    font-size: 14px;
    font-weight: 700;
    color: #1a1f3a;
    margin: 16px 0 6px;
}
.aq_terms_body h4:first-child { margin-top: 0; }
.aq_terms_body p { margin: 0 0 12px; }
.aq_terms_foot {
    padding: 14px 24px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}
.aq_terms_foot button {
    padding: 10px 40px;
    background: var(--aq-primary, #5b6cff);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.aq_card_error {
    margin-top: 12px;
    padding: 10px 16px;
    background: #fdecee;
    color: #9c2230;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    display: none;
}
.aq_card_error.show { display: block; }

/* ═══════════════ 하단 입력 ═══════════════ */

.aq_input_area {
    padding: 18px 28px 22px;
    background: var(--aq-surface);
    border-top: 1px solid var(--aq-border);
    flex-shrink: 0;
}
.aq_input_box {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 10px 10px 10px 20px;
    background: #f7f8fd;
    border: 2px solid var(--aq-border);
    border-radius: 28px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.aq_input_box:focus-within {
    border-color: var(--aq-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(91,108,255,0.08);
}
.aq_input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 16px;
    line-height: 1.6;
    color: var(--aq-text);
    outline: none;
    font-family: inherit;
    max-height: 140px;
    min-height: 24px;
    padding: 8px 0;
}
.aq_input::placeholder { color: var(--aq-text-mute); }
.aq_input:disabled { opacity: 0.5; }

.aq_send {
    width: 46px; height: 46px;
    flex-shrink: 0;
    background: var(--aq-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform 0.15s, background 0.15s;
}
.aq_send:hover:not(:disabled) { transform: scale(1.06); background: #4a5be6; }
.aq_send:disabled { opacity: 0.35; cursor: not-allowed; }

/* 모바일 온라인 점 */
.aq_online_dot {
    display: inline-block;
    width: 8px; height: 8px;
    background: var(--aq-green);
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

/* ═══════════════ 견적 팝업 오버레이 ═══════════════ */

.aq_loading_overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(10,14,46,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.aq_loading_overlay.show {
    opacity: 1;
    pointer-events: all;
}
.aq_loading_card {
    background: #fff;
    border-radius: 28px;
    padding: 48px 44px;
    max-width: 440px;
    width: 92%;
    text-align: center;
    box-shadow: 0 32px 64px -20px rgba(0,0,0,0.5);
}
.aq_loading_spinner {
    width: 52px; height: 52px;
    border: 5px solid var(--aq-primary-lt);
    border-top-color: var(--aq-primary);
    border-radius: 50%;
    animation: aqSpin 0.8s linear infinite;
    margin: 0 auto 24px;
}
@keyframes aqSpin { to { transform: rotate(360deg); } }

.aq_loading_title {
    font-size: 22px;
    font-weight: 800;
    color: var(--aq-text);
    margin: 0 0 10px;
}
.aq_loading_desc {
    font-size: 15px;
    color: var(--aq-text-sub);
    margin: 0 0 28px;
    line-height: 1.65;
    transition: opacity 0.3s;
}
.aq_loading_steps {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}
.aq_loading_steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #f7f8fd;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--aq-text-mute);
    transition: all 0.3s;
}
.aq_loading_steps li::before {
    content: '';
    width: 22px; height: 22px;
    flex-shrink: 0;
    border: 2px solid var(--aq-border);
    border-radius: 50%;
    transition: all 0.3s;
}
.aq_loading_steps li.active {
    color: var(--aq-primary);
    background: var(--aq-primary-lt);
}
.aq_loading_steps li.active::before {
    border-color: var(--aq-primary);
    background: var(--aq-primary-lt);
    box-shadow: inset 0 0 0 3px var(--aq-primary);
}
.aq_loading_steps li.done { color: var(--aq-green); }
.aq_loading_steps li.done::before {
    border-color: var(--aq-green);
    background: var(--aq-green);
}

/* ═══════════════ 견적서 보기 버튼 ═══════════════ */

.aq_header_finalize {
    padding: 10px 20px;
    background: var(--aq-green);
    color: #fff;
    border: none;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}
.aq_header_finalize:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--aq-border);
    color: var(--aq-text-mute);
}
.aq_header_finalize.ready {
    animation: aqFinalPulse 2s ease-in-out infinite;
}
@keyframes aqFinalPulse {
    0%,100% { box-shadow: 0 4px 12px -4px rgba(16,201,138,0.4); }
    50%     { box-shadow: 0 8px 20px -4px rgba(16,201,138,0.7); }
}

/* ═══════════════ 모바일 반응형 ═══════════════ */

@media (max-width: 768px) {
    .aq_side { display: none; }

    .aq_header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 18px;
        background: var(--aq-surface);
        border-bottom: 1px solid var(--aq-border);
        flex-shrink: 0;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    .aq_header_brand {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    .aq_header_avatar {
        width: 42px; height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #5b6cff, #a675ff);
        color: #fff;
        border-radius: 50%;
        font-size: 12px;
        font-weight: 900;
        flex-shrink: 0;
    }
    .aq_header_info strong {
        display: block;
        font-size: 15px;
        font-weight: 800;
        color: var(--aq-text);
    }
    .aq_header_info small {
        font-size: 12px;
        color: var(--aq-text-mute);
    }

    .aq_main { max-width: 100%; }

    .aq_messages {
        padding: 20px 16px 10px;
    }

    .aq_msg { gap: 8px; margin-bottom: 14px; }
    .aq_msg_avi { width: 36px; height: 36px; font-size: 11px; }
    .aq_msg_bubble {
        max-width: 82%;
        font-size: 15px;
        padding: 12px 16px;
        border-radius: 18px;
    }
    .aq_msg_card { max-width: 92%; }

    .aq_welcome { padding: 48px 18px 32px; }
    .aq_welcome_avi { width: 76px; height: 76px; }
    .aq_welcome_avi_inner { font-size: 22px; }
    .aq_welcome_status { width: 16px; height: 16px; }
    .aq_welcome_title { font-size: 22px; }
    .aq_welcome_desc { font-size: 15px; }
    .aq_welcome_hints li { font-size: 13px; padding: 8px 14px; }

    .aq_card_inner { padding: 22px; }
    .aq_card_field input { font-size: 16px; padding: 14px 16px; }
    .aq_otp_input { font-size: 24px !important; letter-spacing: 8px; }
    .aq_card_btn { font-size: 15px; padding: 15px; }
    .aq_card_resend_btn { font-size: 14px; padding: 13px; }

    .aq_input_area {
        padding: 12px 14px 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    .aq_input_box {
        padding: 8px 8px 8px 16px;
        border-radius: 24px;
    }
    .aq_input { font-size: 16px; }
    .aq_send { width: 42px; height: 42px; font-size: 18px; }

    .aq_loading_card { padding: 36px 28px; }
    .aq_loading_title { font-size: 19px; }
    .aq_loading_desc { font-size: 14px; }
    .aq_loading_steps li { font-size: 14px; padding: 12px 16px; }
}

@media (max-width: 380px) {
    .aq_msg_bubble { font-size: 14.5px; padding: 11px 14px; }
    .aq_msg_avi { width: 34px; height: 34px; }
    .aq_header_avatar { width: 38px; height: 38px; }
    .aq_header_info strong { font-size: 14px; }
    .aq_welcome_title { font-size: 20px; }
    .aq_welcome_avi { width: 68px; height: 68px; }
    .aq_card_inner { padding: 18px; }
    .aq_otp_input { font-size: 22px !important; letter-spacing: 6px; }
    .aq_input { font-size: 15px; }
    .aq_send { width: 40px; height: 40px; }
}
