/* 기본 스타일 및 CSS 변수 */
:root {
  --primary-color: #0ea5e9;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --secondary-color: #64748b;
  --secondary-dark: #334155;
  --secondary-light: #f1f5f9;
  --error-color: #ef4444;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --bg-light: #f8fafc;
  --bg-dark: #0f172a;
  --text-dark: #1e293b;
  --text-light: #e2e8f0;
}

html {
  font-size: 90%;
}

body {
  margin: 0 !important;
  font-family: 'Noto Sans KR', sans-serif;
  scroll-behavior: smooth;
  touch-action: manipulation;
  -webkit-overflow-scrolling: touch;
  background-color: var(--bg-light);
  color: var(--text-dark);
}

.dark {
  background-color: var(--bg-dark);
  color: var(--text-light);
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background-color: #f1f5f9;
  border-radius: 4px;
}
.dark ::-webkit-scrollbar-track {
  background-color: #1e293b;
}
::-webkit-scrollbar-thumb {
  background-color: #94a3b8;
  border-radius: 4px;
}
.dark ::-webkit-scrollbar-thumb {
  background-color: #475569;
}
::-webkit-scrollbar-thumb:hover {
  background-color: #64748b;
}
.dark ::-webkit-scrollbar-thumb:hover {
  background-color: #64748b;
}

/* 로딩 스피너 */
@keyframes spinner {
  to { transform: rotate(360deg); }
}
.loading-spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spinner 1s linear infinite;
  margin-right: 0.5rem;
}

/* 모션 감소 미디어 쿼리 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* hover 효과 */
.filter-fade {
  transition: filter 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.filter-fade:hover {
  filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
  transform: scale(1.02);
}

/* 초점 아웃라인 */
*:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* 스켈레톤 로더 */
.skeleton {
  background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
  background-size: 200% 100%;
  animation: 1.5s shine linear infinite;
}
.dark .skeleton {
  background: linear-gradient(110deg, #2a2a2a 8%, #3a3a3a 18%, #2a2a2a 33%);
  background-size: 200% 100%;
  animation: 1.5s shine linear infinite;
}
@keyframes shine {
  to { background-position-x: -200%; }
}

/* 다크모드 전환 애니메이션 */
.transition-colors,
.transition-bg {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* 로그인 페이지 */
.login-container {
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  padding: 2.5rem;
  width: 100%;
  max-width: 450px;
  margin: 0 auto;
  transition: all 0.3s ease;
}
.dark .login-container {
  background-color: #1e293b;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
.login-logo {
  max-height: 60px;
  margin-bottom: 1.5rem;
}
.login-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.5rem;
  text-align: center;
}
.dark .login-heading {
  color: #f8fafc;
}
.login-subheading {
  color: #64748b;
  text-align: center;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}
.dark .login-subheading {
  color: #cbd5e1;
}
.form-group {
  margin-bottom: 1.5rem;
}
.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
}
.dark .form-label {
  color: #e2e8f0;
}
.form-input {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  background-color: #fff;
  color: #0f172a;
}
.role-select {
  cursor: pointer;
  min-width: 90px;
}
.dark .form-input {
  background-color: #1e293b;
  border-color: #475569;
  color: #f8fafc;
}
.form-input:focus {
  border-color: #3b82f6;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
.btn-primary {
  display: block;
  width: 100%;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  color: #fff;
  background-color: #0ea5e9;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: #0284c7;
}
.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.btn-secondary {
  background-color: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
  display: block;
  width: 100%;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}
.dark .btn-secondary {
  border-color: #475569;
  color: #cbd5e1;
}
.btn-secondary:hover,
.btn-secondary:focus {
  background-color: #f1f5f9;
  color: #334155;
}
.dark .btn-secondary:hover,
.dark .btn-secondary:focus {
  background-color: #334155;
  color: #f8fafc;
}
.form-check {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}
.form-check-input {
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  accent-color: #0ea5e9;
}
.form-check-label {
  font-size: 0.875rem;
  color: #475569;
}
.dark .form-check-label {
  color: #cbd5e1;
}
.form-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  font-size: 0.75rem;
  color: #64748b;
}
.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e2e8f0;
}
.dark .form-divider::before,
.dark .form-divider::after {
  border-color: #475569;
}
.form-divider span {
  padding: 0 0.75rem;
}
.form-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: #64748b;
}
.dark .form-footer {
  color: #cbd5e1;
}
.form-link {
  color: #0ea5e9;
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}
.form-link:hover {
  color: #0284c7;
  text-decoration: underline;
}
.password-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem;
}
.dark .password-toggle {
  color: #94a3b8;
}
.password-toggle:hover {
  color: #334155;
}
.dark .password-toggle:hover {
  color: #e2e8f0;
}
.input-group {
  position: relative;
}
.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
}
.dark .input-icon {
  color: #94a3b8;
}
.input-with-icon {
  padding-left: 2.5rem;
}
.alert {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}
.alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.dark .alert-danger {
  background-color: rgba(239, 68, 68, 0.2);
}
.alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.dark .alert-success {
  background-color: rgba(16, 185, 129, 0.2);
}

