/* ===================================================
   입황성 챗봇 블랙톤 다크 테마 & PC/모바일 최적화 CSS
   =================================================== */

/* 플로팅 런처 버튼 */
#qh-chat-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #18181b;
    border: 2px solid #d4af37;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
}
#qh-chat-launcher:hover {
    transform: scale(1.08);
    border-color: #f59e0b;
}
#qh-chat-launcher img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
#qh-chat-launcher .qh-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #b45309;
    color: #fef08a;
    font-size: 9px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 8px;
    border: 1px solid #d4af37;
}

/* 챗봇 메인 위젯 (블랙 다크 모드) */
#qh-chat-widget {
    position: fixed;
    bottom: 95px;
    right: 30px;
    width: 410px;
    height: 600px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
    background: #09090b; /* 깊은 블랙 */
    border: 1px solid #27272a;
    border-radius: 16px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
#qh-chat-widget.qh-chat-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
}

/* 헤더 */
.qh-chat-header {
    background: #18181b;
    color: #f4f4f5;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #27272a;
}
.qh-header-title h3 {
    margin: 0;
    font-size: 1.05rem;
    color: #f4f4f5 !important;
    font-weight: 700;
}
.qh-header-title small {
    font-size: 0.8rem;
    color: #fbbf24;
}
.qh-header-title p {
    margin: 2px 0 0 0;
    font-size: 0.72rem;
    color: #a1a1aa !important;
}
.qh-close-btn {
    background: none;
    border: none;
    color: #a1a1aa;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}
.qh-close-btn:hover { color: #f4f4f5; }

/* 채팅창 영역 */
#qh-chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background-color: #09090b;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 스크롤바 디자인 (다크) */
#qh-chat-window::-webkit-scrollbar { width: 5px; }
#qh-chat-window::-webkit-scrollbar-track { background: #09090b; }
#qh-chat-window::-webkit-scrollbar-thumb { background: #27272a; border-radius: 4px; }

.qh-msg-container {
    display: flex;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 4px;
}
.qh-msg-container.user { justify-content: flex-end; }
.qh-bot-profile {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid #d4af37;
    object-fit: cover;
    flex-shrink: 0;
}

/* 💡 말풍선 & PC/모바일 텍스트 및 제목 크기 정밀 조정 */
.qh-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.84rem;
    line-height: 1.6;
    word-break: keep-all; /* 단어 단위 줄바꿈으로 PC에서 깨지는 현상 방지 */
    overflow-wrap: break-word;
}
.qh-msg.bot {
    background: #18181b;
    color: #e4e4e7;
    border: 1px solid #27272a;
    border-top-left-radius: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.qh-msg.user {
    background: #78350f;
    color: #fef3c7;
    border-top-right-radius: 2px;
    font-weight: 500;
}

/* 💡 마크다운 제목 크기 줄임 (PC 축소 최적화) */
.qh-msg h1, .qh-msg h2, .qh-msg h3, .qh-msg h4, .qh-msg h5 {
    font-size: 0.92rem !important;
    font-weight: 700 !important;
    color: #fbbf24 !important; /* 골드 포인트 */
    margin: 6px 0 4px 0 !important;
    padding-bottom: 3px;
    border-bottom: 1px solid #27272a;
    letter-spacing: -0.3px;
    line-height: 1.35;
    word-break: keep-all;
}
.qh-msg p { margin: 4px 0; }
.qh-msg ul, .qh-msg ol { padding-left: 18px; margin: 4px 0; }
.qh-msg li { margin-bottom: 3px; }

/* 💡 실시간 공지사항 박스 (다크 모드) */
#qh-live-news-box {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.qh-news-header {
    font-size: 0.76rem;
    font-weight: bold;
    color: #fbbf24;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px dashed #27272a;
}
.qh-news-loading, .qh-news-error {
    font-size: 0.74rem;
    color: #a1a1aa;
    text-align: center;
    padding: 6px 0;
}
.qh-news-list { display: flex; flex-direction: column; gap: 6px; }
.qh-news-item {
    display: flex;
    align-items: center;
    background: #09090b;
    border: 1px solid #27272a;
    border-radius: 6px;
    padding: 6px 8px;
    text-decoration: none !important;
    transition: all 0.2s ease;
}
.qh-news-item:hover {
    background: #27272a;
    border-color: #d4af37;
    transform: translateX(2px);
}
.qh-news-badge {
    font-size: 0.65rem;
    font-weight: bold;
    color: #ffffff;
    background: #78350f;
    padding: 1px 5px;
    border-radius: 8px;
    margin-right: 6px;
    white-space: nowrap;
}
.qh-news-badge.업데이트 { background: #0f766e; }
.qh-news-badge.이벤트 { background: #991b1b; }
.qh-news-date {
    font-size: 0.68rem;
    color: #34d399;
    font-weight: 600;
    margin-right: 6px;
    white-space: nowrap;
}
.qh-news-title {
    font-size: 0.76rem;
    color: #e4e4e7;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qh-news-link-icon {
    font-size: 0.7rem;
    color: #fbbf24;
    margin-left: 4px;
}

/* 2x2 카드형 퀵 버튼 섹션 (다크) */
.qh-quick-container {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px dashed #27272a;
}
.qh-quick-title {
    font-size: 0.74rem;
    font-weight: bold;
    color: #fbbf24;
    margin-bottom: 8px;
}
.qh-quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.qh-quick-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #18181b !important;
    border: 1px solid #27272a !important;
    border-radius: 10px !important;
    padding: 9px 11px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-align: left !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
    outline: none !important;
    width: 100% !important;
    margin: 0 !important;
}
.qh-quick-btn:hover {
    background: #27272a !important;
    border-color: #d4af37 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15) !important;
}
.qh-quick-icon { font-size: 1.05rem; margin-right: 6px; }
.qh-quick-text {
    font-size: 0.78rem;
    font-weight: 600;
    color: #f4f4f5;
    flex: 1;
}
.qh-quick-arrow {
    font-size: 0.75rem;
    color: #fbbf24;
    margin-left: 4px;
}

/* 💡 다크 모드 마크다운 표(Table) 서식 최적화 */
.qh-msg table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.74rem;
    background: #09090b;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #27272a;
}
.qh-msg th, .qh-msg td {
    border: 1px solid #27272a;
    padding: 6px 5px;
    text-align: center;
    word-break: keep-all;
}
.qh-msg th {
    background: #27272a;
    color: #fbbf24;
    font-weight: bold;
}
.qh-msg td {
    color: #e4e4e7;
}

/* 하단 가이드 버튼 스타일 */
.btn-container { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.link-btn {
    display: inline-block;
    padding: 7px 11px;
    font-weight: bold;
    text-decoration: none !important;
    border-radius: 6px;
    font-size: 11px;
    text-align: center;
    transition: opacity 0.2s;
}
.link-btn:hover { opacity: 0.85; }
.build-btn { background: #b45309; color: #fef08a !important; }
.guide-btn { background: #0f766e; color: #ccfbf1 !important; }

/* 모바일 모드 반응형 최적화 */
@media (max-width: 576px) {
    #qh-chat-widget {
        right: 12px;
        bottom: 80px;
        width: calc(100vw - 24px);
        height: 82vh;
    }
    #qh-chat-launcher { right: 15px; bottom: 15px; }
    .qh-quick-grid { grid-template-columns: 1fr; }
    .qh-msg { font-size: 0.82rem; }
}