/* 🎨 DazabiAI 심플 검색 디자인 */

/* 🔥 AI 검색 컨테이너에만 적용하는 box-sizing 설정 */
.ai-search-container {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* 🚀 검색바 흔들림 방지 - 컨테이너 레이어 안정화 */
    isolation: isolate;
}

/* 🔥 AI 검색 페이지 전용 body 스타일 */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) ;
    min-height: 100vh;
    /* 🔥 스크롤바 생성/제거로 인한 레이아웃 변경 방지 */
    overflow-y: scroll;
    scrollbar-gutter: stable;
    /* 🚀 검색바 흔들림 방지 - 스크롤 최적화 */
    scroll-behavior: auto;
    overscroll-behavior: none;
    /* 🚀 iOS Safari viewport 변화 대응 */
    -webkit-overflow-scrolling: touch;
    position: relative;
}



/* 🎨 메인 컨테이너 */
.ai-search-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* 상단 정렬로 변경 */
    padding: 80px 20px 20px; /* 헤더 높이만큼 상단 패딩 추가 */
    position: relative;
    color: #333;
    overflow-x: hidden;
}

/* 🎨 검색 히어로 섹션 */
.ai-search-hero-section {
    position: fixed;
    top: 150px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 600px;
    z-index: 500;
    text-align: center;
    padding: 20px;
    margin: 0;
    opacity: 1;
}



.ai-search-hero-content {
    max-width: 600px;
}

.ai-search-hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 16px;
}

.ai-search-hero-title i {
    margin-right: 12px;
    color: #ffd700;
}

.ai-search-hero-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    line-height: 1.6;
}

/* 🎨 검색 카드 */
.ai-search-card {
    width: 100%;
    max-width: 1000px; /* 1000px에서 800px으로 수정 */
    margin: 0 auto;
}

.ai-search-form {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    width: 90%;
    max-width: 600px;
    margin-bottom: 0;
}

/* 🚀 웹검색 모드 전용 검색바 강제 표시 */
.ai-search-container.web-search-mode .ai-search-form,
.search-container.web-search-mode .ai-search-form {
    display: block ;
    visibility: visible ;
    opacity: 1 ;
}

.ai-search-input-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50px;
    padding: 8px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 10px 20px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center; /* flex-start에서 center로 수정 */
    gap: 12px;
    padding: 12px;
    position: relative;
    margin-bottom: 40px; /* mode-selector를 위한 여백 */
    /* 🚀 검색바 흔들림 방지 - 컨테이너 안정화 */
    transform: translateZ(0);
    will-change: auto;
    contain: layout style;
}

/* 모드 선택기 - PC/모바일 통합 */
.mode-selector {
    position: absolute;
    left: 12px;
    bottom: -35px;
    display: flex;
    gap: 8px;
    z-index: 10;
}



.mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 통합 모드 버튼 active 스타일 */
.mode-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.mode-btn i {
    font-size: 14px;
}

/* PC용 모드 선택기 제거 - 통합 스타일 사용 */
.ai-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    font-weight: 400;
    color: #333;
    padding: 8px 12px;
    resize: none;
    line-height: 1.5;
    min-height: 40px;
    max-height: 120px;
    font-family: inherit;
}

.ai-search-input::placeholder {
    color: #999;
    font-weight: 400;
}

.ai-search-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.ai-search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-search-btn:active {
    transform: scale(0.95);
}

.ai-search-btn i {
    font-size: 16px;
}

/* 🎨 로딩 애니메이션 */
.ai-search-loading {
    display: none;
    text-align: center;
    padding: 40px 20px;
    animation: fadeIn 0.5s ease-out;
}

.ai-search-loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    height: 80px;
}

.neural-network {
    position: relative;
    width: 120px;
    height: 80px;
}

.neural-node {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    animation: neural-pulse 2s ease-in-out infinite;
}

.neural-node:nth-child(1) { top: 20%; left: 50%; animation-delay: 0s; }
.neural-node:nth-child(2) { top: 40%; left: 20%; animation-delay: 0.2s; }
.neural-node:nth-child(3) { top: 40%; left: 80%; animation-delay: 0.4s; }
.neural-node:nth-child(4) { top: 60%; left: 35%; animation-delay: 0.6s; }
.neural-node:nth-child(5) { top: 60%; left: 65%; animation-delay: 0.8s; }
.neural-node:nth-child(6) { top: 80%; left: 50%; animation-delay: 1s; }

.neural-connection {
    position: absolute;
    height: 1px;
    background: rgba(255, 255, 255, 0.4);
    animation: neural-flow 2s ease-in-out infinite;
}

.connection-1 { top: 30%; left: 45%; width: 25px; transform: rotate(45deg); animation-delay: 0.1s; }
.connection-2 { top: 30%; left: 55%; width: 25px; transform: rotate(-45deg); animation-delay: 0.3s; }
.connection-3 { top: 50%; left: 30%; width: 35px; transform: rotate(30deg); animation-delay: 0.5s; }
.connection-4 { top: 50%; left: 60%; width: 35px; transform: rotate(-30deg); animation-delay: 0.7s; }
.connection-5 { top: 70%; left: 45%; width: 25px; transform: rotate(-45deg); animation-delay: 0.9s; }
.connection-6 { top: 70%; left: 55%; width: 25px; transform: rotate(45deg); animation-delay: 1.1s; }

@keyframes neural-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

@keyframes neural-flow {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.8; }
}

.ai-search-loading-text {
    color: rgb(0, 0, 0);
    font-size: 16px;
    font-weight: 500;
    margin-top: 20px;
}

.typing-text::after {
    content: '|';
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.ai-progress-container {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 20px auto;
    overflow: hidden;
}

.ai-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}



/* 채팅 결과 컨테이너 - 투명 배경에 깔끔한 구조 */
.ai-search-results-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 120px; /* 하단 고정 검색바 공간 확보 */
    background: transparent;
    color: inherit; /* 흰색 강제 제거 - 하위 요소가 자연스럽게 색상 설정 */
    /* 스크롤 성능 최적화 */
    transform: translateZ(0);
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    margin-top: 70px;
}

.ai-search-results {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.search-result-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 30px;
    gap: 20px;
}

.search-query-display h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 8px;
    font-weight: 600;
}

.search-query-display h2 i {
    color: #667eea;
    margin-right: 8px;
}