/* 사이드바 및 메인 UI */
.sidebar {
  width: 260px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background-color: #fff;
  border-right: 1px solid #e2e8f0;
  z-index: 40;
  display: flex;
  flex-direction: column;
}
.dark .sidebar {
  background-color: #1e293b;
  border-color: #334155;
}
.sidebar-collapsed {
  width: 80px;
}
.sidebar-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dark .sidebar-header {
  border-color: #334155;
}
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
.sidebar-footer {
  border-top: 1px solid #e2e8f0;
  padding: 1rem;
}
.dark .sidebar-footer {
  border-color: #334155;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: #475569;
  text-decoration: none;
  transition: all 0.15s ease;
}
.dark .sidebar-nav-item {
  color: #cbd5e1;
}
.sidebar-nav-item:hover {
  background-color: #f8fafc;
  color: #0ea5e9;
}
.dark .sidebar-nav-item:hover {
  background-color: #334155;
  color: #38bdf8;
}
.sidebar-nav-item.active {
  background-color: #f0f9ff;
  color: #0ea5e9;
  font-weight: 500;
}
.dark .sidebar-nav-item.active {
  background-color: #0c4a6e;
  color: #38bdf8;
}
.sidebar-nav-icon {
  margin-right: 0.75rem;
  width: 20px;
  text-align: center;
}
.main-content {
  margin-left: 260px;
  padding: 2rem;
  min-height: 100vh;
  width: calc(100% - 260px);
}
.main-content-expanded {
  margin-left: 80px;
  width: calc(100% - 80px);
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}
.header-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
}
.dark .header-title {
  color: #f8fafc;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
              0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 60;
  display: flex;
  align-items: center;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: translateY(1rem);
  opacity: 0;
  pointer-events: none;
}
.dark .toast {
  background-color: #1e293b;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.toast-icon {
  margin-right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
}
.toast-success .toast-icon {
  background-color: rgba(16, 185, 129, 0.2);
  color: #10b981;
}
.toast-error .toast-icon {
  background-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}
.toast-warning .toast-icon {
  background-color: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}
.toast-content {
  flex: 1;
}
.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: #1e293b;
}
.dark .toast-title {
  color: #f8fafc;
}
.toast-message {
  font-size: 0.875rem;
  color: #64748b;
}
.dark .toast-message {
  color: #cbd5e1;
}
.toast-close {
  margin-left: 1rem;
  color: #64748b;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
}
.dark .toast-close {
  color: #cbd5e1;
}
.toast-close:hover {
  color: #334155;
}
.dark .toast-close:hover {
  color: #f8fafc;
}

/* 관리자 패널 */
.admin-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background-color: #fff;
  border-left: 1px solid #e2e8f0;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);
  z-index: 45;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}
