/**
 * AI 상담사 전용 페이지 (퍼블리싱)
 * - 다크톤 카드형 채팅 UI
 * - 반응형 (모바일 세로 구조)
 */

/* ========== 메인 영역 ========== */
.ai-chat-page main.ai-chat-main {
    padding-top: 80px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    position: relative;
}

/* 준비중: 메인 영역 전체 블러 + 중앙 문구 */
.ai-chat-prep-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 1.5rem;
    pointer-events: auto;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.42);
}

body.prototype-03:not(.light-mode) .ai-chat-prep-overlay {
    background: rgba(12, 12, 16, 0.52);
}

.ai-chat-prep-overlay__text {
    margin: 0;
    font-size: clamp(1.5rem, 4.5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(0, 0, 0, 0.88);
    text-align: center;
}

body.prototype-03:not(.light-mode) .ai-chat-prep-overlay__text {
    color: rgba(255, 255, 255, 0.96);
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

/* ========== 상단 히어로 ========== */
.ai-chat-hero {
    padding: 5.5rem 20px 2.5rem;
    text-align: center;
}

.ai-chat-hero__inner {
    max-width: 720px;
    margin: 0 auto;
}

.ai-chat-hero__title {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    color: #000;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}

.ai-chat-hero__sub {
    font-size: 0.9375rem;
    color: rgba(0, 0, 0, 0.65);
    margin: 0;
}

/* ========== 메인 본문 (정보 카드 + 채팅) ========== */
.ai-chat-body {
    flex: 1;
    padding: 2rem 20px 3rem;
}

.ai-chat-wrap {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
}

/* ========== 왼쪽: AI 정보 카드 ========== */
.ai-chat-info {
    flex: 0 0 260px;
}

.ai-chat-info__card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 1.75rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-chat-info__card:hover {
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

.ai-chat-info__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, rgb(0 255 255 / 66%) 0%, rgb(169 0 255 / 28%) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-info__icon-inner {
    font-size: 1.25rem;
    font-weight: 700;
    color: #000;
    letter-spacing: -0.02em;
}

.ai-chat-info__name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #000;
    margin: 0 0 0.35rem;
    text-align: center;
}

.ai-chat-info__status {
    font-size: 0.8125rem;
    color: rgba(0, 0, 0, 0.6);
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.ai-chat-info__status-dot {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.ai-chat-info__desc {
    font-size: 0.8125rem;
    color: rgba(0, 0, 0, 0.6);
    line-height: 1.55;
    margin: 0;
    text-align: center;
}

/* ========== 오른쪽: 채팅 패널 ========== */
.ai-chat-panel {
    flex: 1;
    min-width: 0;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* 채팅 메시지 영역 (스크롤) */
.ai-chat-messages {
    flex: 1;
    min-height: 0; /* flex 자식이 줄어들어 overflow 스크롤 가능하도록 */
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

/* 말풍선 공통 */
.ai-chat-msg {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    max-width: 85%;
}

.ai-chat-msg--ai {
    align-self: flex-start;
}

.ai-chat-msg--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-chat-msg__avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgb(0 255 255 / 66%) 0%, rgb(169 0 255 / 28%) 100%);
    font-size: 0.7rem;
    font-weight: 700;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-msg__bubble {
    padding: 0.5rem 1rem;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ai-chat-msg--ai .ai-chat-msg__bubble {
    border-bottom-left-radius: 4px;
}

.ai-chat-msg--user .ai-chat-msg__bubble {
    background: rgb(0 197 197 / 22%);
    border-bottom-right-radius: 4px;
}

.ai-chat-msg__text {
    font-size: 0.9375rem;
    line-height: 1.5;
    margin: 0;
}

.ai-chat-msg--ai .ai-chat-msg__text {
    color: #000;
}

.ai-chat-msg--user .ai-chat-msg__text {
    color: #111;
}

/* 입력 영역 */
.ai-chat-input-wrap {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
}

.ai-chat-input-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    padding: 0.35rem 0.5rem 0.35rem 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-chat-input-inner:focus-within {
    border-color: rgba(0, 102, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.15);
}

.ai-chat-input-voice {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-chat-input-voice__icon {
    width: 18px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.4);
    border-radius: 50% 50% 0 0;
    border-bottom: none;
    position: relative;
    top: 2px;
}

.ai-chat-input-voice__icon::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -4px;
    transform: translateX(-50%);
    width: 6px;
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 0 0 3px 3px;
}

.ai-chat-input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 0.5rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #000;
    background: transparent;
    border: none;
}

.ai-chat-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.ai-chat-input:focus {
    outline: none;
}

.ai-chat-input-send {
    flex-shrink: 0;
    height: 38px;
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: #000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.ai-chat-input-send:hover {
    background: #333;
}

.ai-chat-input-send:active {
    opacity: 0.95;
}

/* ========== 대화 시뮬레이션 (chat-simulation) ========== */
.chat-simulation__quick-replies {
    padding: 0 1.25rem 0.75rem;
}

.chat-simulation__quick-replies-label {
    display: none;
}

.chat-simulation__quick-replies-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chat-simulation__keyword {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-family: inherit;
    color: rgba(0, 0, 0, 0.85);
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.chat-simulation__keyword:hover {
    border-color: rgba(0, 173, 159, 0.5);
    color: #ffffff;
    background: rgba(0, 173, 159, 0.5);
}

.chat-simulation__bubble {
    animation: chat-simulation-fade-in-up 0.35s ease-out forwards;
}

@keyframes chat-simulation-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-simulation__typing {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    padding: 0.5rem 0.5rem;
    min-height: 0.5rem;
}

.chat-simulation__typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    animation: chat-simulation-typing-dot 1.2s ease-in-out infinite;
}

.chat-simulation__typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-simulation__typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes chat-simulation-typing-dot {
    0%, 60%, 100% {
        opacity: 0.35;
        transform: scale(0.9);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

body.prototype-03.light-mode .chat-simulation__keyword {
    color: rgba(0, 0, 0, 0.85);
    border-color: rgba(0, 0, 0, 0.15);
}

body.prototype-03.light-mode .chat-simulation__keyword:hover {
    border-color: rgba(0, 102, 255, 0.5);
    color: #000;
    background: rgba(0, 102, 255, 0.08);
}

body.prototype-03.light-mode .chat-simulation__typing-dot {
    background: rgba(0, 0, 0, 0.5);
}

/* ========== 라이트 모드 ========== */
body.prototype-03.light-mode .ai-chat-main {
    background: #f5f5f5;
}

body.prototype-03.light-mode .ai-chat-prep-overlay {
    background: rgba(245, 245, 245, 0.5);
}

body.prototype-03.light-mode .ai-chat-hero {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

body.prototype-03.light-mode .ai-chat-hero__title {
    color: #000;
}

body.prototype-03.light-mode .ai-chat-hero__sub {
    color: rgba(0, 0, 0, 0.55);
}

body.prototype-03.light-mode .ai-chat-info__card {
    background: #fff;
}

body.prototype-03.light-mode .ai-chat-info__card:hover {
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

body.prototype-03.light-mode .ai-chat-info__icon {
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.12) 0%, rgba(0, 102, 255, 0.06) 100%);
}

body.prototype-03.light-mode .ai-chat-info__icon-inner {
    color: #000;
}

body.prototype-03.light-mode .ai-chat-info__name {
    color: #000;
}

body.prototype-03.light-mode .ai-chat-info__status {
    color: rgba(0, 0, 0, 0.55);
}

body.prototype-03.light-mode .ai-chat-info__desc {
    color: rgba(0, 0, 0, 0.6);
}

body.prototype-03.light-mode .ai-chat-panel {
    background: #fff;
}

body.prototype-03.light-mode .ai-chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
}

body.prototype-03.light-mode .ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

body.prototype-03.light-mode .ai-chat-msg__avatar {
    background: rgba(0, 102, 255, 0.12);
    border-color: rgba(0, 0, 0, 0.08);
    color: #000;
}

body.prototype-03.light-mode .ai-chat-msg--ai .ai-chat-msg__bubble {
    background: var(--color-main);
    border-color: rgba(0, 0, 0, 0.1);
}

body.prototype-03.light-mode .ai-chat-msg--ai .ai-chat-msg__text {
    color: #fff;
}

body.prototype-03.light-mode .ai-chat-msg--user .ai-chat-msg__bubble {
    background: rgba(0, 102, 255, 0.12);
    border-color: rgba(0, 102, 255, 0.2);
}

body.prototype-03.light-mode .ai-chat-msg--user .ai-chat-msg__text {
    color: #111;
}

body.prototype-03.light-mode .ai-chat-input-wrap {
    background: rgb(255, 255, 255);
}

body.prototype-03.light-mode .ai-chat-input-inner {
    border-color: rgba(0, 0, 0, 0.1);
}

body.prototype-03.light-mode .ai-chat-input-inner:focus-within {
    border-color: rgba(0, 102, 255, 0.4);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

body.prototype-03.light-mode .ai-chat-input-voice:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.prototype-03.light-mode .ai-chat-input-voice__icon {
    border-color: rgba(0, 0, 0, 0.4);
}

body.prototype-03.light-mode .ai-chat-input-voice__icon::after {
    background: rgba(0, 0, 0, 0.4);
}

body.prototype-03.light-mode .ai-chat-input {
    color: #000;
}

body.prototype-03.light-mode .ai-chat-input::placeholder {
    color: rgba(0, 0, 0, 0.35);
}

body.prototype-03.light-mode .ai-chat-input-send {
    color: #fff;
    background: #000;
}

body.prototype-03.light-mode .ai-chat-input-send:hover {
    background: #333;
}

/* ========== 반응형 ========== */
@media (max-width: 768px) {
    .ai-chat-hero {
        padding: 2rem 16px 1.75rem;
    }

    .ai-chat-body {
        padding: 1.5rem 16px 2rem;
    }

    .ai-chat-wrap {
        flex-direction: column;
        max-width: 100%;
    }

    .ai-chat-info {
        flex: none;
        width: 100%;
    }

    .ai-chat-info__card {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 1rem;
        padding: 1.25rem 1.25rem;
    }

    .ai-chat-info__icon {
        margin: 0;
        width: 52px;
        height: 52px;
    }

    .ai-chat-info__icon-inner {
        font-size: 1rem;
    }

    .ai-chat-info__name {
        flex: 1;
        text-align: left;
        margin: 0;
    }

    .ai-chat-info__status {
        width: 100%;
        justify-content: flex-start;
        margin: -0.5rem 0 0;
        order: 3;
    }

    .ai-chat-info__desc {
        width: 100%;
        order: 4;
        margin: 0.5rem 0 0;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .ai-chat-messages {
        min-height: 280px;
        max-height: 360px;
        padding: 1.25rem;
    }

    .ai-chat-msg {
        max-width: 92%;
    }

    .ai-chat-input-wrap {
        padding: 0.75rem 1rem 1rem;
    }
}

@media (max-width: 480px) {
    .ai-chat-hero__title {
        font-size: 1.5rem;
    }

    .ai-chat-hero__sub {
        font-size: 0.875rem;
    }

    .ai-chat-msg__bubble {
        padding: 0.6rem 0.875rem;
    }

    .ai-chat-msg__text {
        font-size: 0.875rem;
    }

    .ai-chat-input-send {
        padding: 0 0.875rem;
        font-size: 0.8125rem;
    }
}
