/* NMT PMU LLM Chatbot - 완전 재작성된 CSS */

/* CSS 변수 정의 */
:root {
    --nmt-primary-color: #007cba;
    --nmt-primary-hover: #005a87;
    --nmt-bg-light: #f9f9f9;
    --nmt-bg-white: #ffffff;
    --nmt-border-color: #e1e5e9;
    --nmt-text-color: #333333;
    --nmt-text-light: #666666;
    --nmt-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --nmt-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.15);
    --nmt-border-radius: 16px;
    --nmt-border-radius-small: 8px;
    --nmt-transition: all 0.3s ease;
    --nmt-z-index: 2147483647;
    
    /* 모바일 뷰포트 높이 변수 */
    --mobile-vh: 1vh;
}

/* 기본 리셋 및 컨테이너 - 인라인 CSS와 일치하도록 수정 */
.nmt-chatbot-container,
#nmt-chatbot-container {
    position: fixed !important;
    z-index: 2147483647 !important;
    bottom: 24px !important;
    right: 24px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans CJK KR', 'Noto Sans CJK JP', 'Malgun Gothic', 'Yu Gothic', sans-serif !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    color: #333 !important;
    direction: ltr !important;
    text-align: left !important;
}

.nmt-chatbot-container *,
#nmt-chatbot-container * {
    box-sizing: border-box !important;
}

/* 위치 클래스 */
.nmt-chatbot-container.position-bottom-right,
#nmt-chatbot-container.position-bottom-right {
    bottom: 24px !important;
    right: 24px !important;
}

.nmt-chatbot-container.position-bottom-left,
#nmt-chatbot-container.position-bottom-left {
    bottom: 24px !important;
    left: 24px !important;
}

.nmt-chatbot-container.position-top-right,
#nmt-chatbot-container.position-top-right {
    top: 24px !important;
    right: 24px !important;
}

.nmt-chatbot-container.position-top-left,
#nmt-chatbot-container.position-top-left {
    top: 24px !important;
    left: 24px !important;
}

/* 챗봇 토글 버튼 - 인라인 CSS와 일치 */
.nmt-chatbot-toggle,
#nmt-chatbot-toggle {
    width: 64px !important;
    height: 64px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #007cba, #005a87) !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 20px rgba(0, 124, 186, 0.3) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    margin: 0 !important;
    padding: 0 !important;
    outline: none !important;
}

.nmt-chatbot-toggle:hover,
#nmt-chatbot-toggle:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 6px 25px rgba(0, 124, 186, 0.4) !important;
}

.nmt-chatbot-toggle:active,
#nmt-chatbot-toggle:active {
    transform: scale(0.95) !important;
}

.nmt-chatbot-toggle:focus,
#nmt-chatbot-toggle:focus {
    outline: 2px solid #007cba !important;
    outline-offset: 2px !important;
}

/* 캐릭터 이미지 */
.chatbot-character {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* 챗봇 위젯 - 인라인 CSS와 일치 */
.nmt-chatbot-widget,
#nmt-chatbot-widget {
    position: absolute !important;
    bottom: 80px !important;
    right: 0 !important;
    width: 380px !important;
    height: 550px !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid #e1e5e9 !important;
    display: none !important;
    flex-direction: column !important;
    overflow: hidden !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(10px) !important;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease !important;
}

.nmt-chatbot-widget.open,
#nmt-chatbot-widget.open {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* 헤더 */
.nmt-chatbot-header {
    background: var(--nmt-primary-color) !important;
    color: white !important;
    padding: 16px 20px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-radius: var(--nmt-border-radius) var(--nmt-border-radius) 0 0 !important;
    flex-shrink: 0 !important;
}

.nmt-chatbot-header h3 {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
}

.nmt-chatbot-header-controls {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

#nmt-chatbot-settings,
.nmt-chatbot-close,
#nmt-chatbot-close {
    background: none !important;
    border: none !important;
    color: white !important;
    cursor: pointer !important;
    padding: 0 !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
    transition: background-color 0.2s ease !important;
}

#nmt-chatbot-settings {
    font-size: 20px !important;
}

.nmt-chatbot-close,
#nmt-chatbot-close {
    font-size: 24px !important;
}

#nmt-chatbot-settings:hover,
.nmt-chatbot-close:hover,
#nmt-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