.dark .admin-panel {
  background-color: #1e293b;
  border-color: #334155;
}
.admin-panel.open {
  transform: translateX(0);
}
.admin-panel-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dark .admin-panel-header {
  border-color: #334155;
}
.admin-panel-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
}
.dark .admin-panel-title {
  color: #f8fafc;
}
.admin-panel-close {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 1.25rem;
}
.dark .admin-panel-close {
  color: #cbd5e1;
}
.admin-panel-content {
  padding: 1.5rem;
}
.admin-panel-section {
  margin-bottom: 2rem;
}
.admin-panel-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}
.dark .admin-panel-section-title {
  color: #f8fafc;
}
.admin-panel-section-title i {
  margin-right: 0.5rem;
  color: #0ea5e9;
}
.admin-panel-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.admin-action-btn {
  padding: 0.625rem;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.dark .admin-action-btn {
  background-color: #334155;
  border-color: #475569;
  color: #cbd5e1;
}
.admin-action-btn:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  color: #0ea5e9;
  transform: translateY(-2px);
}
.dark .admin-action-btn:hover {
  background-color: #1e293b;
  border-color: #94a3b8;
  color: #38bdf8;
}
.admin-action-btn i {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}
.admin-action-btn.save-btn {
  grid-column: span 2;
  background-color: #0ea5e9;
  color: white;
}
.admin-action-btn.save-btn:hover {
  background-color: #0284c7;
}
.admin-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 44;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.admin-panel-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* 세션 메뉴 */
.session-menu {
  display: inline-flex;
  margin-left: 0.5rem;
  vertical-align: middle;
}
.session-dropdown {
  position: relative;
  display: inline-block;
}
.session-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dark .session-dropdown-toggle {
  color: #e2e8f0;
  background-color: #1e293b;
  border-color: #475569;
}
.session-dropdown-toggle:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}
.dark .session-dropdown-toggle:hover {
  background-color: #334155;
  border-color: #64748b;
}
.session-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  min-width:10rem;
  padding: 0.5rem 0;
  margin-top: 0.25rem;
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
              0 4px 6px -2px rgba(0, 0, 0, 0.05);
  display: none;
}
.dark .session-dropdown-menu {
  background-color: #1e293b;
  border-color: #475569;
}
.session-dropdown-menu.show {
  display: block;
}
.session-dropdown-item {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: #475569;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.dark .session-dropdown-item {
  color: #e2e8f0;
}
.session-dropdown-item:hover {
  background-color: #f8fafc;
}
.dark .session-dropdown-item:hover {
  background-color: #334155;
}
.session-dropdown-item.active {
  background-color: #f0f9ff;
  color: #0ea5e9;
  font-weight: 500;
}
.dark .session-dropdown-item.active {
  background-color: #0c4a6e;
  color: #38bdf8;
}

/* 모바일 대응 */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content,
  .main-content-expanded {
    margin-left: 0;
    width: 100%;
  }
  .mobile-toggle {
    display: block !important;
  }
  .admin-panel {
    width: 280px;
  }
  .search-session-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .session-menu {
    margin-left: 0;
    margin-top: 0.5rem;
    width: 100%;
  }
  .session-dropdown-toggle {
    width: 100%;
    justify-content: space-between;
  }
}

/* 파일 업로드 */
.file-upload-container {
  margin-bottom: 1rem;
}
.file-upload-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
}
.dark .file-upload-label {
  color: #e2e8f0;
}
.file-upload-input {
  display: none;
}
.file-upload-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dark .file-upload-btn {
  color: #e2e8f0;
  background-color: #334155;
  border-color: #475569;
}
.file-upload-btn:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}
.dark .file-upload-btn:hover {
  background-color: #1e293b;
  border-color: #64748b;
}
.file-upload-btn i {
  margin-right: 0.5rem;
}
.file-upload-filename {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
}
.dark .file-upload-filename {
  color: #94a3b8;
}

/* 검색 및 세션 */
.search-session-container {
  display: flex;
  align-items: center;
  width: 100%;
}

/* 새로 추가된 스타일: GPT 채팅 */
/* 채팅 컨테이너 */
#gpt-chat-container {
  transition: all 0.3s ease;
}

/* 채팅 헤더 */
.chat-header {
  z-index: 10;
}

