/* Explain: Styles for the AI chat launcher button and conversation panel. */
/* 유스온 AI 정책 상담 창 — 우측 하단에 떠 있는 상담 버튼과 대화 패널.
   '맨 위로' 버튼·모바일 하단 고정 메뉴와 겹치지 않도록 세로로 쌓습니다. */

.ai-chat-launcher {
    position: fixed;
    right: 1.25rem;
    bottom: 5.5rem;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 3rem;
    border: 0;
    border-radius: 999px;
    background: var(--youthon-color);
    padding: 0 1.25rem;
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.4;
    box-shadow: 0 14px 32px rgba(36, 28, 75, 0.32);
    transition: transform 240ms ease, box-shadow 240ms ease, background 240ms ease;
}

.ai-chat-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(36, 28, 75, 0.42);
}

.ai-chat-launcher:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 3px;
}

.ai-chat-launcher.is-open {
    background: var(--youthon-dark);
}

.ai-chat-launcher-label {
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 대화 패널 */
.ai-chat-panel {
    position: fixed;
    right: 1.25rem;
    bottom: 9rem;
    z-index: 70;
    display: none;
    flex-direction: column;
    width: min(23rem, calc(100vw - 2.5rem));
    height: min(32rem, calc(100vh - 10rem));
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    background: #ffffff;
    box-shadow: 0 30px 70px rgba(15, 36, 68, 0.28);
}

.ai-chat-panel.is-open {
    display: flex;
}

.ai-chat-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
    padding: 0.9rem 1rem;
}

.ai-chat-head-icon {
    display: inline-flex;
    height: 2.5rem;
    width: 2.5rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    background: var(--youthon-color);
    color: #ffffff;
    font-size: 1rem;
}

.ai-chat-close {
    display: inline-flex;
    height: 2.5rem;
    width: 2.5rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text-color);
    transition: background 200ms ease;
}

.ai-chat-close:hover {
    background: var(--surface-color);
}

.ai-chat-close:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.ai-chat-messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    padding: 1rem;
}

.ai-chat-bubble {
    max-width: 88%;
    border-radius: 1.1rem;
    padding: 0.7rem 0.95rem;
    font-size: 0.875rem;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ai-chat-bubble-bot {
    align-self: flex-start;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 0.35rem;
    background: var(--surface-color);
    color: var(--text-color);
}

.ai-chat-bubble-user {
    align-self: flex-end;
    border-bottom-right-radius: 0.35rem;
    background: var(--youthon-color);
    color: #ffffff;
}

.ai-chat-typing {
    display: inline-flex;
    min-height: 2.4rem;
    align-items: center;
    gap: 0.3rem;
}

.ai-chat-typing span {
    height: 0.42rem;
    width: 0.42rem;
    border-radius: 999px;
    background: var(--text-muted);
    opacity: 0.4;
    animation: ai-chat-dot 1.1s ease-in-out infinite;
}

.ai-chat-typing span:nth-child(2) {
    animation-delay: 0.18s;
}

.ai-chat-typing span:nth-child(3) {
    animation-delay: 0.36s;
}

@keyframes ai-chat-dot {
    0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
    30% { opacity: 0.9; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    .ai-chat-typing span {
        animation: none;
    }
}

.ai-chat-suggest {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1rem 0;
}

.ai-chat-suggest.is-hidden {
    display: none;
}

.ai-chat-chip {
    display: inline-flex;
    min-height: 2.1rem;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #ffffff;
    padding: 0 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
    transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
}

.ai-chat-chip:hover {
    border-color: var(--youthon-color);
    background: var(--surface-color);
    color: var(--youthon-color);
}

.ai-chat-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

.ai-chat-input {
    min-width: 0;
    flex: 1;
    min-height: 2.75rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--surface-color);
    padding: 0 1rem;
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 200ms ease;
}

.ai-chat-input:focus {
    border-color: var(--youthon-color);
}

.ai-chat-input:disabled {
    opacity: 0.6;
}

.ai-chat-send {
    display: inline-flex;
    height: 2.75rem;
    width: 2.75rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--youthon-color);
    color: #ffffff;
    transition: opacity 200ms ease;
}

.ai-chat-send:disabled {
    opacity: 0.5;
}

.ai-chat-send:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.ai-chat-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
    padding: 0.65rem 1rem;
}

.ai-chat-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.6;
    transition: color 200ms ease;
}

.ai-chat-link:hover {
    color: var(--youthon-color);
}

@media (max-width: 767px) {
    /* 모바일 하단 고정 메뉴와 '맨 위로' 버튼 위로 쌓입니다. */
    .ai-chat-launcher {
        right: 1rem;
        bottom: 9rem;
        padding: 0 1rem;
    }

    .ai-chat-launcher-label {
        display: none;
    }

    .ai-chat-panel {
        right: 0.75rem;
        left: 0.75rem;
        bottom: 0.75rem;
        width: auto;
        height: min(30rem, 76vh);
    }
}