/* 한남대학교 RAG 챗봇 시스템 스타일시트 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mini-header {
    background: white;
    color: #34495e;
    padding: 0.4rem 1rem;
    box-shadow: 0 1px 5px rgba(52, 73, 94, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
}

.ai-text {
    color: #8B0000;
}

/* 베타 테스트 안내 스타일 */
.beta-warning-simple {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #ffc107;
    border-left: 4px solid #ff6b35;
    margin: 0;
    padding: 10px 15px;
    font-size: 0.7rem;
    line-height: 1.4;
    color: #856404;
    font-weight: 500;
}

/* 모바일에서 더 작은 폰트 */
@media (max-width: 768px) {
    .beta-warning-simple {
        font-size: 0.5rem;
        padding: 8px 12px;
        line-height: 1.3;
    }
}

.container {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fafafa;
}

.chat-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(139, 0, 0, 0.1);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.chat-header {
    background: #8B0000;
    color: white;
    padding: 0.7rem 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

/* 더보기 버튼 스타일 */
.more-menu-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-left: auto;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.more-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* 드롭다운 메뉴 스타일 */
.more-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    min-width: 180px;
    overflow: hidden;
}

.more-menu-dropdown .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #333;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.more-menu-dropdown .menu-item:last-child {
    border-bottom: none;
}

.more-menu-dropdown .menu-item:hover {
    background: #f8f9fa;
    color: #8B0000;
}

.more-menu-dropdown .menu-item span:first-child {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: transparent;
}



.message {
    margin-bottom: 1rem;
    display: flex;
    gap: 10px;
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 1rem 1.5rem;
    border-radius: 20px;
    line-height: 1.5;
    position: relative;
    z-index: 3;
}

.message.user .message-content {
    background: #8B0000 !important;
    background-color: #8B0000 !important;
    color: white;
    border-bottom-right-radius: 5px;
    z-index: 10;
}

.message.bot .message-content {
    background: white !important;
    background-color: white !important;
    color: #333;
    position: relative;
    border: 1px solid #ddd;
    border-bottom-left-radius: 5px;
    z-index: 10;
}

.message.bot .message-content.show-watermark::before {
    content: '';
    position: absolute;
    bottom: 6px;
    right: 9px;
    width: 70px;
    height: 70px;
    background-image: url('../images/mark7 (2).svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.08;
    pointer-events: none;
    z-index: 1;
}

/* Ollama thinking process 스타일 */
.message.bot.thinking .message-content {
    background: #f8f9fa !important;
    border: 1px solid #e9ecef;
    border-left: 4px solid #007bff;
    font-style: italic;
    opacity: 0.85;
}

.message.bot.thinking .message-content::before {
    content: '🤖 ';
    font-style: normal;
}

/* Thinking separator 스타일 */
.message.bot.separator .message-content {
    background: transparent !important;
    border: none;
    padding: 0.5rem 0;
    text-align: center;
}

.thinking-separator {
    border: none;
    border-top: 2px dashed #007bff;
    margin: 0.5rem 0;
    opacity: 0.6;
}

.input-area {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center; /* 버튼과 입력 필드 수직 정렬 */
    /* iOS safe area 지원 */
    padding-right: max(1.5rem, calc(1.5rem + env(safe-area-inset-right)));
    padding-left: max(1.5rem, calc(1.5rem + env(safe-area-inset-left)));
}

.input-area input {
    flex: 1;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 16px; /* iOS 자동 줌 방지를 위해 16px 이상 사용 */
    outline: none;
    transition: border-color 0.3s;
}

.input-area input:focus {
    border-color: #8B0000;
}

/* + 버튼 스타일 */
.quickmenu-toggle-btn {
    background: #34495e;
    color: white;
    border: none;
    padding: 0;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 55px;
    flex-shrink: 0; /* 버튼 축소 방지 */
    height: 55px;
    min-width: 55px;
    min-height: 55px;
    max-width: 55px;
    max-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
    align-self: flex-end;
    flex-shrink: 0;
}

.quickmenu-toggle-btn:hover {
    background: #2c3e50;
    transform: scale(1.05);
}

.send-btn {
    background: #8B0000;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    flex-shrink: 0; /* 버튼 축소 방지 */
    min-width: 80px; /* 최소 너비 보장 */
    white-space: nowrap; /* 텍스트 줄바꿈 방지 */
}

.send-btn:hover {
    background: #A0522D;
}

/* 퀵메뉴 팝업 스타일 */
.quickmenu-popup {
    position: absolute;
    bottom: 100px;
    left: 10px;
    right: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 15px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
    max-height: 400px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9999;
    pointer-events: none;
}

.quickmenu-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.quickmenu-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 15px 15px 0 0;
}