/* 채팅 메시지 영역 */
#chat-messages {
  scroll-behavior: smooth;
}

/* 채팅 메시지 스타일 */
.chat-message {
  display: flex;
  margin-bottom: 1.5rem;
  max-width: 85%;
}

.chat-message.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.chat-message.assistant {
  margin-right: auto;
}

.chat-message-content {
  padding: 1rem;
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.chat-message.user .chat-message-content {
  background-color: #0ea5e9;
  color: white;
  border-top-right-radius: 0.25rem;
  margin-left: 0.5rem;
}

.chat-message.assistant .chat-message-content {
  background-color: #f8fafc;
  color: #1e293b;
  border-top-left-radius: 0.25rem;
  margin-right: 0.5rem;
}

.dark .chat-message.assistant .chat-message-content {
  background-color: #334155;
  color: #e2e8f0;
}

.chat-message-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user .chat-message-avatar {
  background-color: #0284c7;
  color: white;
}

.assistant .chat-message-avatar {
  background-color: #10b981;
  color: white;
}

.chat-message-time {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
  text-align: right;
}

.dark .chat-message-time {
  color: #94a3b8;
}

/* 채팅 입력 영역 */
.chat-input-container {
  border-top: 1px solid #e2e8f0;
}

.dark .chat-input-container {
  border-color: #334155;
}

#chat-input-box {
  outline: none;
  resize: none;
  max-height: 200px;
  overflow-y: auto;
}

#chat-input-box:empty:before {
  content: attr(placeholder);
  color: #94a3b8;
  pointer-events: none;
}

/* 파일 미리보기 영역 */
#file-preview-area {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.file-preview-item {
  position: relative;
  border-radius: 0.375rem;
  border: 1px solid #e2e8f0;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  background-color: #f8fafc;
  max-width: 200px;
}

.dark .file-preview-item {
  background-color: #1e293b;
  border-color: #475569;
}

.file-preview-icon {
  margin-right: 0.5rem;
  color: #64748b;
}

.dark .file-preview-icon {
  color: #94a3b8;
}