.search-meta-info {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-mode-badge,
.search-time-badge {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.new-search-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.new-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* AI 요약 섹션 */
.ai-summary-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.ai-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.ai-summary-header h3 {
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-summary-header h3 i {
    color: #ffd700;
}

.ai-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.ai-summary-content {
    color: #555;
    line-height: 1.7;
    font-size: 15px;
}

.ai-summary-content p {
    margin-bottom: 12px;
}

.ai-summary-content strong {
    color: #333;
    font-weight: 600;
}

.ai-summary-content .no-summary {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #ddd;
    margin: 0;
}

/* 검색 결과 섹션 */
.search-results-sections {
    margin-top: 20px;
}

.ai-search-result-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.ai-search-result-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.ai-search-result-header {
    margin-bottom: 16px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: #667eea;
}

.result-count {
    color: #666;
    font-weight: 400;
    font-size: 0.9rem;
}

.ai-search-results-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-search-result-item {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    gap: 12px;
}

.ai-search-result-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.result-thumbnail {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8f9fa;
}

.result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-content {
    flex: 1;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ai-search-source-badge-news,
.ai-search-source-badge-blog,
.ai-search-source-badge-cafe,
.ai-search-source-badge-web,
.ai-search-source-badge-default {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-search-source-badge-news { background: #dc3545; }
.ai-search-source-badge-blog { background: #fd7e14; }
.ai-search-source-badge-cafe { background: #198754; }
.ai-search-source-badge-web { background: #0d6efd; }

.result-date {
    color: #666;
    font-size: 11px;
}

.result-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    line-height: 1.4;
}

.result-snippet {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 8px;
}

.result-url {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #667eea;
    font-size: 11px;
}

.result-url i {
    font-size: 10px;
}

/* 피드백 섹션 */
.feedback-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-top: 30px;
    text-align: center;
}

.feedback-header h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.feedback-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.feedback-btn {
    background: white;
    border: 2px solid #e9ecef;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #666;
}

.feedback-btn:hover:not(:disabled) {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
}

.feedback-btn.helpful:hover:not(:disabled) {
    border-color: #198754;
    color: #198754;
}

.feedback-btn.not_helpful:hover:not(:disabled) {
    border-color: #dc3545;
    color: #dc3545;
}

.feedback-btn.excellent:hover:not(:disabled) {
    border-color: #f59e0b;
    color: #f59e0b;
}

.feedback-success {
    color: #198754;
    font-weight: 500;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* 🎨 채팅 이력 사이드바 */
.chat-history-sidebar {
    position: fixed;
    top: 0;
    left: -350px;
    width: 350px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    z-index: 1100;
    overflow-y: auto;
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.1);
}

.chat-history-sidebar.active {
    left: 0;
}

.chat-history-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    position: sticky;
    top: 0;
    z-index: 1101;
}

.chat-history-header h3 {
    color: #333;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    text-shadow: none;
}

.chat-history-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: #333;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-history-toggle:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.chat-history-content {
    padding: 20px;
    flex: 1;
}

.chat-history-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.new-chat-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    color: #333;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-shadow: none;
}

.new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.no-sessions {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-sessions i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.no-sessions p {
    margin: 8px 0;
    line-height: 1.5;
    text-shadow: none;
}

/* 검색 이력 아이템 - 글래스 효과 */
.session-date-group {
    margin-bottom: 20px;
}

.session-date-header {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 0 4px;
    text-shadow: none;
}

.search-history-item {
    background: #ffffff;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-history-item:hover {
    background: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: #d1d5db;
}

.search-history-item.active {
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.session-main-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.3;
    text-shadow: none;
}

.session-last-question {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    line-height: 1.4;
    text-shadow: none;
}

.search-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #999;
}

.search-mode {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 500;
    backdrop-filter: blur(5px);
}

.search-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-history-item:hover .search-actions {
    opacity: 1;
}

.search-actions button {
    background: rgba(220, 53, 69, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #ff6b7a;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.search-actions button:hover {
    background: rgba(220, 53, 69, 0.3);
    transform: scale(1.1);
}

/* 세션 질문 뷰 */
.session-questions-view {
    background: #ffffff;
    border-radius: 20px;
    padding: 30px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    gap: 20px;
}

.session-info h2 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-date {
    color: #666;
    font-size: 14px;
}

.new-search-btn-inline {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.new-search-btn-inline:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.questions-list h3 {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-item {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 16px;
}

.question-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.question-number {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.question-content {
    flex: 1;
}

.question-text {
    color: #333;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.4;
}

.question-time {
    color: #666;
    font-size: 12px;
}

.question-arrow {
    color: #667eea;
    transition: transform 0.3s ease;
}

.question-item:hover .question-arrow {
    transform: translateX(4px);
}

.no-questions {
    text-align: center;
    color: #666;
    padding: 40px 20px;
}

.no-questions i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 16px;
}

/* 질문 답변 뷰 */
.question-answer-view {
    background: #ffffff;
    border-radius: 20px;
    padding: 30px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.question-header {
    margin-bottom: 30px;
}

.back-btn {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.back-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
}

.question-info h2 {
    color: #333;
    font-size: 1.3rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-text {
    color: #555;
    font-style: italic;
    margin-bottom: 8px;
    line-height: 1.5;
}

.question-time {
    color: #666;
    font-size: 14px;
}

.loading-answer {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.loading-answer i {
    font-size: 32px;
    margin-bottom: 16px;
    color: #667eea;
}

/* 🎨 애니메이션 - GPU 가속 최적화 */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}




/* 🔥 FontAwesome 아이콘 직접 정의 - CSS 변수 방식 호환성 문제 해결 */
.fa-sparkles::before {
    content: "\f890";
}

.fa-arrow-up::before {
    content: "\f062";
}

.fa-search::before {
    content: "\f002";
}

.fa-history::before {
    content: "\f1da";
}

.fa-times::before, .fa-xmark::before {
    content: "\f00d";
}

.fa-plus::before {
    content: "\002b";
}

/* 💬 채팅 모드 스타일 (fixed positioning을 위한 block 레이아웃) */
.ai-search-container.chat-mode {
    display: block; /* 🎯 flex 제거 - fixed가 viewport 기준으로 작동하도록 */
    min-height: 100vh; /* GPT 스타일: 내용에 따라 높이 확장 가능 */
    padding: 0;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.ai-search-container.chat-mode .ai-search-hero-section {
    display: none ;
    visibility: hidden ;
    opacity: 0 ;
}

.ai-search-container.chat-mode .ai-search-card {
    display: block; /* 🎯 flex 제거 - fixed positioning 간섭 방지 */
    padding: 20px;
    background: transparent;
    box-shadow: none;
}

/* 🔧 웹킷 기반 브라우저 스크롤바 (클래스명 수정) */
.ai-search-container.chat-mode .ai-search-results-container::-webkit-scrollbar {
    width: 6px;
}

.ai-search-container.chat-mode .ai-search-results-container::-webkit-scrollbar-track {
    background: transparent;
}

.ai-search-container.chat-mode .ai-search-results-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}


/* 💬 채팅 메시지 스타일 + 흔들림 방지 */
.chat-message {
    display: flex;
    margin-bottom: 16px;
    padding: 0 20px;
    animation: fadeInUp 0.3s ease;
    /* 🚀 흔들림 방지 최적화 */
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transition: transform 0.2s ease-out;
    contain: layout style paint;
}

.chat-message.user-message {
    justify-content: flex-end;
}

.chat-message.ai-message {
    justify-content: flex-start;
}

/* ⌨️ 타이핑 커서 애니메이션 */
.typing-cursor {
    color: #007bff;
    font-weight: bold;
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 📱 상태 이모지 스타일 */
.status-emoji {
    color: #28a745;
    font-weight: bold;
    margin-right: 4px;
}

/* 🔄 실시간 메시지 추가 스타일 */
.realtime-message {
    padding-left: 12px;
}

/* 🔄 검색 상태 로딩 스타일 */
.search-status-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin: 10px 0;
}

.search-status-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.search-spinner {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-status-text {
    color: #666;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
}

.chat-message.user-message {
    text-align: right;
}

.chat-message.ai-message {
    text-align: left;
}

.message-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 85%;
    min-height: auto ; /* 최소 높이 자동 */
    height: auto ; /* 높이 자동 조절 */
    overflow: visible ; /* 내용이 잘리지 않도록 */
    flex-wrap: wrap ; /* 내용이 길면 줄바꿈 */
    flex-direction: row;
}

.user-message .message-content {
    flex-direction: row-reverse;
    margin-left: auto;
}

.ai-message .message-text {
    background: rgb(255, 255, 255);
    color: #000000;
    border: 1px solid #e0e0e0;
    font-size: 15px; /* AI 메시지 텍스트 크기 2pt 증가 */
    border-radius: 18px 18px 18px 18px;
    line-height: 1.7; /* AI 응답 줄간격 더 넓게 */
    padding: 16px 20px; /* 패딩 증가 */
    height: auto ; /* 높이 자동 조절 */
    min-height: auto ; /* 최소 높이 자동 */
    max-height: none ; /* 최대 높이 제한 해제 */
    overflow: visible ; /* 내용 잘림 방지 */
    word-wrap: break-word ; /* 긴 단어 줄바꿈 */
    flex: 1 ; /* 사용 가능한 공간 모두 사용 */
    margin-bottom: 100px;
}

/* AI 응답 내 텍스트 포맷팅 개선 */
.ai-message .message-text p {
    margin: 8px 0;
    line-height: 1.7;
}

.ai-message .message-text br {
    line-height: 1.8; /* br 태그 줄간격 */
}

/* ✅ AI 메시지 강조 텍스트 - JavaScript 통합 스타일에서 관리 */
.ai-message .message-text strong {
    /* 기본 스타일은 JavaScript에서 동적 추가된 CSS가 관리 */
}

.ai-message .message-text ul,
.ai-message .message-text ol {
    margin: 12px 0;
    padding-left: 20px;
    line-height: 1.8;
}

.ai-message .message-text li {
    margin: 6px 0;
    line-height: 1.7;
}

/* 코드 블록 스타일링 */
.ai-message .message-text code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    color: #374151;
}

/* 🚀 마크다운 헤더 스타일링 (블로그/카페 정보용) */
.ai-message .message-text h1,
.ai-message .message-text h2,
.ai-message .message-text h3,
.message-text-content h1,
.message-text-content h2,
.message-text-content h3,
.chat-message .message-content h1,
.chat-message .message-content h2,
.chat-message .message-content h3,
.chat-message .message-text h1,
.chat-message .message-text h2,
.chat-message .message-text h3 {
    color: #000000 ; /* 검정색으로 강제 설정 */
    font-weight: 600;
    margin: 16px 0 8px 0;
    line-height: 1.4;
}

.ai-message .message-text h1,
.message-text-content h1,
.chat-message .message-content h1,
.chat-message .message-text h1 {
    font-size: 20px;
}

.ai-message .message-text h2,
.message-text-content h2,
.chat-message .message-content h2,
.chat-message .message-text h2 {
    font-size: 18px;
}

.ai-message .message-text h3,
.message-text-content h3,
.chat-message .message-content h3,
.chat-message .message-text h3 {
    font-size: 16px;
}

/* 섹션 제목 스타일링 */
.ai-message .message-text .section-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e40af;
    margin: 20px 0 12px 0;
    padding-bottom: 4px;
    border-bottom: 2px solid #e2e8f0;
}

.error-text {
    background: #fee2e2 ;
    color: #dc2626 ;
    border: 1px solid #fecaca ;
}

.user-avatar, .ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.user-avatar {
    background: #007bff;
    color: white;
}

.ai-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-time {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    text-align: center;
}

.user-message .message-time {
    text-align: right;
}

.ai-message .message-time {
    text-align: left;
}

/* 🎬 채팅 애니메이션 - GPU 가속 최적화 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}


/* 🔄 매력적인 스피너 로딩 */
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-left: 12px;
    border: 3px solid rgba(52, 152, 219, 0.2);
    border-top: 3px solid #3498db;
    border-right: 3px solid #2ecc71;
    border-bottom: 3px solid #e74c3c;
    border-left: 3px solid #f39c12;
    border-radius: 50%;
    animation: rainbowSpin 1.2s linear infinite, spinGlow 2s ease-in-out infinite;
    position: relative;
}

/* 🌈 무지개 스핀 애니메이션 */
@keyframes rainbowSpin {
    0% {
        transform: rotate(0deg);
        filter: hue-rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
        filter: hue-rotate(360deg);
    }
}

/* ✨ 스피너 글로우 효과 */
@keyframes spinGlow {
    0%, 100% {
        box-shadow: 
            0 0 10px rgba(52, 152, 219, 0.4),
            0 0 20px rgba(52, 152, 219, 0.2);
    }
    50% {
        box-shadow: 
            0 0 20px rgba(52, 152, 219, 0.8),
            0 0 40px rgba(52, 152, 219, 0.4),
            0 0 60px rgba(52, 152, 219, 0.2);
    }
}

/* 📊 진행률 바 */
.loading-progress {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
    padding: 6px 12px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 15px;
    /* 🚀 테두리 제거 */
    border: none;
}

.progress-bar {
    width: 60px;
    height: 4px;
    background: rgba(52, 152, 219, 0.2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71, #f39c12);
    animation: progressSlide 2s linear infinite;
}

@keyframes progressSlide {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 💫 심플한 로딩 컨테이너 */
.smart-loading-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    margin: 8px 0;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* 심플한 로딩 - 불필요한 효과 제거 */

.loading-icon {
    font-size: 18px;
    animation: rotate 1.5s linear infinite;
}

.loading-text {
    font-size: 14px;
    color: #666 !important;
    font-weight: 500;
    flex: 1;
}

.loading-stage {
    font-size: 12px;
    color: #999 !important;
    background: transparent;
    padding: 2px 6px;
    margin-left: auto;
    font-weight: 400;
}

/* 심플한 회전 애니메이션만 유지 */

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 🌊 웨이브 로딩 애니메이션 (파도 효과) */
.loading-wave {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 12px;
}

.loading-wave span {
    display: inline-block;
    width: 4px;
    height: 16px;
    background: linear-gradient(135deg, #3498db, #2ecc71);
    border-radius: 2px;
    animation: wave 1.4s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.4);
}

.loading-wave span:nth-child(1) { animation-delay: 0s; }
.loading-wave span:nth-child(2) { animation-delay: 0.1s; }
.loading-wave span:nth-child(3) { animation-delay: 0.2s; }
.loading-wave span:nth-child(4) { animation-delay: 0.3s; }
.loading-wave span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 40%, 100% {
        transform: scaleY(0.4);
        background: linear-gradient(135deg, #3498db, #2ecc71);
    }
    20% {
        transform: scaleY(1.0);
        background: linear-gradient(135deg, #e74c3c, #f39c12);
        box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
    }
}

/* 💬 ChatGPT 스타일 점 애니메이션 */
.chat-loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    padding: 8px 12px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 12px;
}

.chat-loading-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #3498db;
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite both;
    box-shadow: 0 0 6px rgba(52, 152, 219, 0.5);
}

.chat-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.chat-loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.chat-loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        background: #3498db;
        box-shadow: 0 0 6px rgba(52, 152, 219, 0.5);
    }
    40% {
        transform: scale(1.2);
        background: #2ecc71;
        box-shadow: 0 0 12px rgba(46, 204, 113, 0.8);
    }
}

/* 🌟 강화된 파티클 로딩 효과 */
.loading-particles {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 20px;
    margin-left: 12px;
}

.loading-particles::before,
.loading-particles::after {
    content: '✨';
    position: absolute;
    width: 12px;
    height: 12px;
    color: #3498db;
    font-size: 10px;
    text-align: center;
    line-height: 12px;
    border-radius: 50%;
    animation: enhancedParticles 2s linear infinite;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.6);
}

.loading-particles::before {
    left: 0;
    animation-delay: 0s;
}

.loading-particles::after {
    left: 0;
    animation-delay: 1s;
}

@keyframes enhancedParticles {
    0% {
        left: 0;
        opacity: 1;
        transform: scale(1);
        color: #3498db;
        box-shadow: 0 0 8px rgba(52, 152, 219, 0.6);
    }
    25% {
        opacity: 0.9;
        transform: scale(1.3);
        color: #2ecc71;
        box-shadow: 0 0 12px rgba(46, 204, 113, 0.8);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.5);
        color: #f39c12;
        box-shadow: 0 0 15px rgba(243, 156, 18, 0.8);
    }
    75% {
        opacity: 0.5;
        transform: scale(1.2);
        color: #e74c3c;
        box-shadow: 0 0 12px rgba(231, 76, 60, 0.6);
    }
    100% {
        left: 48px;
        opacity: 0;
        transform: scale(0.8);
        color: #9b59b6;
        box-shadow: 0 0 8px rgba(155, 89, 182, 0.4);
    }
}

/* 🔥 강화된 펄스 로딩 효과 */
.loading-pulse {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
}

.loading-pulse span {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: radial-gradient(circle, #e74c3c, #c0392b);
    border-radius: 50%;
    animation: enhancedPulse 1.5s ease-in-out infinite;
    position: relative;
}

.loading-pulse span:nth-child(1) { 
    animation-delay: 0s; 
    background: radial-gradient(circle, #e74c3c, #c0392b);
}
.loading-pulse span:nth-child(2) { 
    animation-delay: 0.2s; 
    background: radial-gradient(circle, #f39c12, #d68910);
}
.loading-pulse span:nth-child(3) { 
    animation-delay: 0.4s; 
    background: radial-gradient(circle, #2ecc71, #27ae60);
}

@keyframes enhancedPulse {
    0% {
        transform: scale(0.7);
        opacity: 0.6;
        box-shadow: 
            0 0 0 0 rgba(231, 76, 60, 0.7),
            0 0 8px rgba(231, 76, 60, 0.4);
    }
    50% {
        transform: scale(1.4);
        opacity: 1;
        box-shadow: 
            0 0 0 12px rgba(231, 76, 60, 0),
            0 0 20px rgba(231, 76, 60, 0.8);
    }
    100% {
        transform: scale(0.7);
        opacity: 0.6;
        box-shadow: 
            0 0 0 0 rgba(231, 76, 60, 0),
            0 0 8px rgba(231, 76, 60, 0.4);
    }
}

/* ⚡ 강화된 번개 로딩 효과 */
.loading-lightning {
    display: inline-block;
    margin-left: 12px;
    font-size: 20px;
    animation: enhancedLightning 1.2s ease-in-out infinite;
    position: relative;
}

.loading-lightning::before {
    content: '⚡';
    position: absolute;
    top: 0;
    left: 0;
    font-size: inherit;
    animation: lightningGlow 1.2s ease-in-out infinite;
    z-index: -1;
}

@keyframes enhancedLightning {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        color: #f39c12;
        text-shadow: 
            0 0 8px rgba(243, 156, 18, 0.8),
            0 0 16px rgba(243, 156, 18, 0.4);
    }
    20% {
        transform: scale(1.4) rotate(-8deg);
        color: #e74c3c;
        text-shadow: 
            0 0 20px rgba(231, 76, 60, 1),
            0 0 35px rgba(231, 76, 60, 0.6);
    }
    40% {
        transform: scale(1.1) rotate(6deg);
        color: #3498db;
        text-shadow: 
            0 0 15px rgba(52, 152, 219, 0.9),
            0 0 25px rgba(52, 152, 219, 0.5);
    }
    60% {
        transform: scale(1.3) rotate(-4deg);
        color: #9b59b6;
        text-shadow: 
            0 0 18px rgba(155, 89, 182, 0.9),
            0 0 30px rgba(155, 89, 182, 0.5);
    }
    80% {
        transform: scale(1.2) rotate(7deg);
        color: #2ecc71;
        text-shadow: 
            0 0 22px rgba(46, 204, 113, 1),
            0 0 40px rgba(46, 204, 113, 0.6);
    }
}

@keyframes lightningGlow {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1.2);
        color: #f39c12;
    }
    50% {
        opacity: 0.8;
        transform: scale(1.8);
        color: #ffffff;
    }
}

/* 채팅 히스토리 트리거 버튼 */
.chat-history-trigger {
    position: fixed;
    bottom: 120px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 10000;
    color: white;
    font-size: 20px;
}

.chat-history-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.history-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* 🎨 [NEW] 채팅 히스토리 패널 - 심플 & 모던 디자인 */
.chat-history-panel {
    position: fixed;
    top: 0;
    left: -400px; /* 초기 숨김 상태 */
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: #f8f9fa; /* 부드러운 배경색 */
    border-right: 1px solid #e9ecef;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1); /* 부드러운 전환 효과 */
    z-index: 99999;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
}

.chat-history-panel.active {
    left: 0 ;
    transform: translateX(0) ;
    visibility: visible ;
    opacity: 1 ;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    background: #ffffff;
    flex-shrink: 0;
}

.history-header h3 {
    margin: 0;
    color: #212529;
    font-size: 16px;
    font-weight: 600;
}

.history-header div {
    display: flex;
    align-items: center;
    gap: 4px; /* 버튼 간 간격 조정 */
}

.prompt-settings-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #868e96;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-settings-btn:hover {
    background: #f1f3f5;
    color: #3b5bdb;
}

.clear-history-btn {
    background: #f1f3f5;
    color: #495057;
    border: none;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.clear-history-btn:hover {
    background: #e9ecef;
    color: #212529;
}

.clear-history-btn i {
    font-size: 13px;
}

.close-history {
    background: none;
    border: none;
    font-size: 20px;
    color: #868e96;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-history:hover {
    background: #f1f3f5;
    color: #212529;
}

.history-content {
    padding: 15px;
    flex-grow: 1;
    overflow-y: auto; /* 내용이 길어지면 자동으로 스크롤바 생성 */
    min-height: 200px; /* 최소 높이 보장 */
    height: auto ; /* 높이 자동 조절 강제 적용 */
    display: block ; /* 블록 레벨 요소 강제 */
}

.history-content::-webkit-scrollbar { width: 6px; }
.history-content::-webkit-scrollbar-track { background: #f8f9fa; }
.history-content::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 3px; }
.history-content::-webkit-scrollbar-thumb:hover { background: #ced4da; }

.date-group {
    margin-bottom: 16px;
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 6px;
}

.date-header:hover {
    background: #f1f3f5;
}

.date-title {
    font-weight: 600;
    color: #343a40;
    font-size: 14px;
}

.date-count {
    background: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.date-toggle {
    color: #adb5bd;
    transition: transform 0.2s ease;
}

.date-toggle.expanded {
    transform: rotate(180deg);
}

.date-messages {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-left: 12px;
}

.date-messages.expanded {
    max-height: 1000px; /* 충분한 높이 */
}

.history-message {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #f1f3f5;
    transition: background-color 0.2s ease;
    border-radius: 6px;
}

.history-message:last-child {
    border-bottom: none;
}

.message-preview {
    flex: 1;
    font-size: 13px;
    color: #495057;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.history-message:hover {
    background: #ffffff;
}

.history-message:hover .message-meta {
    opacity: 1;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0.5; /* 평소엔 반투명 */
    transition: opacity 0.2s ease;
}

.message-time {
    font-size: 11px;
    color: #adb5bd;
    white-space: nowrap;
}

.delete-message-btn {
    background: none;
    border: none;
    color: #ced4da;
    cursor: pointer;
    font-size: 13px;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-message-btn:hover {
    background: #f8d7da;
    color: #721c24;
}





/* [RESTORED] 프롬프트 설정 모달 스타일 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay:target,
.modal-overlay[style*="display: flex"] {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay:target .modal-content,
.modal-overlay[style*="display: flex"] .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.modal-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: 300;
    color: #adb5bd;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.modal-close-btn:hover {
    color: #495057;
}

.modal-body {
    overflow-y: auto;
    max-height: calc(90vh - 150px);
    position: relative;
}

#promptTextarea {
    width: 100%;
    height: 150px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

#promptTextarea:focus {
    outline: none;
    border-color: #3b5bdb;
    box-shadow: 0 0 0 2px rgba(59, 91, 219, 0.2);
}

#promptCharCount {
    text-align: right;
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid #e9ecef;
}

.modal-cancel, .modal-save {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-cancel {
    background: #f1f3f5;
    color: #495057;
}
.modal-cancel:hover {
    background: #e9ecef;
}

.modal-save {
    background: #3b5bdb;
    color: white;
}
.modal-save:hover {
    background: #364fc7;
}

/* 🚀 개인화 전용 좌측 슬라이드 패널 스타일 */

/* 🎯 통합 트리거 버튼 (모드별 제어) - 검색바 내부 */
.unified-trigger-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
    transition: all 0.3s ease;
    color: white;
    flex-shrink: 0;
    position: relative;
}

.unified-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.unified-trigger-btn i {
    font-size: 16px;
    transition: all 0.3s ease;
}

.trigger-indicator {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* 🎯 개인화 채팅 모드 - 보라색 */
.unified-trigger-btn.chat-mode {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.unified-trigger-btn.chat-mode:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6b4190 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

/* 🎯 웹검색 모드 - 핑크색 */
.unified-trigger-btn.web-mode {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 2px 8px rgba(240, 147, 251, 0.3);
}

.unified-trigger-btn.web-mode:hover {
    background: linear-gradient(135deg, #ed7ff0 0%, #f04560 100%);
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.5);
}

/* 패널 활성화 시 트리거 버튼 효과 */
.unified-trigger-btn.panel-active {
    transform: translateY(-1px) scale(0.95) ;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) ;
    opacity: 0.8 ;
}

.unified-trigger-btn.panel-active.chat-mode {
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4) ;
}

.unified-trigger-btn.panel-active.web-mode {
    box-shadow: 0 2px 6px rgba(240, 147, 251, 0.4) ;
}

/* 🎨 세련된 개인화 좌측 패널 */
.personalized-side-panel {
    position: fixed;
    left: -420px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    box-shadow: 2px 0 30px rgba(0, 0, 0, 0.15);
    transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 100999;
    overflow-y: auto;
    border-right: 1px solid #e0e6ed;
}

/* 🚀 웹검색 모드 흔들림 방지 개선 */
.search-container.web-search-mode .ai-search-results-container {
    transform: translateZ(0);
    will-change: scroll-position;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    -webkit-transition: all 0.3s ease-out;
    transition: all 0.3s ease-out;
}

.search-container.web-search-mode .ai-search-card {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    position: relative;
}



.search-container.web-search-mode .chat-message {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transition: transform 0.2s ease-out;
}

/* AI 메시지 전체 컨테이너 - 투명 배경 */
.chat-message.ai-message,
.chat-message.assistant,
.search-container.web-search-mode .chat-message.ai-message {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* AI 메시지 텍스트 박스만 흰색 - 깔끔한 구조 */
.chat-message.ai-message .message-content,
.search-container.web-search-mode .chat-message.ai-message .message-content {
    background: rgba(255, 255, 255, 0);
    color: #2d3748 !important; /* 흰색 텍스트 강제 오버라이드 */
    padding: 16px 20px;
    max-width: 95%;
}

.chat-message.user-message .message-content,
.search-container.web-search-mode .chat-message.user-message .message-content {
    color: #2d3748;
    padding: 12px 16px;
    max-width: 70%;
    margin-left: auto;
}

.personalized-side-panel.active {
    left: 0;
}

/* 패널 헤더 */
.side-panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;  /* sticky에서 relative로 변경 */
    z-index: 10;
}

.side-panel-header .header-content h2 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
}

.side-panel-header .header-content p {
    margin: 0;
    opacity: 0.9;
    font-size: 12px;
}

.side-panel-header .close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 12px;
    width: 36px;
    height: 36px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.side-panel-header .close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

/* 메모리 현황 */
.personalized-side-panel .memory-overview {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: white;
    margin: 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.personalized-side-panel .memory-item {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.personalized-side-panel .memory-count {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    margin-bottom: 8px;
}

.personalized-side-panel .memory-label {
    font-size: 11px;
    color: #666;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* 현재 설정 */
.personalized-side-panel .current-settings {
    padding: 20px;
    background: rgba(255,255,255,0.7);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.personalized-side-panel .setting-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #555;
}

.personalized-side-panel .setting-preview i {
    color: #667eea;
    width: 16px;
    font-size: 14px;
}

/* 설정 메뉴 (접기/펼치기) */
.settings-menu {
    background: rgba(255,255,255,0.7);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 10px 10px;
    background: #f7d7d7;
}

.settings-header {
    padding: 1px 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.settings-menu:hover {
    background: rgba(255, 255, 255, 0.9);
}

.settings-header h4 {
    margin: 0;
    color: #333;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-header i:last-child {
    transition: transform 0.3s ease;
    color: #000000;
}

.settings-header i.rotated {
    transform: rotate(180deg);
}

.settings-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.settings-content.expanded {
    max-height: 600px;
}

.setting-section {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.setting-section:last-child {
    border-bottom: none;
}

.setting-section h5 {
    margin: 0 0 12px 0;
    color: #555;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}


.relationship-quick-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.relation-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
}

.relation-btn:hover {
    border-color: #667eea;
    transform: translateY(-1px);
}

.relation-btn.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.relation-btn i {
    font-size: 14px;
    margin-bottom: 3px;
    display: block;
}

.relation-btn span {
    display: block;
    font-weight: 500;
}

/* 설정 섹션 공통 스타일 */
.setting-section .input-group {
    display: flex;
    gap: 8px;
}

.setting-section .input-group input {
    flex: 1;
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
}

.setting-section .input-group button {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s ease;
}

.setting-section .input-group button:hover {
    background: #5a6fd8;
}

.setting-section .input-group input:disabled {
    background: #f5f5f5;
    color: #666;
}

.setting-message {
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
}

.setting-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.setting-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.setting-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 직업 설정 */
.setting-section select, .setting-section input[type="text"]:not(.input-group input) {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    background: white;
    margin-bottom: 6px;
}

.setting-section input[type="text"]:not(.input-group input):last-child {
    margin-bottom: 0;
}

/* 빠른 시작 제안 */
.quick-suggestions {
    padding: 20px;
    background: rgba(255,255,255,0.7);
}

.quick-suggestions h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-list {
    display: flex;
    flex-direction:row;
    gap: 8px;
}

.suggestion-chip {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 10px 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.suggestion-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 개인화 히스토리 */
.personalized-history {
    padding: 20px;
    background: white;
    flex: 1;
}

.personalized-history h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-list {
    max-height: 350px;
    overflow-y: auto;
}

.history-item {
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: #e9ecef;
    color: #333;
}

.history-item:last-child {
    margin-bottom: 0;
}

.close-personalized:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 개인화 패널 콘텐츠 */
.personalized-content {
    padding: 20px;
}

.personalized-content h5 {
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.personalized-content h5 i {
    color: #667eea;
}

/* 메모리 현황 섹션 */
.memory-status-section {
    margin-bottom: 25px;
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.memory-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.memory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f4f8;
}

.memory-item:last-child {
    border-bottom: none;
}

.memory-label {
    font-size: 13px;
    color: #64748b;
}

.memory-count {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* 개인화 설정 섹션 */
.personalization-settings {
    margin-bottom: 25px;
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 5px;
    font-weight: 500;
}

.setting-item select,
.setting-item input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    transition: border-color 0.2s;
}

.setting-item select:focus,
.setting-item input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 메모리 관리 섹션 */
.memory-management {
    margin-bottom: 25px;
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.memory-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.memory-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.memory-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.memory-btn.danger {
    background: #fed7d7;
    color: #c53030;
    border-color: #feb2b2;
}

.memory-btn.danger:hover {
    background: #e53e3e;
    color: white;
    border-color: #e53e3e;
}

/* 개인화 히스토리 섹션 */
.personalized-history {
    background: white;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    padding: 10px;
    border-bottom: 1px solid #f0f4f8;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 6px;
    margin-bottom: 5px;
}

.history-item:hover {
    background: #f8fafc;
}

.history-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.history-preview {
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-timestamp {
    font-size: 11px;
    color: #a0aec0;
}





/* 메모리 아이템 클릭 가능 스타일 */
.personalized-side-panel .memory-item {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.personalized-side-panel .memory-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.memory-view-icon {
    font-size: 12px;
    color: #64748b;
    opacity: 0.7;
    transition: opacity 0.2s;
    position: absolute;
    top: 8px;
    right: 8px;
}

.personalized-side-panel .memory-item:hover .memory-view-icon {
    opacity: 1;
    color: #667eea;
}

/* 메모리 모달 스타일 */
.memory-modal-content {
    max-width: 600px;
    max-height: 80vh;
}

.memory-list {
    max-height: 60vh;
    overflow-y: auto;
}

.memory-detail-item {
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f8fafc;
}

.memory-detail-item:last-child {
    margin-bottom: 0;
}

.memory-key {
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
    font-size: 14px;
}

.memory-value {
    color: #4b5563;
    margin-bottom: 8px;
    line-height: 1.5;
    font-size: 13px;
}

.memory-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6b7280;
}

.memory-confidence {
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
}

.memory-date {
    color: #9ca3af;
}

.no-memories {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-style: italic;
}





/* ========================================
   🎯 채팅 메시지 레이아웃 최종 스타일 (CSS 중복 해결)
   ======================================== */

/* 채팅 메시지 - 보라색 배경에 깔끔한 스타일 */
.ai-search-container.chat-mode .chat-message {
    margin-bottom: 16px;
    padding: 0 20px;
    display: flex;
    animation: fadeInUp 0.3s ease-out;
}

/* 사용자 메시지 - 우측 정렬 */
.ai-search-container.chat-mode .chat-message.user {
    justify-content: flex-end;
}

.ai-search-container.chat-mode .chat-message.user .message-content {
    background: rgba(255, 255, 255, 0.95);
    color: #2d3748;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-left: auto;
}

.ai-search-container.chat-mode .chat-message.user .message-text {
    font-size: 15px;
    line-height: 1.4;
    color: #2d3748 !important;
}

.ai-search-container.chat-mode .chat-message.user .message-avatar {
    display: none; /* 아바타 숨김 */
}

/* AI 메시지 - 좌측 정렬 */
.ai-search-container.chat-mode .chat-message.assistant {
    justify-content: flex-start;
    background: transparent;
    border: none;
    box-shadow: none;
}

.ai-search-container.chat-mode .chat-message.assistant .message-content {
    background: rgba(255, 255, 255, 0.98);
    color: #2d3748 !important; /* 흰색 텍스트 강제 오버라이드 */
    padding: 16px 20px;
    border-radius: 18px 18px 18px 4px;
    max-width: 85%;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.ai-search-container.chat-mode .chat-message.assistant .message-avatar {
    display: none; /* 아바타 숨김 */
}

.ai-search-container.chat-mode .chat-message.assistant .message-text {
    font-size: 15px; /* 15px에서 17px로 2pt 증가 */
    line-height: 1.6;
    color: #2d3748 !important; /* 흰색 텍스트 강제 오버라이드 */
}

/* AI 메시지 내부 콘텐츠 스타일 - 웹검색 결과 최적화 */
.chat-message.ai-message .message-content h1,
.chat-message.ai-message .message-content h2,
.chat-message.ai-message .message-content h3,
.chat-message.assistant .message-content h1,
.chat-message.assistant .message-content h2,
.chat-message.assistant .message-content h3 {
    color: #1a202c !important;
    margin: 16px 0 8px 0;
    font-weight: 600;
}

.chat-message.ai-message .message-content a,
.chat-message.assistant .message-content a {
    color: #3182ce !important;
    text-decoration: none;
    font-weight: 500;
}

.chat-message.ai-message .message-content a:hover,
.chat-message.assistant .message-content a:hover {
    color: #2c5aa0 !important;
    text-decoration: underline;
}

.chat-message.ai-message .message-content strong,
.chat-message.assistant .message-content strong {
    color: #1a202c !important;
    font-weight: 600;
}

.chat-message.ai-message .message-content code,
.chat-message.assistant .message-content code {
    background: rgba(74, 85, 104, 0.1);
    color: #2d3748 !important;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.chat-message.ai-message .message-content pre,
.chat-message.assistant .message-content pre {
    background: rgba(74, 85, 104, 0.05);
    color: #2d3748 !important;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.chat-message.ai-message .message-content ul,
.chat-message.ai-message .message-content ol,
.chat-message.assistant .message-content ul,
.chat-message.assistant .message-content ol {
    margin: 12px 0;
    padding-left: 20px;
}

.chat-message.ai-message .message-content li,
.chat-message.assistant .message-content li {
    margin: 4px 0;
    color: #4a5568 !important;
}

/* 웹검색 결과 전용 스타일 */
.chat-message.ai-message .message-content .search-result,
.chat-message.assistant .message-content .search-result {
    background: rgba(49, 130, 206, 0.05);
    border-left: 3px solid #3182ce;
    padding: 12px;
    margin: 8px 0;
    border-radius: 0 8px 8px 0;
}

.chat-message.ai-message .message-content .search-result-title,
.chat-message.assistant .message-content .search-result-title {
    color: #1a202c !important;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.chat-message.ai-message .message-content .search-result-url,
.chat-message.assistant .message-content .search-result-url {
    color: #38a169 !important;
    font-size: 13px;
    margin-bottom: 6px;
}

.chat-message.ai-message .message-content .search-result-snippet,
.chat-message.assistant .message-content .search-result-snippet {
    color: #4a5568 !important;
    line-height: 1.5;
}

/* 인용문 스타일 */
.chat-message.ai-message .message-content blockquote,
.chat-message.assistant .message-content blockquote {
    border-left: 4px solid #e2e8f0;
    padding-left: 16px;
    margin: 16px 0;
    color: #4a5568 !important;
    font-style: italic;
}

/* 🎯 표 스타일 - 웹검색 + 채팅 모드 모두 지원 */
.chat-message.ai-message .message-content table,
.chat-message.assistant .message-content table,
.search-container.web-search-mode .chat-message .message-content table,
.search-container.web-search-mode .ai-response-table,
.ai-search-results .ai-response-table,
.ai-response-table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 14px;
}

.chat-message.ai-message .message-content th,
.chat-message.ai-message .message-content td,
.chat-message.assistant .message-content th,
.chat-message.assistant .message-content td,
.search-container.web-search-mode .chat-message .message-content th,
.search-container.web-search-mode .chat-message .message-content td,
.search-container.web-search-mode .ai-response-table th,
.search-container.web-search-mode .ai-response-table td,
.ai-search-results .ai-response-table th,
.ai-search-results .ai-response-table td,
.ai-response-table th,
.ai-response-table td {
    border: none;
    padding: 12px 16px;
    text-align: left;
    color: #2d3748 !important;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.chat-message.ai-message .message-content th,
.chat-message.assistant .message-content th,
.search-container.web-search-mode .chat-message .message-content th,
.search-container.web-search-mode .ai-response-table th,
.ai-search-results .ai-response-table th,
.ai-response-table th {
    background: #afbdfc;
    font-weight: 600;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    font-size: 13px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: none;
}

.chat-message.ai-message .message-content tbody tr:hover,
.chat-message.assistant .message-content tbody tr:hover,
.search-container.web-search-mode .chat-message .message-content tbody tr:hover,
.search-container.web-search-mode .ai-response-table tbody tr:hover,
.ai-search-results .ai-response-table tbody tr:hover,
.ai-response-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
    transition: background-color 0.2s ease;
}

.chat-message.ai-message .message-content tbody tr:nth-child(even),
.chat-message.assistant .message-content tbody tr:nth-child(even),
.search-container.web-search-mode .chat-message .message-content tbody tr:nth-child(even),
.search-container.web-search-mode .ai-response-table tbody tr:nth-child(even),
.ai-search-results .ai-response-table tbody tr:nth-child(even),
.ai-response-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.chat-message.ai-message .message-content tbody tr:last-child td,
.chat-message.assistant .message-content tbody tr:last-child td,
.search-container.web-search-mode .chat-message .message-content tbody tr:last-child td,
.search-container.web-search-mode .ai-response-table tbody tr:last-child td,
.ai-search-results .ai-response-table tbody tr:last-child td,
.ai-response-table tbody tr:last-child td {
    border-bottom: none;
}

/* 🎨 테이블 내 텍스트 스타일링 */
.ai-response-table td strong,
.chat-message.ai-message .message-content table td strong,
.search-container.web-search-mode .ai-response-table td strong,
.search-container.web-search-mode .chat-message .message-content table td strong,
.ai-search-results .ai-response-table td strong {
    color: #1a202c !important;
    font-weight: 600;
}

.ai-response-table td code,
.chat-message.ai-message .message-content table td code,
.search-container.web-search-mode .ai-response-table td code,
.search-container.web-search-mode .chat-message .message-content table td code,
.ai-search-results .ai-response-table td code {
    background: #f7fafc;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    color: #e53e3e !important;
}

/* 🎯 AI 응답 내 코드 스타일링 */
.chat-message .message-content code,
.search-container .ai-response code {
    background: #f1f5f9 !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-family: 'Monaco', 'Consolas', 'SF Mono', monospace !important;
    font-size: 13px !important;
    color: #374151 !important;
    border: 1px solid #e2e8f0;
}

/* 🎯 AI 헤더 스타일 (### 처리) */
.ai-header-1, .ai-header-2, .ai-header-3, .ai-header-default {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    margin: 16px 0 !important;
    font-weight: 600 !important;
    border-left: 4px solid #ffffff !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* 🚀 히스토리 텍스트 기본 스타일 */
.message-text-content {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.ai-header-1 {
    font-size: 18px !important;
}

.ai-header-2 {
    font-size: 16px !important;
}

.ai-header-3 {
    font-size: 14px !important;
}

.ai-header-default {
    font-size: 14px !important;
}

/* 🎯 최강 리스트 스타일 리셋 - 브라우저 기본값 완전 오버라이드 */
.ai-search-container ul,
.ai-search-container ol,
.ai-search-container li,
.ai-search-results ul,
.ai-search-results ol,
.ai-search-results li,
.search-container ul,
.search-container ol, 
.search-container li,
.chat-message ul,
.chat-message ol,
.chat-message li {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    list-style-position: outside !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
}

.ai-search-container ul:before,
.ai-search-container ol:before,
.ai-search-container li:before,
.ai-search-results ul:before,
.ai-search-results ol:before,
.ai-search-results li:before,
.search-container ul:before,
.search-container ol:before, 
.search-container li:before,
.chat-message ul:before,
.chat-message ol:before,
.chat-message li:before {
    content: none !important;
    display: none !important;
}

/* 🎯 AI 응답 리스트 스타일 (점 표시 완전 제거) */
.chat-message .message-content ul,
.chat-message .message-content ol,
.search-container .ai-response ul,
.search-container .ai-response ol,
.ai-search-results ul,
.ai-search-results ol,
.search-container.web-search-mode .chat-message .message-content ul,
.search-container.web-search-mode .chat-message .message-content ol,
.search-container.web-search-mode .ai-search-results ul,
.search-container.web-search-mode .ai-search-results ol {
    list-style: none !important;
    list-style-type: none !important;
    margin: 12px 0 !important;
    padding-left: 0 !important;
    padding: 0 !important;
}

.chat-message .message-content li,
.search-container .ai-response li,
.ai-search-results li,
.search-container.web-search-mode .chat-message .message-content li,
.search-container.web-search-mode .ai-search-results li {
    margin: 8px 0 !important;
    padding-left: 0 !important;
    padding: 0 !important;
    position: relative;
    line-height: 1.6;
}

/* 🎯 모든 리스트 아이콘 완전 제거 */
.chat-message .message-content ul li:before,
.search-container .ai-response ul li:before,
.ai-search-results ul li:before,
.chat-message .message-content ol li:before,
.search-container .ai-response ol li:before,
.ai-search-results ol li:before,
.search-container.web-search-mode .chat-message .message-content ul li:before,
.search-container.web-search-mode .chat-message .message-content ol li:before,
.search-container.web-search-mode .ai-search-results ul li:before,
.search-container.web-search-mode .ai-search-results ol li:before {
    content: none !important;
    display: none !important;
}

/* 🎯 브라우저 기본 리스트 스타일 강제 제거 */
.chat-message .message-content ul li,
.search-container .ai-response ul li,
.ai-search-results ul li,
.chat-message .message-content ol li,
.search-container .ai-response ol li,
.ai-search-results ol li,
.search-container.web-search-mode .chat-message .message-content ul li,
.search-container.web-search-mode .chat-message .message-content ol li,
.search-container.web-search-mode .ai-search-results ul li,
.search-container.web-search-mode .ai-search-results ol li {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    list-style-position: outside !important;
}

.chat-message.ai-message .message-content h1,
.message-text-content h1,
.chat-message .message-content h1,
.chat-message .message-text h1 {
    font-size: 20px;
}

.chat-message.ai-message .message-content h2,
.message-text-content h2,
.chat-message .message-content h2,
.chat-message .message-text h2 {
    font-size: 18px;
}

.chat-message.ai-message .message-content h3,
.message-text-content h3,
.chat-message .message-content h3,
.chat-message .message-text h3 {
    font-size: 16px;
}

/* 개인화 히스토리 */
.personalized-history {
    padding: 20px;
    background: white;
    flex: 1;
}

.personalized-history h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-list {
    max-height: 350px;
    overflow-y: auto;
}

.history-item {
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: #e9ecef;
    color: #333;
}

.history-item:last-child {
    margin-bottom: 0;
}

.close-personalized:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 🛑 AI 답변 정지 버튼 스타일 */
.ai-stop-container {
    position: fixed;
    bottom: 90px; /* 검색바 위에 위치 */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    animation: fadeInUp 0.3s ease-out;
}

.ai-stop-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-stop-btn:hover {
    background: linear-gradient(135deg, #ff5252 0%, #d32f2f 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.ai-stop-btn:active {
    transform: translateY(0px);
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

.ai-stop-btn i {
    font-size: 16px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 🎯 검색 입력창 비활성화 상태 */
.ai-search-form.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.ai-search-input:disabled {
    background: #f5f5f5 !important;
    color: #999 !important;
    cursor: not-allowed !important;
}

.ai-search-btn:disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* 📊 AI 분석 보고서 스타일 */
.ai-report-section {
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-report-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.ai-report-section .section-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 16px;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-report-section .section-icon {
    font-size: 18px;
}

.ai-report-section .section-content {
    padding: 16px;
    background: rgba(255, 255, 255, 0.95);
    line-height: 1.6;
    color: #2c3e50;
}

/* 🔍 심화분석 섹션 */
.analysis-section .section-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.analysis-section .section-content {
    border-left: 4px solid #667eea;
}

/* 💡 실용조언 섹션 */
.advice-section .section-header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.advice-section .section-content {
    border-left: 4px solid #f093fb;
}

/* 📋 핵심요약 섹션 */
.summary-section .section-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.summary-section .section-content {
    border-left: 4px solid #4facfe;
}

/* 📝 종합정리 섹션 */
.conclusion-section .section-header {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.conclusion-section .section-content {
    border-left: 4px solid #43e97b;
}

/* 📚 배경정보 섹션 */
.background-section .section-header {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.background-section .section-content {
    border-left: 4px solid #fa709a;
}

/* 🔮 전망 섹션 */
.forecast-section .section-header {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #2c3e50 !important;
}

.forecast-section .section-content {
    border-left: 4px solid #a8edea;
}

/* ⭐ 추천사항 섹션 */
.recommendation-section .section-header {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #2c3e50 !important;
}

.recommendation-section .section-content {
    border-left: 4px solid #ffecd2;
}

/* 🎯 모바일 미디어쿼리 - 채팅 메시지 전용 */
@media (max-width: 768px) {
    /* 📱 채팅 컨테이너 모바일 최적화 */
    .ai-search-results-container.chat-mode {
        padding: 0px !important;
        margin: 0 !important;
    }

    .ai-message .message-text {
        margin-bottom: 1px !important;
        padding: 10px 10px !important;
    }

    .personalized-message .ai-avatar {
        display: none !important;
    }
    
    /* 📱 웹검색 모드에서 AI 아바타 숨기기 (공간 절약) */
    .search-container.web-search-mode .ai-avatar,
    .ai-search-results-container .ai-avatar {
        display: none !important;
    }
    
    /* 📱 아바타 숨긴 후 텍스트 영역 조정 (우측 잘림 방지) */
    .search-container.web-search-mode .chat-message.ai-message,
    .ai-search-results-container .chat-message.ai-message {
        margin-right: 8px !important; /* 20px → 8px로 줄임 */
    }
    
    .search-container.web-search-mode .chat-message.ai-message .message-content,
    .ai-search-results-container .chat-message.ai-message .message-content {
        max-width: calc(100% - 15px) !important; /* margin 공간 확보 */
    }

    .ai-search-container .chat-mode .chat-message {
        display: flex !important;
        align-items: flex-start !important;   
        flex-direction: column !important;
    }
    
    .ai-search-input {
        font-size: 15px;
        padding: 8px 0px;
    }

    .chat-message.ai-message .message-content, .search-container.web-search-mode .chat-message.ai-message .message-content {
        max-width: 100% !important;
    }

    .personalized-side-panel {
        width: 100% !important;
    }

    /* 📱 채팅 메시지 전체 */
    .chat-message {
        margin-bottom: 15px !important;
        padding: 8px !important;
        border-radius: 12px !important;
    }
    
    /* 📱 사용자 메시지 */
    .chat-message.user {
        margin-left: 20px !important;
        margin-right: 5px !important;
    }
    
    .chat-message.user .message-content {
        padding: 10px 12px !important;
        max-width: calc(100% - 40px) !important;
    }
    
    /* 📱 AI 메시지 */
    .chat-message.ai-message {
        margin-left: 5px !important;
        margin-right: 20px !important;
    }
    
    .chat-message.ai-message .message-content {
        padding: 1px 5px !important;
    }
    
    /* 📱 아바타 크기 조정 */
    .message-avatar,
    .ai-avatar {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        font-size: 14px !important;
    }
    
    /* 📱 메시지 텍스트 */
    .message-text {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }
    
    .message-text-content {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }
    
    .message-text-content p {
        margin: 6px 0 !important;
        font-size: 14px !important;
        line-height: 1.5 !important;
    }
    
    /* 📱 메시지 시간 */
    .message-time {
        font-size: 11px !important;
        margin-top: 4px !important;
        padding: 0 8px !important;
    }
    
    /* 📱 타이핑 커서 */
    .typing-cursor {
        font-size: 14px !important;
    }
    
    /* 📱 Strong 태그 모바일 최적화 */
    .message-text-content strong {
        font-size: 14px !important;
        padding: 1px 3px !important;
    }
    
    /* 📱 AI 헤더 모바일 최적화 */
    .ai-header-1, .ai-header-2, .ai-header-3, .ai-header-default {
        font-size: 13px !important;
        padding: 6px 10px !important;
        margin: 8px 0 !important;
    }
    
    /* 📱 테이블 모바일 최적화 */
    .chat-message.ai-message .message-content table,
    .ai-response-table {
        font-size: 12px !important;
        margin: 8px 0 !important;
    }
    
    .chat-message.ai-message .message-content th,
    .chat-message.ai-message .message-content td,
    .ai-response-table th,
    .ai-response-table td {
        padding: 6px 8px !important;
        font-size: 12px !important;
    }
    
    /* 📱 코드 블록 모바일 최적화 */
    .message-text-content code,
    .chat-message .message-content code {
        font-size: 12px !important;
        padding: 2px 4px !important;
    }
    
    /* 📱 BR 태그 간격 모바일 조정 */
    .message-text-content br {
        line-height: 1.2 !important;
        margin: 1px 0 !important;
    }
    
    .ai-message .message-text-content br {
        line-height: 1.0 !important;
        margin: 0.5px 0 !important;
    }
    
    /* 📊 모바일 분석 보고서 스타일 */
    .ai-report-section {
        margin: 15px 0 !important;
        border-radius: 8px !important;
    }
    
    .ai-report-section .section-header {
        padding: 10px 12px !important;
        font-size: 14px !important;
    }
    
    .ai-report-section .section-icon {
        font-size: 16px !important;
    }
    
    .ai-report-section .section-content {
        padding: 12px !important;
        font-size: 14px !important;
    }
    
    /* 📱 정지 버튼 모바일 최적화 */
    .ai-stop-container {
        bottom: 80px !important; /* 모바일에서는 더 가깝게 */
    }
    
    .ai-stop-btn {
        padding: 10px 16px !important;
        font-size: 13px !important;
    }
    
    .ai-stop-btn i {
        font-size: 14px !important;
    }
    
    /* 📱 채팅 컨테이너 하단 여유 공간 (검색바에 가려지는 텍스트 방지) */
    .ai-search-results-container.chat-mode,
    .ai-search-results-container {
        padding-bottom: 120px !important; /* 하단 4줄 정도 여유 공간 */
    }
    
    /* 📱 개인채팅/웹검색 모드 버튼을 검색바 위 좌측으로 이동 */
    .mode-btn {
        position: fixed !important;
        bottom: 90px !important; /* 검색바 위에 */
        z-index: 10003 !important;
        margin: 0 !important;
        font-size: 12px !important;
        padding: 8px 12px !important;
        border-radius: 20px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    }
    
    #chatModeBtn {
        left: 20px !important; /* 채팅 버튼 좌측 */
    }
    
    #webSearchModeBtn {
        left: 90px !important; /* 웹검색 버튼 옆에 */
    }
}

/* 🎯 초소형 모바일 (480px 이하) */
@media (max-width: 480px) {
    .ai-search-card {
        margin-top: 50px !important;
        padding: 0px !important;
    }

    .ai-search-form {
        bottom: 10px !important;
    }

    .ai-search-container {
        margin-top: 50px !important;
    }

    .ai-search-results-container.chat-mode {
        margin-top: 50px !important;
    }
    
    .chat-message {
        margin-bottom: 12px !important;
        padding: 6px !important;
    }
    
    .chat-message.user {
        margin-left: 15px !important;
        margin-right: 3px !important;
    }
    
    .chat-message.ai-message {
        margin-left: 3px !important;
        margin-right: 15px !important;
    }
    
    .message-avatar,
    .ai-avatar {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        font-size: 12px !important;
    }
    
    /* 📱 웹검색 모드에서 AI 아바타 숨기기 (공간 절약) */
    .search-container.web-search-mode .ai-avatar,
    .ai-search-results-container .ai-avatar {
        display: none !important;
    }
    
    /* 📱 아바타 숨긴 후 텍스트 영역 조정 (우측 잘림 방지) */
    .search-container.web-search-mode .chat-message.ai-message,
    .ai-search-results-container .chat-message.ai-message {
        margin-right: 6px !important; /* 15px → 6px로 줄임 */
    }
    
    .search-container.web-search-mode .chat-message.ai-message .message-content,
    .ai-search-results-container .chat-message.ai-message .message-content {
        max-width: calc(100% - 12px) !important; /* margin 공간 확보 */
    }
    
    .message-text,
    .message-text-content,
    .message-text-content p {
        font-size: 14px !important;
        line-height: 1.4 !important;
    }
    
    .message-time {
        font-size: 10px !important;
    }
    
    .ai-response-table,
    .ai-response-table th,
    .ai-response-table td {
        font-size: 11px !important;
    }
    
    .ai-response-table th,
    .ai-response-table td {
        padding: 4px 6px !important;
    }
    
    /* 📱 초소형 모바일 정지 버튼 */
    .ai-stop-container {
        bottom: 70px !important;
    }
    
    .ai-stop-btn {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
    
    .ai-stop-btn i {
        font-size: 12px !important;
    }
    
    /* 📊 초소형 모바일 분석 보고서 스타일 */
    .ai-report-section {
        margin: 12px 0 !important;
        border-radius: 6px !important;
    }
    
    .ai-report-section .section-header {
        padding: 8px 10px !important;
        font-size: 13px !important;
    }
    
    .ai-report-section .section-icon {
        font-size: 14px !important;
    }
    
    .ai-report-section .section-content {
        padding: 10px !important;
        font-size: 13px !important;
    }
    
    /* 📱 채팅 컨테이너 하단 여유 공간 (검색바에 가려지는 텍스트 방지) */
    .ai-search-results-container.chat-mode,
    .ai-search-results-container {
        padding-bottom: 100px !important; /* 초소형에서는 조금 작게 */
    }
    
    /* 📱 개인채팅/웹검색 모드 버튼을 검색바 위 좌측으로 이동 */
    .mode-btn {
        position: fixed !important;
        bottom: 80px !important; /* 검색바 위에 */
        z-index: 10003 !important;
        margin: 0 !important;
        font-size: 11px !important;
        padding: 6px 10px !important;
        border-radius: 16px !important;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2) !important;
    }
    
    #chatModeBtn {
        left: 15px !important; /* 채팅 버튼 좌측 */
    }
    
    #webSearchModeBtn {
        left: 75px !important; /* 웹검색 버튼 옆에 (더 작은 간격) */
    }
}