.quickmenu-popup-header span {
    font-weight: 600;
    color: #333;
}

.quickmenu-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.quickmenu-close-btn:hover {
    background: #e9ecef;
    color: #333;
}

.quickmenu-popup-content {
    max-height: 350px;
    overflow-y: auto;
}

#popup-quickmenu-container {
    padding: 1rem;
}

#popup-quickmenu-container .quickmenu-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#popup-quickmenu-container .quickmenu-btn {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 90px;
    width: 120px;
    flex-shrink: 0;
}

#popup-quickmenu-container .quickmenu-btn:hover {
    border-color: #8B0000;
    background: #fff5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.1);
}

#popup-quickmenu-container .quickmenu-btn .icon {
    font-size: 1.5rem;
    width: 2.5rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

#popup-quickmenu-container .quickmenu-btn .title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #333;
    line-height: 1.2;
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 마크다운 스타일 */
.message-content h2 { 
    font-size: 1.2em; 
    color: #2c3e50; 
    margin: 10px 0 5px 0; 
}
.message-content h3 { 
    font-size: 1.1em; 
    color: #34495e; 
    margin: 8px 0 3px 0; 
}
.message-content h4 { 
    font-size: 1.05em; 
    color: #5d6d7e; 
    margin: 6px 0 2px 0; 
}
.message-content ul { 
    margin: 10px 0; 
    padding-left: 20px; 
}
.message-content li { 
    margin: 3px 0; 
}
.message-content strong { 
    font-weight: bold; 
    color: #2c3e50; 
}
.message-content em { 
    font-style: italic; 
}

.loading {
    display: none;
    text-align: center;
    padding: 1rem;
    color: #8B0000;
}

/* 학과 버튼 스타일 */
.department-buttons {
    margin: 15px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    border-left: 5px solid #6c757d;
    box-shadow: 0 3px 10px rgba(108, 117, 125, 0.1);
}