#nmt-chatbot-settings:focus,
.nmt-chatbot-close:focus,
#nmt-chatbot-close:focus {
    outline: 2px solid white !important;
    outline-offset: 2px !important;
}

/* 설정 패널 */
.nmt-chatbot-settings-panel {
    background: var(--nmt-bg-white) !important;
    border-bottom: 1px solid var(--nmt-border-color) !important;
    padding: 20px !important;
    flex-shrink: 0 !important;
    max-height: 300px !important;
    overflow-y: auto !important;
}

.settings-section {
    margin-bottom: 24px !important;
}

.settings-section:last-child {
    margin-bottom: 0 !important;
}

.settings-section h4 {
    margin: 0 0 12px 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--nmt-text-color) !important;
}

.setting-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.setting-label {
    font-size: 14px !important;
    color: var(--nmt-text-color) !important;
}

/* 토글 스위치 */
.toggle-switch {
    position: relative !important;
    display: inline-block !important;
    width: 44px !important;
    height: 24px !important;
}

.toggle-switch input {
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

.toggle-slider {
    position: absolute !important;
    cursor: pointer !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: #ccc !important;
    transition: 0.3s !important;
    border-radius: 24px !important;
}

.toggle-slider:before {
    position: absolute !important;
    content: "" !important;
    height: 18px !important;
    width: 18px !important;
    left: 3px !important;
    bottom: 3px !important;
    background-color: white !important;
    transition: 0.3s !important;
    border-radius: 50% !important;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--nmt-primary-color) !important;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px) !important;
}

/* 위치 설정 그리드 */
.position-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    max-width: 120px !important;
}

.position-btn {
    width: 50px !important;
    height: 50px !important;
    border: 2px solid var(--nmt-border-color) !important;
    border-radius: 8px !important;
    background: var(--nmt-bg-white) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    position: relative !important;
}

.position-btn:hover {
    border-color: var(--nmt-primary-color) !important;
    background: rgba(0, 124, 186, 0.05) !important;
}

.position-btn.active {
    border-color: var(--nmt-primary-color) !important;
    background: var(--nmt-primary-color) !important;
}

.position-indicator {
    width: 20px !important;
    height: 20px !important;
    border-radius: 4px !important;
    background: var(--nmt-text-light) !important;
    transition: background-color 0.2s ease !important;
}

.position-btn.active .position-indicator {
    background: white !important;
}

.position-indicator.top-left {
    position: absolute !important;
    top: 6px !important;
    left: 6px !important;
}

.position-indicator.top-right {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
}

.position-indicator.bottom-left {
    position: absolute !important;
    bottom: 6px !important;
    left: 6px !important;
}

.position-indicator.bottom-right {
    position: absolute !important;
    bottom: 6px !important;
    right: 6px !important;
}

/* 다크 모드 스타일 - 챗봇 위젯 전체 */
.nmt-chatbot-widget.dark-theme {
    background: #2d3748 !important;
    border-color: #4a5568 !important;
}

/* 다크 모드 - 헤더 */
.nmt-chatbot-widget.dark-theme .nmt-chatbot-header {
    background: #1a202c !important;
}

/* 다크 모드 - 설정 패널 */
.nmt-chatbot-widget.dark-theme .nmt-chatbot-settings-panel {
    background: #2d3748 !important;
    border-color: #4a5568 !important;
}

.nmt-chatbot-widget.dark-theme .settings-section h4 {
    color: #e2e8f0 !important;
}

.nmt-chatbot-widget.dark-theme .setting-label {
    color: #e2e8f0 !important;
}

.nmt-chatbot-widget.dark-theme .position-btn {
    background: #1a202c !important;
    border-color: #4a5568 !important;
}

.nmt-chatbot-widget.dark-theme .position-btn:hover {
    background: rgba(0, 124, 186, 0.1) !important;
}

.nmt-chatbot-widget.dark-theme .position-indicator {
    background: #a0aec0 !important;
}

.nmt-chatbot-widget.dark-theme .toggle-slider {
    background-color: #4a5568 !important;
}

.nmt-chatbot-widget.dark-theme .toggle-switch input:checked + .toggle-slider {
    background-color: var(--nmt-primary-color) !important;
}