.file-preview-name {
  font-size: 0.75rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.dark .file-preview-name {
  color: #e2e8f0;
}

.file-preview-remove {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  background-color: #ef4444;
  color: white;
  border-radius: 9999px;
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
}

.file-preview-image {
  max-width: 100%;
  max-height: 120px;
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
}

/* 마크다운 스타일 */
.markdown-content {
  line-height: 1.6;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
}

.markdown-content h1 {
  font-size: 1.5rem;
}

.markdown-content h2 {
  font-size: 1.25rem;
}

.markdown-content h3 {
  font-size: 1.125rem;
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol {
  margin-bottom: 1em;
}

.markdown-content ul,
.markdown-content ol {
  padding-left: 1.5em;
}

.markdown-content li {
  margin-bottom: 0.5em;
}

.markdown-content code {
  background-color: #f1f5f9;
  color: #0f172a;
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  font-family: monospace;
  font-size: 0.9em;
}

.dark .markdown-content code {
  background-color: #334155;
  color: #e2e8f0;
}

.markdown-content pre {
  background-color: #f1f5f9;
  color: #0f172a;
  padding: 1em;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1em 0;
}

.dark .markdown-content pre {
  background-color: #1e293b;
  color: #e2e8f0;
}

.markdown-content pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

.markdown-content blockquote {
  border-left: 4px solid #cbd5e1;
  padding-left: 1em;
  margin-left: 0;
  margin-right: 0;
  font-style: italic;
  color: #64748b;
}

.dark .markdown-content blockquote {
  border-color: #475569;
  color: #94a3b8;
}

.markdown-content a {
  color: #0ea5e9;
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.markdown-content th,
.markdown-content td {
  border: 1px solid #e2e8f0;
  padding: 0.5em;
  text-align: left;
}

.dark .markdown-content th,
.dark .markdown-content td {
  border-color: #475569;
}

.markdown-content th {
  background-color: #f8fafc;
  font-weight: 600;
}

.dark .markdown-content th {
  background-color: #1e293b;
}

/* 채팅 히스토리 스타일 */
.chat-history-item {
  background-color: #fff;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.dark .chat-history-item {
  background-color: #1e293b;
  border-color: #475569;
}

.chat-history-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
              0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.chat-history-title {
  font-weight: 600;
  font-size: 1.125rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.dark .chat-history-title {
  color: #f8fafc;
}

.chat-history-preview {
  color: #64748b;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dark .chat-history-preview {
  color: #94a3b8;
}

.chat-history-time {
  color: #94a3b8;
  font-size: 0.75rem;
  margin-top: 0.5rem;
  text-align: right;
}

.dark .chat-history-time {
  color: #64748b;
}

/* 즐겨찾기 스타일 수정 - !important 우선순위 지정 */
.favorite-toggle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.2s ease;
  z-index: 10;
  padding: 4px;
}

.favorite-toggle:hover {
  transform: scale(1.2);
}

/* 활성화된 즐겨찾기 별 색상을 노란색으로 변경 - !important 추가 */
.favorite-toggle.active .fa-star {
  color: #f59e0b !important; /* amber-500 색상으로 강제 지정 */
}

/* 활성화되지 않은 별도 회색으로 명확하게 표시 - !important 추가 */
.favorite-toggle:not(.active) .fa-star {
  color: #94a3b8 !important; /* gray-400 색상으로 강제 지정 */
}
  /* 즐겨찾기 별 색상 명확하게 지정 */
  .favorite-toggle.active .fa-star {
    color: #f59e0b !important; /* amber-500 색상으로 강제 지정 */
  }
  
  .favorite-toggle:not(.active) .fa-star {
    color: #94a3b8 !important; /* gray-400 색상으로 강제 지정 */
  }
.favorites-empty {
  text-align: center;
  padding: 1rem;
  color: #64748b;
  font-size: 0.875rem;
}

.dark .favorites-empty {
  color: #94a3b8;
}

/* 로딩 스피너 애니메이션 */
.typing-indicator {
  display: flex;
  align-items: center;
  margin-top: 0.5rem;
}

.typing-indicator span {
  height: 0.5rem;
  width: 0.5rem;
  margin: 0 0.1rem;
  background-color: #94a3b8;
  display: block;
  border-radius: 50%;
  opacity: 0.4;
}

.dark .typing-indicator span {
  background-color: #cbd5e1;
}

.typing-indicator span:nth-of-type(1) {
  animation: typing 1s infinite;
}

.typing-indicator span:nth-of-type(2) {
  animation: typing 1s 0.2s infinite;
}

.typing-indicator span:nth-of-type(3) {
  animation: typing 1s 0.4s infinite;
}

@keyframes typing {
  0% {
    opacity: 0.4;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-0.5rem);
  }
  100% {
    opacity: 0.4;
    transform: translateY(0);
  }
}

/* 파일 첨부 및 드래그 앤 드롭 영역 */
.file-drop-area {
  border: 2px dashed #cbd5e1;
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

.dark .file-drop-area {
  border-color: #475569;
}

.file-drop-area.drag-over {
  border-color: #0ea5e9;
  background-color: rgba(14, 165, 233, 0.05);
}

.dark .file-drop-area.drag-over {
  background-color: rgba(14, 165, 233, 0.1);
}

.file-drop-message {
  color: #64748b;
  font-size: 0.875rem;
}

.dark .file-drop-message {
  color: #94a3b8;
}

.file-drop-icon {
  font-size: 2rem;
  color: #94a3b8;
  margin-bottom: 0.5rem;
}

.dark .file-drop-icon {
  color: #64748b;
}

  /* 로그인 컨테이너와 앱 컨테이너가 겹치지 않도록 z-index 조정 */
  #login-container {
    z-index: 999 !important; /* 로그인이 항상 최상위에 */
  }
  
  /* 로그인 상태일 때 로그인 화면 강제로 숨김 */
  .logged-in #login-container {
    display: none !important;
  }
  
  /* 로그인 상태가 아닐 때 앱 강제로 숨김 */
  .logged-out #app-container {
    display: none !important;
  }
