/* H³NGST Common Styles */

/* Processing Overlay */
#processingOverlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(255, 255, 255, 0.95); z-index: 9999;
  display: none; justify-content: center; align-items: center; flex-direction: column;
}

/* Language Switcher */
.lang-switcher {
  position: fixed; top: 1rem; right: 1rem; z-index: 1000;
  display: flex; gap: 0.25rem; background: #fff;
  border-radius: 8px; padding: 0.25rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.lang-btn {
  border: none; background: transparent; padding: 0.5rem 0.75rem;
  border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 0.85rem;
  transition: all 0.2s;
}
.lang-btn:hover { background: #f1f1f1; }
.lang-btn.active { background: #0d6efd; color: #fff; }

/* Brand Header */
.brand-header { text-align: center; padding: 2rem 0 1rem; }
.brand-title { font-size: 3rem; font-weight: 700; color: #212529; margin: 0; }
.brand-title sup { font-size: 0.5em; color: #0d6efd; }
.brand-subtitle { color: #6c757d; font-style: italic; margin-top: 0.25rem; }

/* Citation Box */
.citation-box {
  background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
  border: 1px solid #f0e6c8; border-radius: 12px;
  padding: 1.25rem 1.5rem; margin: 1.5rem 0;
}
.citation-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.citation-header i { color: #d4a012; font-size: 1.5rem; }
.citation-header span { font-weight: 700; color: #8b6914; font-size: 1.1rem; }
.citation-reason { color: #6b5a1e; font-size: 0.9rem; margin-bottom: 1rem; }
.citation-content {
  background: #fffef8; border: 1px solid #e8ddb5; border-radius: 8px;
  padding: 1rem; font-size: 0.9rem; color: #4a4a4a; line-height: 1.6;
}
.citation-buttons { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.btn-copy-citation {
  background: #fff; border: 1px solid #d4a012; color: #8b6914;
  padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem; cursor: pointer;
}
.btn-copy-citation:hover { background: #fff9e6; }
.citation-heart { color: #e74c3c; font-size: 0.85rem; }

/* Main Card */
.main-card {
  background: #fff; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08); padding: 2rem; margin-bottom: 1.5rem;
}
.section-title {
  font-size: 1.25rem; font-weight: 600; color: #212529;
  margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem;
}

/* Warning Box */
.warning-box {
  background: #fff5f5; border: 1px solid #f5c6cb; border-radius: 8px;
  padding: 0.875rem 1rem; margin-top: 0.75rem; font-size: 0.85rem; color: #721c24;
}
.warning-box p { margin: 0.25rem 0; }

/* Nickname Box */
.nickname-box {
  background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px;
  padding: 1rem; margin-top: 1rem;
}
.nickname-box h6 { font-size: 0.85rem; color: #495057; margin-bottom: 0.5rem; font-weight: 600; }
#nicknameList { max-height: 80px; overflow-y: auto; margin-bottom: 0.5rem; }
#nicknameList .list-group-item {
  padding: 0.375rem 0.5rem; font-size: 0.8rem; cursor: pointer;
  border: none; background: transparent;
}
#nicknameList .list-group-item:hover { background: #e7f1ff; border-radius: 4px; }

/* NCBI Search Box */
.ncbi-search-box {
  background: linear-gradient(135deg, #e8f4fc 0%, #d4edfc 100%);
  border: 1px solid #b8daef; border-radius: 10px;
  padding: 1rem 1.25rem; margin-top: 1.5rem;
}
.ncbi-search-box label { font-size: 0.9rem; color: #1565c0; font-weight: 600; margin-bottom: 0.5rem; display: block; }
.ncbi-search-box .input-group { max-width: 450px; }
.ncbi-search-box input { border: 1px solid #90caf9; font-size: 0.9rem; }
.ncbi-search-box .btn { background: #1976d2; border-color: #1976d2; color: #fff; }
.ncbi-search-box .btn:hover { background: #1565c0; }

/* Notice Section */
.notice-section {
  background: #fff; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08); overflow: hidden;
}
.notice-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff; padding: 1rem 1.5rem; font-weight: 600; font-size: 1rem;
}
.notice-list { padding: 0; margin: 0; list-style: none; }
.notice-item {
  padding: 0.875rem 1.25rem; border-bottom: 1px solid #f1f1f1;
  display: flex; align-items: flex-start; gap: 0.75rem;
}
.notice-item:last-child { border-bottom: none; }
.notice-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; flex-shrink: 0;
}
.notice-icon.new { background: #d4edda; color: #155724; }
.notice-icon.update { background: #cce5ff; color: #004085; }
.notice-icon.warning { background: #f8d7da; color: #721c24; }
.notice-content { flex: 1; }
.notice-title { font-weight: 600; font-size: 0.9rem; color: #212529; }
.notice-desc { font-size: 0.8rem; color: #6c757d; margin-top: 0.15rem; }
.notice-date { font-size: 0.7rem; color: #adb5bd; white-space: nowrap; }

/* Community Section */
.community-btn-section {
  background: #fff; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08); overflow: hidden;
}
.community-header {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: #fff; padding: 1rem 1.5rem; font-weight: 600; font-size: 1rem;
}
.community-body { padding: 1.5rem; text-align: center; }
.community-body p { color: #6c757d; margin-bottom: 1rem; font-size: 0.9rem; }
.btn-community {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  border: none; color: #fff; padding: 0.75rem 2rem; border-radius: 8px;
  font-weight: 600; text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.5rem;
  transition: all 0.2s;
}
.btn-community:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(17, 153, 142, 0.4); }

/* Step Badge */
.step-badge {
  background: #0d6efd; color: white; padding: 0.25rem 0.75rem;
  border-radius: 20px; font-size: 0.85rem; font-weight: 500;
}

/* Footer */
.footer { text-align: center; padding: 2rem 0; color: #6c757d; font-size: 0.8rem; }
.footer a { color: #6c757d; text-decoration: none; margin: 0 0.5rem; }
.footer a:hover { color: #0d6efd; }

/* Selection Counter */
.selection-counter {
  background: #e7f1ff; border: 1px solid #0d6efd; border-radius: 8px;
  padding: 0.5rem 1rem; display: inline-block; font-size: 0.9rem;
}
.selection-counter .count { font-weight: 700; color: #0d6efd; }

/* Badges */
.chip-badge { background: #198754; color: white; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; }
.layout-badge { padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; }
.layout-paired { background: #cfe2ff; color: #084298; }
.layout-single { background: #f8d7da; color: #842029; }
.admin-badge { background: #dc3545; color: #fff; font-size: 0.65rem; padding: 0.15rem 0.4rem; border-radius: 3px; font-weight: 600; }

/* Success Banner */
.success-banner {
  background: linear-gradient(135deg, #d1e7dd 0%, #badbcc 100%);
  border: 1px solid #0f5132; border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem;
}
.success-banner h4 { color: #0f5132; margin-bottom: 0.5rem; }
.success-banner p { color: #0f5132; margin: 0; }

/* Page Header (Community) */
.page-header {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: #fff; padding: 2rem 0; margin-bottom: 2rem;
}
.page-header h1 { font-size: 2rem; font-weight: 700; margin: 0; }
.page-header p { margin: 0.5rem 0 0; opacity: 0.9; }

/* Post Card */
.post-card {
  background: #fff; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08); margin-bottom: 1rem; overflow: hidden;
}
.post-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid #f1f1f1;
  display: flex; align-items: center; gap: 0.75rem;
}
.post-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600;
}
.post-body { padding: 1.25rem; }
.post-content { font-size: 0.95rem; color: #495057; line-height: 1.7; white-space: pre-wrap; }

/* Empty State */
.empty-state { text-align: center; padding: 4rem 2rem; color: #adb5bd; }
.empty-state i { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h5 { color: #6c757d; }


/* ============================================================================
   H³NGST AI Assistant Styles
   ============================================================================ */

/* AI Assistant Card */
.ai-assistant-card {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
}

/* Chat Container - 고정 높이, 내부 스크롤 */
.ai-chat-container {
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

/* Messages Area - 스크롤 가능 (핵심!) */
.ai-chat-messages {
  height: 280px !important;
  max-height: 280px !important;
  min-height: 280px !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  padding: 1rem;
}

/* Message Bubbles */
.ai-message {
  display: flex;
  gap: 0.5rem;
  max-width: 85%;
  margin-bottom: 0.75rem;
}

.ai-message-user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.ai-message-bot {
  margin-right: auto;
}

.ai-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.ai-message-bot .ai-avatar {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #ffffff;
}

.ai-message-user .ai-avatar {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #ffffff;
}

.ai-bubble {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
}

.ai-message-bot .ai-bubble {
  background: #f3f4f6;
  border-bottom-left-radius: 4px;
  color: #1f2937;
}

.ai-message-user .ai-bubble {
  background: #8b5cf6;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* Suggestion Buttons */
.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.ai-suggestion-btn {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #374151;
}

.ai-suggestion-btn:hover {
  background: #e0f2fe;
  border-color: #0ea5e9;
  color: #0369a1;
}

/* Input Area */
.ai-chat-input {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.ai-chat-input input {
  flex: 1;
  border-radius: 20px;
  padding-left: 1rem;
  border: 1px solid #d1d5db;
}

.ai-chat-input input:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.ai-chat-input button {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Dataset Cards (clickable results) */
.ai-dataset-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}

.ai-dataset-card:hover {
  background: #dcfce7;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-dataset-id {
  font-family: 'Consolas', 'Monaco', monospace;
  font-weight: 600;
  color: #16a34a;
  cursor: pointer;
}

.ai-dataset-id:hover {
  text-decoration: underline;
}

/* Typing Indicator */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 0.5rem;
  align-items: center;
}

.ai-typing span {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: ai-typing-bounce 1.4s infinite ease-in-out;
}

.ai-typing span:nth-child(1) { animation-delay: 0s; }
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ai-typing-bounce {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Markdown-like Styling in AI Responses */
.ai-bubble h3 {
  font-size: 1rem;
  margin: 0.5rem 0 0.25rem 0;
  font-weight: 600;
  color: #1f2937;
}

.ai-bubble strong {
  font-weight: 600;
}

.ai-bubble ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.ai-bubble li {
  margin: 0.25rem 0;
}

.ai-bubble code {
  background: #e5e7eb;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.85em;
}

/* Scrollbar Styling */
.ai-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Responsive */
@media (max-width: 576px) {
  .ai-chat-messages {
    height: 220px !important;
    max-height: 220px !important;
    min-height: 220px !important;
  }
  
  .ai-message {
    max-width: 95%;
  }
  
  .ai-suggestion-btn {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }
}