/* 다크 모드 - 메시지 영역 */
.nmt-chatbot-widget.dark-theme .nmt-chatbot-messages {
    background: #1a202c !important;
}

.nmt-chatbot-widget.dark-theme .nmt-chatbot-message-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important;
}

.nmt-chatbot-widget.dark-theme .nmt-chatbot-message.user .nmt-chatbot-message-content {
    background: var(--nmt-primary-color) !important;
    color: white !important;
}

.nmt-chatbot-widget.dark-theme .nmt-chatbot-message-time {
    color: #a0aec0 !important;
}

/* 다크 모드 - 입력 영역 */
.nmt-chatbot-widget.dark-theme .nmt-chatbot-input {
    background: #2d3748 !important;
    border-color: #4a5568 !important;
}

.nmt-chatbot-widget.dark-theme #nmt-chatbot-input {
    background: #1a202c !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

.nmt-chatbot-widget.dark-theme #nmt-chatbot-input::placeholder {
    color: #a0aec0 !important;
}

.nmt-chatbot-widget.dark-theme #nmt-chatbot-input:focus {
    border-color: var(--nmt-primary-color) !important;
}

/* 다크 모드 - 타이핑 인디케이터 */
.nmt-chatbot-widget.dark-theme .nmt-chatbot-typing-dot {
    background: #a0aec0 !important;
}

/* 다크 모드 - 에러 메시지 */
.nmt-chatbot-widget.dark-theme .nmt-chatbot-message-content.error {
    background: #742a2a !important;
    color: #feb2b2 !important;
    border-left: 4px solid #fc8181 !important;
}

/* 다크 모드 - 소스 정보 */
.nmt-chatbot-widget.dark-theme .sources-info {
    border-top-color: #4a5568 !important;
}

.nmt-chatbot-widget.dark-theme .sources-info strong {
    color: #e2e8f0 !important;
}

/* 다크 모드 - 추천 질문 */
.nmt-chatbot-widget.dark-theme .nmt-chatbot-suggestions {
    background: #2d3748 !important;
    border-color: #4a5568 !important;
}

.nmt-chatbot-widget.dark-theme .suggestion-button {
    background: #1a202c !important;
    border-color: #4a5568 !important;
    color: #e2e8f0 !important;
}

.nmt-chatbot-widget.dark-theme .suggestion-button:hover {
    background: var(--nmt-primary-color) !important;
    color: white !important;
    border-color: var(--nmt-primary-color) !important;
}

/* 다크 모드 - 스크롤바 */
.nmt-chatbot-widget.dark-theme .nmt-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2) !important;
}

.nmt-chatbot-widget.dark-theme .nmt-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

/* 다크 모드 - 복사 버튼 */
.nmt-chatbot-widget.dark-theme .nmt-message-copy-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #a0aec0 !important;
}

.nmt-chatbot-widget.dark-theme .nmt-message-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #e2e8f0 !important;
}

/* 시스템 다크 모드 자동 감지에서도 설정 패널 적용 */
@media (prefers-color-scheme: dark) {
    .nmt-chatbot-settings-panel {
        background: #2d3748 !important;
        border-color: #4a5568 !important;
    }
    
    .settings-section h4 {
        color: #e2e8f0 !important;
    }
    
    .setting-label {
        color: #e2e8f0 !important;
    }
    
    .position-btn {
        background: #1a202c !important;
        border-color: #4a5568 !important;
    }
    
    .position-btn:hover {
        background: rgba(0, 124, 186, 0.1) !important;
    }
    
    .position-indicator {
        background: #a0aec0 !important;
    }
    
    .toggle-slider {
        background-color: #4a5568 !important;
    }
}

/* 설정 패널 애니메이션 */
.nmt-chatbot-settings-panel {
    transform: translateY(-10px) !important;
    opacity: 0 !important;
    transition: all 0.3s ease !important;
}

.nmt-chatbot-settings-panel.show {
    transform: translateY(0) !important;
    opacity: 1 !important;
}

/* 메시지 영역 */
.nmt-chatbot-messages {
    flex: 1 !important;
    padding: 20px !important;
    overflow-y: auto !important;
    background: var(--nmt-bg-light) !important;
    -webkit-overflow-scrolling: touch !important;
    min-height: 0 !important;
}

