/* ============================================================
 * 유틸리티 & 헬퍼 클래스 (Utilities & Helpers)
 * 분리 날짜: 2025-10-02 (Phase 2.2h)
 * 원본 위치: assets/css_inline/head_style_0018.css (171 라인)
 * ============================================================ */

/* ========== 사용자 메뉴 드롭다운 (387-431, 45 라인) ========== */
.user-menu {
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 100;
  margin-top: 8px;
}

.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.dropdown-item:hover {
  background: var(--bg-secondary);
}

.dropdown-item:first-child {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.dropdown-item:last-child {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* ========== 알림 시스템 (433-491, 59 라인) ========== */
.notification {
  position: fixed;
  top: 20px;
  right: -370px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 9000;
  transition: right 0.3s ease;
  max-width: 350px;
}

.notification.show {
  right: 20px;
}

.notification.success {
  border-left: 4px solid var(--success-color);
}

.notification.error {
  border-left: 4px solid var(--error-color);
}

.notification.warning {
  border-left: 4px solid var(--warning-color);
}

.notification.info {
  border-left: 4px solid var(--accent-color);
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.notification-title {
  font-weight: 600;
  font-size: 14px;
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
}

.notification-message {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ========== 로딩 스피너 (496-521, 26 라인) ========== */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9998;
}

.loading-screen.show {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ========== 사이드바 스크롤바 숨김 (브라우저 기본 스크롤 유지) ========== */
.sidebar,
.sidebar .chat-history {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.sidebar::-webkit-scrollbar,
.sidebar .chat-history::-webkit-scrollbar,
.sidebar::-webkit-scrollbar-track,
.sidebar .chat-history::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-thumb,
.sidebar .chat-history::-webkit-scrollbar-thumb {
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
  display: none !important;
}

/* ========== 스크롤 성능 최적화 (729-737, 9 라인) ========== */
.chat-messages,
.sidebar,
.chat-history {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  transform: translateZ(0);
  will-change: scroll-position;
}

/* ========== 사이드바 오버레이 (749-764, 16 라인) ========== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 98;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
  display: block;
}

/* ========== 키보드 표시 시 레이아웃 조정 (786-794) ========== */
@supports (height: 100dvh) {
  .main-content {
    min-height: 100dvh;
    height: auto !important;
  }

  .chat-messages {
    min-height: calc(100dvh - 88px); /* 헤더 36px + 입력창 52px */
    height: auto !important;
  }
}

/* ========== 모바일 전용 요소 숨기기 (771-773) ========== */
.mobile-actions-dropdown {
  display: none !important;
}
