/* ==========================================================================
   noricamp AI 감성 채팅 위젯
   "진짜 감성은, 나를 아는 것"
   Bootstrap 5 dark theme 호환
   ========================================================================== */

/* ── 플로팅 버튼 — nc-scroll-top 과 나란히, 동일 사이즈 ─────────────────── */
#ncAiBtn {
    position: fixed;
    bottom: 28px;                          /* nc-scroll-top 과 동일 */
    right: 74px;                           /* 22px(scrollTop) + 44px + 8px gap */
    z-index: 1040;
    width: 44px;                           /* nc-scroll-top 과 동일 */
    height: 44px;
    border-radius: 50%;
    background: rgba(20, 29, 26, .85);     /* nc-scroll-top 과 동일 배경 */
    backdrop-filter: blur(10px);
    color: var(--nc-green-light, #74c69d);
    border: 1px solid var(--nc-border-lg, #2d4a38);
    box-shadow: var(--nc-shadow-lg, 0 4px 16px rgba(0,0,0,.4));
    font-size: 1.1rem;                     /* nc-scroll-top 과 동일 */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, border-color .2s, transform .2s;
}
#ncAiBtn:hover {
    background: var(--nc-green, #2d6a4f);
    color: #0a0e0d;
    border-color: var(--nc-green, #2d6a4f);
    transform: translateY(-3px);           /* nc-scroll-top 과 동일 hover */
}
#ncAiBtn .nc-ai-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #d4a843;
    border-radius: 50%;
    border: 2px solid #1a1a1a;
    animation: nc-pulse 2s infinite;
}
@keyframes nc-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .6; transform: scale(1.2); }
}

/* ── 채팅 패널 ───────────────────────────────────────────────────────────── */
#ncAiPanel {
    position: fixed;
    bottom: 80px;                          /* 버튼(28+44) + 8px 여백 */
    right: 22px;                           /* 화면 우측 기준 */
    z-index: 1039;
    width: 360px;
    max-height: 520px;
    background: #1e2a24;
    border: 1px solid #2d4a38;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* 초기 상태: 숨김 */
    opacity: 0;
    transform: translateY(12px) scale(.97);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}
#ncAiPanel.nc-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* 모바일 */
@media (max-width: 480px) {
    #ncAiPanel {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 80px;
        max-height: 60vh;
    }
    #ncAiBtn {
        right: 68px;                       /* 모바일: scroll-top 우측 간격 조정 */
        bottom: 28px;
    }
}

/* ── 패널 헤더 ───────────────────────────────────────────────────────────── */
.nc-ai-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 12px;
    background: linear-gradient(90deg, #1a3328, #1e2a24);
    border-bottom: 1px solid #2d4a38;
    flex-shrink: 0;
}
.nc-ai-header-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2d6a4f, #40916c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    color: #fff;
    flex-shrink: 0;
}
.nc-ai-header-text {
    flex: 1;
    min-width: 0;
}
.nc-ai-header-title {
    font-size: .82rem;
    font-weight: 600;
    color: #b7e4c7;
    line-height: 1.2;
}
.nc-ai-header-sub {
    font-size: .7rem;
    color: #74c69d;
    opacity: .8;
}
.nc-ai-close {
    background: none;
    border: none;
    color: #74c69d;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    opacity: .7;
    transition: opacity .15s;
}
.nc-ai-close:hover { opacity: 1; }

/* ── 메시지 영역 ─────────────────────────────────────────────────────────── */
.nc-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.nc-ai-messages::-webkit-scrollbar { width: 4px; }
.nc-ai-messages::-webkit-scrollbar-track { background: transparent; }
.nc-ai-messages::-webkit-scrollbar-thumb { background: #2d6a4f; border-radius: 4px; }

/* ── 메시지 버블 ─────────────────────────────────────────────────────────── */
.nc-msg {
    max-width: 86%;
    line-height: 1.5;
    font-size: .82rem;
    animation: nc-msg-in .18s ease;
}
@keyframes nc-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.nc-msg-ai {
    align-self: flex-start;
}
.nc-msg-ai .nc-msg-bubble {
    background: #243b2f;
    color: #d8f3dc;
    border-radius: 4px 14px 14px 14px;
    padding: 9px 12px;
}
.nc-msg-user {
    align-self: flex-end;
}
.nc-msg-user .nc-msg-bubble {
    background: #2d6a4f;
    color: #fff;
    border-radius: 14px 4px 14px 14px;
    padding: 9px 12px;
}

/* ── 타이핑 인디케이터 ───────────────────────────────────────────────────── */
.nc-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #243b2f;
    border-radius: 4px 14px 14px 14px;
}
.nc-typing span {
    width: 6px;
    height: 6px;
    background: #74c69d;
    border-radius: 50%;
    animation: nc-dot .9s infinite;
}
.nc-typing span:nth-child(2) { animation-delay: .15s; }
.nc-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes nc-dot {
    0%, 80%, 100% { transform: scale(.7); opacity: .5; }
    40%           { transform: scale(1);  opacity: 1; }
}

/* ── 캠핑장 추천 카드 ────────────────────────────────────────────────────── */
.nc-camp-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}
.nc-camp-card {
    display: flex;
    gap: 10px;
    background: #1a3328;
    border: 1px solid #2d4a38;
    border-radius: 10px;
    padding: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, background .15s;
    cursor: pointer;
}
.nc-camp-card:hover {
    border-color: #40916c;
    background: #1e3d2f;
    color: inherit;
    text-decoration: none;
}
.nc-camp-card-img {
    width: 52px;
    height: 52px;
    border-radius: 7px;
    object-fit: cover;
    flex-shrink: 0;
    background: #243b2f;
}
.nc-camp-card-img.nc-no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #40916c;
    font-size: 1.2rem;
}
.nc-camp-card-body {
    flex: 1;
    min-width: 0;
}
.nc-camp-card-name {
    font-size: .8rem;
    font-weight: 600;
    color: #b7e4c7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nc-camp-card-addr {
    font-size: .7rem;
    color: #74c69d;
    opacity: .8;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nc-camp-card-mood {
    display: inline-block;
    margin-top: 4px;
    font-size: .65rem;
    color: #d4a843;
    background: rgba(212,168,67,.12);
    border-radius: 4px;
    padding: 1px 5px;
}

/* ── 입력 영역 ───────────────────────────────────────────────────────────── */
.nc-ai-input-wrap {
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid #2d4a38;
    flex-shrink: 0;
    background: #1a2820;
}
.nc-ai-input {
    flex: 1;
    background: #243b2f;
    border: 1px solid #2d4a38;
    border-radius: 20px;
    color: #d8f3dc;
    font-size: .82rem;
    padding: 8px 14px;
    outline: none;
    resize: none;
    line-height: 1.4;
    max-height: 80px;
    overflow-y: auto;
    transition: border-color .15s;
}
.nc-ai-input::placeholder { color: #4d7a60; }
.nc-ai-input:focus { border-color: #40916c; }

.nc-ai-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2d6a4f;
    border: none;
    color: #fff;
    font-size: .9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: flex-end;
    transition: background .15s, transform .1s;
}
.nc-ai-send:hover:not(:disabled) { background: #40916c; transform: scale(1.05); }
.nc-ai-send:disabled { opacity: .4; cursor: not-allowed; }