.nmt-chatbot-message {
    margin-bottom: 16px !important;
    animation: fadeInUp 0.3s ease-out !important;
}

.nmt-chatbot-message-content {
    background: var(--nmt-bg-white) !important;
    padding: 12px 16px !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    word-wrap: break-word !important;
    position: relative !important;
}

.nmt-chatbot-message.user .nmt-chatbot-message-content {
    background: var(--nmt-primary-color) !important;
    color: white !important;
    margin-left: 20% !important;
}

.nmt-chatbot-message-time {
    font-size: 11px !important;
    color: var(--nmt-text-light) !important;
    margin-top: 4px !important;
    text-align: right !important;
}

.nmt-chatbot-message.user .nmt-chatbot-message-time {
    text-align: right !important;
}

/* 입력 영역 */
.nmt-chatbot-input {
    padding: 16px 20px !important;
    border-top: 1px solid var(--nmt-border-color) !important;
    background: var(--nmt-bg-white) !important;
    border-radius: 0 0 var(--nmt-border-radius) var(--nmt-border-radius) !important;
    flex-shrink: 0 !important;
}

.nmt-chatbot-input-wrapper {
    display: flex !important;
    gap: 10px !important;
    align-items: center !important;
}

#nmt-chatbot-input {
    flex: 1 !important;
    padding: 12px 16px !important;
    border: 1px solid var(--nmt-border-color) !important;
    border-radius: 25px !important;
    font-size: 14px !important;
    outline: none !important;
    transition: border-color 0.3s ease !important;
    font-family: inherit !important;
    background: var(--nmt-bg-white) !important;
    color: var(--nmt-text-color) !important;
}

#nmt-chatbot-input:focus {
    border-color: var(--nmt-primary-color) !important;
    outline: 2px solid var(--nmt-primary-color) !important;
    outline-offset: 2px !important;
}

#nmt-chatbot-send {
    background: var(--nmt-primary-color) !important;
    color: white !important;
    border: none !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.3s ease !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

#nmt-chatbot-send:hover {
    background: var(--nmt-primary-hover) !important;
}

#nmt-chatbot-send:disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
}

#nmt-chatbot-send:focus {
    outline: 2px solid var(--nmt-primary-color) !important;
    outline-offset: 2px !important;
}

/* 타이핑 인디케이터 */
.nmt-chatbot-typing {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 8px 0 !important;
}

.nmt-chatbot-typing-dot {
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    background: var(--nmt-text-light) !important;
    animation: nmt-typing-bounce 1.4s infinite ease-in-out !important;
}

.nmt-chatbot-typing-dot:nth-child(1) { 
    animation-delay: -0.32s !important; 
}

.nmt-chatbot-typing-dot:nth-child(2) { 
    animation-delay: -0.16s !important; 
}

@keyframes nmt-typing-bounce {
    0%, 80%, 100% { 
        transform: scale(0.8) !important; 
        opacity: 0.5 !important; 
    }
    40% { 
        transform: scale(1) !important; 
        opacity: 1 !important; 
    }
}

/* 애니메이션 */
@keyframes fadeInUp {
    from {
        opacity: 0 !important;
        transform: translateY(10px) !important;
    }
    to {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }
}

/* 스크롤바 스타일 */
.nmt-chatbot-messages::-webkit-scrollbar {
    width: 6px !important;
}

.nmt-chatbot-messages::-webkit-scrollbar-track {
    background: transparent !important;
}

.nmt-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2) !important;
    border-radius: 3px !important;
}

.nmt-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3) !important;
}

/* 에러 메시지 스타일 */
.nmt-chatbot-message-content.error {
    background: #fed7d7 !important;
    color: #c53030 !important;
    border-left: 4px solid #e53e3e !important;
}

/* 소스 정보 스타일 */
.sources-info {
    margin-top: 12px !important;
    padding-top: 12px !important;
    border-top: 1px solid #e2e8f0 !important;
    font-size: 12px !important;
}

.sources-info strong {
    color: #4a5568 !important;
    font-weight: 600 !important;
}

.sources-info ul {
    margin: 8px 0 0 0 !important;
    padding-left: 16px !important;
}

.sources-info li {
    margin-bottom: 4px !important;
}

.sources-info a {
    color: var(--nmt-primary-color) !important;
    text-decoration: none !important;
}