.department-btn {
    display: inline-block;
    margin: 8px 6px;
    padding: 10px 16px;
    background: linear-gradient(45deg, #8B0000, #A52A2A);
    color: white !important;
    text-decoration: none !important;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(139,0,0,0.2);
}

.department-btn:hover {
    background: linear-gradient(45deg, #A52A2A, #DC143C);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.4);
}

.dept-btn-homepage {
    background: linear-gradient(45deg, #228B22, #32CD32);
}

.dept-btn-homepage:hover {
    background: linear-gradient(45deg, #32CD32, #00FF00);
}

.dept-btn-official {
    background: linear-gradient(45deg, #FF8C00, #FFA500);
    color: #000 !important;
}

.dept-btn-official:hover {
    background: linear-gradient(45deg, #FFA500, #FFD700);
}

/* 홈페이지 버튼 스타일 */
.homepage-buttons {
    margin-top: 8px;
    padding: 6px 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    clear: both;
    width: 100%;
    display: block;
    box-sizing: border-box;
}

.homepage-btn {
    display: inline-block;
    margin: 6px 8px;
    padding: 12px 18px;
    text-decoration: none !important;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.homepage-btn.dept-homepage {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #6c757d !important;
    border-left: 3px solid #8B0000;
}

.homepage-btn.dept-homepage:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.homepage-btn.official-page {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #6c757d !important;
    border-left: 3px solid #8B0000;
}

.homepage-btn.official-page:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Footer 스타일 */
.footer {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: auto;
    font-size: 0.9rem;
    border-top: 3px solid #8B0000;
}

.footer p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.8rem;
    line-height: 1.4;
}

.footer-english {
    font-size: 0.5rem;
    opacity: 0.8;
}

/* 큰 화면에서 더 넓게 사용 */
@media (min-width: 1200px) {
    .container {
        width: 90%;
        max-width: 1600px;
    }
    
    .message-content {
        max-width: 85%;
    }
}

@media (max-width: 768px) {
    /* 모바일에서 UI 요소들을 축소하여 잘림 방지 */
    .container {
        width: 95%;
        padding: 0.6rem 0.6rem;
        margin: 0 auto;
    }
    
    .chat-container {
        width: 100%;
        margin: 0 auto;
        /* transform 제거하고 직접 크기 조정 */
    }
    
    .mini-header {
        padding: 0.3rem 0.8rem;
        font-size: 1.1rem;
    }
    
    .header h1 {
        font-size: 1.6rem;
    }
    
    .header {
        padding: 0.8rem 1rem;
    }

    .header img {
        height: 40px !important;
    }

    .header div {
        flex-direction: column !important;
        gap: 8px !important;
        margin-bottom: 3px !important;
    }
    
    .container {
        padding: 0.3rem;
        width: 98%;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .chat-messages {
        height: auto; /* flex로 자동 조정 */
    }
    
    .input-area {
        padding: 0.8rem 0.8rem;
        /* iOS safe area는 최소한으로만 적용 */
        padding-right: max(0.8rem, calc(0.8rem + env(safe-area-inset-right)));
        padding-left: max(0.8rem, calc(0.8rem + env(safe-area-inset-left)));
        margin: 0 auto;
        width: 100%;
        box-sizing: border-box;
        display: flex !important;
        align-items: center !important; /* 모든 버튼과 입력 필드 수직 중앙 정렬 */
        gap: 8px !important; /* 간격 조정 */
    }
    
    .input-area input {
        padding: 0.8rem;
        font-size: 16px; /* iOS 자동 줌 방지를 위해 16px 이상 필수 */
    }
    
    .send-btn {
        padding: 0.8rem 1.2rem; /* 좌우 패딩 살짝 줄여서 공간 확보 */
        font-size: 0.9rem;
        min-width: 60px; /* 최소 너비 보장 */
        flex-shrink: 0; /* 축소 방지 */
    }
    
    /* + 버튼 크기 축소 및 수직 정렬 */
    .quickmenu-toggle-btn {
        width: 35px !important; /* 55px에서 35px로 축소 */
        height: 35px !important;
        min-width: 35px !important;
        min-height: 35px !important;
        max-width: 35px !important;
        font-size: 0.9rem !important; /* 더 작게 조정 */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        align-self: center !important; /* flexbox 내에서 자체 수직 중앙 정렬 */
    }
}

.menu-btn {
    display: inline-block;
    margin: 10px 0;
    padding: 12px 18px;
    background: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.menu-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* 퀵메뉴 그리드 스타일 */
.quickmenu-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.quickmenu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    background: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
    text-decoration: none;
    min-height: 70px;
    width: 120px;
    flex-shrink: 0;
}

.quickmenu-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.quickmenu-btn .icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
    width: 2.5rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

.quickmenu-btn .title {
    font-size: 12px;
    line-height: 1.3;
    word-break: keep-all;
}

/* 관련링크 버튼 스타일 */
.related-link-btn {
    display: inline-block;
    margin: 4px 6px;
    padding: 8px 14px;
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2);
    text-decoration: none;
}

.related-link-btn:hover {
    background: linear-gradient(45deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 123, 255, 0.3);
}

.related-link-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 123, 255, 0.2);
}

.feedback-container {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.feedback-buttons {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.feedback-text {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.feedback-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.feedback-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.feedback-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.feedback-btn.satisfied {
    color: #28a745;
}

.feedback-btn.satisfied:hover {
    background: #d4edda;
    border-color: #28a745;
}

.feedback-btn.dissatisfied {
    color: #dc3545;
}

.feedback-btn.dissatisfied:hover {
    background: #f8d7da;
    border-color: #dc3545;
}

.feedback-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 타이핑 애니메이션 스타일 */
.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    margin-bottom: 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    border-bottom-left-radius: 5px;
    min-width: 70px;
    min-height: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 80px;
    margin-left: 0;
    margin-right: auto;
}

.typing-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6c757d;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* 이스터에그 메시지 스타일 */
.easter-egg-message {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 12px;
    animation: fadeInUp 0.5s ease-out;
}

.easter-egg-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #f39c12;
    border-radius: 20px;
    border-bottom-left-radius: 5px;
    max-width: 85%;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.2);
}

.easter-egg-icon {
    font-size: 1.2rem;
    margin-right: 8px;
    animation: bounce 2s infinite;
}

.easter-egg-text {
    font-size: 0.9rem;
    color: #8b4513;
    font-weight: 500;
    line-height: 1.4;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* 참고 문서 영역 스타일 */
.reference-docs {
    margin-top: 0px;
    padding: 2px 6px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.3;
    clear: both;
    width: 100%;
    display: block;
}

.reference-docs-title {
    font-weight: bold;
    color: #495057;
    font-size: 16px;
    margin-top: 1px;
    margin-bottom: 0px;
    line-height: 1.4;
}

.reference-docs-title strong {
    font-weight: bold;
    color: #495057;
    font-size: 16px;
}

.reference-docs-list {
    margin-top: 1px;
}

.reference-docs-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 6px 10px;
    margin: 2px 0;
    font-size: 0.9em;
    color: #6c757d;
    border-left: 3px solid #8B0000;
    transition: all 0.3s ease;
}

/* 인용된 문서 하이라이트 스타일 */
.reference-docs-item.cited {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffc107;
    border-left: 4px solid #ff6b35;
    color: #856404;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
    transform: translateY(-1px);
}

.reference-docs-item.cited::before {
    content: "📌 ";
    color: #ff6b35;
    font-weight: bold;
}

/* 참고문서 펼치기/접기 버튼 스타일 */
.reference-docs-toggle {
    margin: 1px 0 1px 0;
    text-align: center;
}

.reference-docs-toggle-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    font-weight: 500;
}

.reference-docs-toggle-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.reference-docs-toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 숨겨진 참고문서 영역 */
.reference-docs-hidden {
    margin-top: 1px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

/* 웹검색 버튼 스타일 */
.web-search-container {
    margin-top: 15px;
    text-align: center;
}

/* 웹검색 버튼만 있는 메시지는 이전 메시지와 붙어보이도록 */
.message.web-search-only {
    margin-top: -10px !important;
    padding-top: 5px !important;
}

.message.web-search-only .message-content {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.web-search-btn {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.web-search-btn:hover {
    background: linear-gradient(45deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.web-search-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
}

.reference-docs-item::before {
    content: "• ";
    color: #8B0000;
    font-weight: bold;
}

/* 메뉴 테이블 스타일 */
.menu-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 5px 0 15px 0; /* 위쪽 마진 줄이고 아래쪽 마진 늘림 */
    font-size: 0.85em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    table-layout: fixed; /* 고정 레이아웃으로 대칭 유지 */
}

/* 메뉴 섹션의 제목과 테이블 간격 조정 - 거의 붙게 */
.message-content h3 + .menu-table,
.message-content h3:has(+ table.menu-table) {
    margin-top: 0px;
}

.message-content h3 {
    margin-bottom: 0px;
    line-height: 1.0; /* 줄 간격도 줄임 */
}

/* h4 제목과 테이블 간격도 조정 */
.message-content h4 {
    margin-bottom: 0px;
    margin-top: 15px;
    line-height: 1.0;
}

.message-content h4 + .menu-table {
    margin-top: 0px;
}

.menu-table thead {
    background: linear-gradient(135deg, #8B0000, #A52A2A);
    color: white;
}



.menu-table th {
    padding: 10px 6px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95em;
    width: 33.33%; /* 각 컨럼을 동일한 너비로 */
}

.menu-table td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid #eee;
    vertical-align: top;
    line-height: 1.3;
    word-wrap: break-word; /* 긴 단어 줄바꿈 */
    word-break: keep-all; /* 한글 단어 단위로 줄바꿈 */
    white-space: normal; /* 일반적인 줄바꿈 허용 */
    overflow-wrap: break-word;
    hyphens: auto;
    width: 33.33%;
}

.menu-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.menu-table tbody tr:hover {
    background-color: #e8f4f8;
    transition: background-color 0.2s ease;
}

.menu-table td:empty::after {
    content: "-";
    color: #ccc;
    font-style: italic;
}

/* 모바일 반응형 설정 */
/* 페이지 모달 스타일 */
.page-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
}

.page-modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    height: 85vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.page-modal-header {
    background: #8B0000;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.page-modal-header span {
    font-size: 1.1rem;
    font-weight: 600;
}

.page-modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.page-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.page-modal-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.page-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

@media (max-width: 768px) {
    .page-modal {
        padding: 5px;
    }
    
    .page-modal-content {
        height: 90vh;
        max-height: 90vh;
    }
    
    .page-modal-header {
        padding: 12px 16px;
    }
    
    .page-modal-header span {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .menu-table {
        font-size: 0.75em;
    }
    
    .menu-table th,
    .menu-table td {
        padding: 6px 4px;
    }
    
    .menu-table th {
        font-size: 0.9em;
    }
}