.sources-info a:hover {
    text-decoration: underline !important;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    /* 컨테이너 위치 조정 */
    #nmt-chatbot-container {
        bottom: 20px !important;
        right: 20px !important;
        left: 20px !important;
    }
    
    #nmt-chatbot-container.position-bottom-right,
    #nmt-chatbot-container.position-bottom-left,
    #nmt-chatbot-container.position-top-right,
    #nmt-chatbot-container.position-top-left {
        bottom: 20px !important;
        right: 20px !important;
        left: 20px !important;
        top: auto !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    /* 토글 버튼 크기 조정 */
    #nmt-chatbot-toggle {
        width: 56px !important;
        height: 56px !important;
    }
    
    /* 위젯 전체 화면 모드 */
    #nmt-chatbot-widget {
        position: fixed !important;
        top: 20px !important;
        left: 15px !important;
        right: 15px !important;
        bottom: 80px !important;
        width: auto !important;
        height: auto !important;
        border-radius: 12px !important;
        max-height: calc(100 * var(--mobile-vh, 1vh) - 100px) !important;
    }
    
    /* 키보드 표시 시 조정 */
    #nmt-chatbot-widget.keyboard-visible {
        height: calc(100 * var(--mobile-vh, 1vh) - 140px) !important;
        max-height: calc(100 * var(--mobile-vh, 1vh) - 140px) !important;
        bottom: 90px !important;
    }
    
    /* 입력 필드 iOS 줌 방지 */
    #nmt-chatbot-input {
        font-size: 16px !important;
    }
    
    /* 헤더 패딩 조정 */
    .nmt-chatbot-header {
        padding: 14px 16px !important;
    }
    
    /* 입력 영역 패딩 조정 */
    .nmt-chatbot-input {
        padding: 14px 16px !important;
    }
    
    /* 메시지 영역 패딩 조정 */
    .nmt-chatbot-messages {
        padding: 16px !important;
    }
    
    /* 터치 타겟 크기 보장 */
    #nmt-chatbot-close,
    #nmt-chatbot-send {
        min-width: 44px !important;
        min-height: 44px !important;
    }
}

/* 가로 모드 최적화 */
@media (max-width: 768px) and (orientation: landscape) {
    #nmt-chatbot-widget {
        height: calc(100 * var(--mobile-vh, 1vh) - 80px) !important;
        max-height: calc(100 * var(--mobile-vh, 1vh) - 80px) !important;
        top: 10px !important;
        bottom: 70px !important;
    }
    
    #nmt-chatbot-widget.keyboard-visible {
        height: calc(100 * var(--mobile-vh, 1vh) - 120px) !important;
        max-height: calc(100 * var(--mobile-vh, 1vh) - 120px) !important;
    }
    
    .nmt-chatbot-header {
        padding: 12px 16px !important;
    }
    
    .nmt-chatbot-input {
        padding: 12px 16px !important;
    }
}

/* 사파리 최적화 */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        #nmt-chatbot-widget {
            height: calc(100vh - 120px) !important;
            max-height: calc(100vh - 120px) !important;
            bottom: 90px !important;
        }
        
        #nmt-chatbot-widget.keyboard-visible {
            height: calc(100vh - 160px) !important;
            max-height: calc(100vh - 160px) !important;
            bottom: 100px !important;
        }
    }
}

/* 작은 화면 (iPhone SE 등) */
@media (max-width: 375px) {
    #nmt-chatbot-widget {
        left: 10px !important;
        right: 10px !important;
        top: 15px !important;
        bottom: 75px !important;
    }
    
    .nmt-chatbot-header {
        padding: 12px 14px !important;
    }
    
    .nmt-chatbot-input {
        padding: 12px 14px !important;
    }
    
    .nmt-chatbot-messages {
        padding: 14px !important;
    }
}

/* 큰 화면 최적화 */
@media (min-width: 1200px) {
    #nmt-chatbot-widget {
        width: 420px !important;
        height: 600px !important;
    }
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    :root {
        --nmt-bg-light: #1a202c;
        --nmt-bg-white: #2d3748;
        --nmt-border-color: #4a5568;
        --nmt-text-color: #e2e8f0;
        --nmt-text-light: #a0aec0;
    }
    
    .nmt-chatbot-messages::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2) !important;
    }
    
    .nmt-chatbot-messages::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3) !important;
    }
    
    .nmt-chatbot-message-content.error {
        background: #742a2a !important;
        color: #feb2b2 !important;
        border-left: 4px solid #fc8181 !important;
    }
    
    .sources-info {
        border-top-color: #4a5568 !important;
    }
    
    .sources-info strong {
        color: #e2e8f0 !important;
    }
    
    #nmt-chatbot-input::placeholder {
        color: #a0aec0 !important;
    }
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
    #nmt-chatbot-widget {
        border: 2px solid #000 !important;
    }
    
    .nmt-chatbot-message-content {
        border: 1px solid #000 !important;
    }
    
    #nmt-chatbot-input {
        border: 2px solid #000 !important;
    }
}

/* 성능 최적화 */
#nmt-chatbot-widget * {
    will-change: auto !important;
}

#nmt-chatbot-widget.open {
    will-change: transform, opacity !important;
}

.nmt-chatbot-messages {
    contain: layout style paint !important;
}

/* 추천 질문 스타일 */
.nmt-chatbot-suggestions {
    padding: 16px 20px !important;
    border-bottom: 1px solid var(--nmt-border-color) !important;
    background: var(--nmt-bg-white) !important;
    flex-shrink: 0 !important;
}

.suggestion-buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.suggestion-button {
    background: var(--nmt-bg-light) !important;
    border: 1px solid var(--nmt-border-color) !important;
    color: var(--nmt-text-color) !important;
    padding: 8px 12px !important;
    border-radius: 16px !important;
    font-size: 13px !important;
    cursor: pointer !important;
    transition: var(--nmt-transition) !important;
    white-space: nowrap !important;
}

.suggestion-button:hover {
    background: var(--nmt-primary-color) !important;
    color: white !important;
    border-color: var(--nmt-primary-color) !important;
}

/* 모바일에서 추천 질문 */
@media (max-width: 768px) {
    .nmt-chatbot-suggestions {
        padding: 12px 16px !important;
    }
    
    .suggestion-button {
        font-size: 12px !important;
        padding: 6px 10px !important;
    }
}

/* 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 포커스 표시 개선 */
#nmt-chatbot-container:focus-within #nmt-chatbot-toggle {
    outline: 2px solid var(--nmt-primary-color) !important;
    outline-offset: 2px !important;
}

/* 로딩 상태 */
.nmt-chatbot-loading {
    opacity: 0.7 !important;
    pointer-events: none !important;
}

/* 연결 상태 표시 */
.nmt-chatbot-offline {
    filter: grayscale(1) !important;
    opacity: 0.6 !important;
}

.nmt-chatbot-offline::after {
    content: '오프라인' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
}


/* 메시지 복사 기능 - 기본적으로 숨김 */
.nmt-message-copy-btn {
    display: none !important;
}

/* 데스크톱에서만 복사 버튼 표시 */
@media (min-width: 769px) {
    .nmt-message-copy-btn {
        position: absolute !important;
        top: 8px !important;
        right: 8px !important;
        background: rgba(0, 0, 0, 0.1) !important;
        border: none !important;
        border-radius: 4px !important;
        width: 24px !important;
        height: 24px !important;
        display: none !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        opacity: 0 !important;
        transition: all 0.2s ease !important;
        color: var(--nmt-text-light) !important;
        z-index: 10 !important;
    }

    .nmt-chatbot-message:hover .nmt-message-copy-btn {
        display: flex !important;
        opacity: 1 !important;
    }

    .nmt-message-copy-btn:hover {
        background: rgba(0, 0, 0, 0.2) !important;
        color: var(--nmt-text-color) !important;
    }

    .nmt-message-copy-btn.copied {
        background: #28a745 !important;
        color: white !important;
        opacity: 1 !important;
        display: flex !important;
    }

    /* 다크 모드에서 복사 버튼 */
    @media (prefers-color-scheme: dark) {
        .nmt-message-copy-btn {
            background: rgba(255, 255, 255, 0.1) !important;
            color: #a0aec0 !important;
        }
        
        .nmt-message-copy-btn:hover {
            background: rgba(255, 255, 255, 0.2) !important;
            color: #e2e8f0 !important;
        }
    }
}
