/* ========== 통합 드롭다운 메뉴 (2025-09-30) ========== */
/* 추출 일자: 2025-10-02 */
/* 원본: assets/css_inline/head_style_0018.css (라인 4722-4951) */

/* [선택적 개선 - 쉬운 풀이: 공통 여백/모서리 변수로 관리하면 유지보수 쉬워짐] */
.unified-dropdown {
  --ud-border: var(--border, #e5e7eb);
  --ud-bg-elev: var(--bg-elev, #ffffff);
  --ud-text: var(--text, #1c1f3b);
  --ud-text-muted: var(--text-muted, #6b7280);
  --ud-primary: var(--primary, #6a55ff);
  --ud-hover-bg: var(--hover-bg, rgba(106, 85, 255, 0.08));
  --ud-radius-lg: 16px;
  --ud-radius-md: 12px;
  --ud-radius-sm: 10px;
  --ud-pad-y: 12px;
  --ud-pad-x: 12px;
  --ud-transition-fast: 0.2s;
  --ud-transition-mid: 0.3s;
}

.unified-dropdown {
  position: relative;
}

.unified-dropdown-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--ud-bg-elev);
  border: 2px solid var(--ud-border);
  border-radius: var(--ud-radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--ud-text);
  transition: all var(--ud-transition-fast);
  white-space: nowrap;
}

.unified-dropdown-button:hover {
  background: var(--bg-secondary, #f9fafb);
  border-color: var(--ud-primary);
}

.unified-dropdown-button .icon {
  font-size: 18px;
}

.unified-dropdown-button .web-indicator {
  display: none; /* 기본값: 숨김 (웹 검색 활성화 시에만 표시) */
  font-size: 16px;
  margin-left: -4px;
  opacity: 0.9;
  animation: pulse 2s ease-in-out infinite;
}

.unified-dropdown-button .web-indicator.is-active {
  display: inline-flex;
  align-items: center;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

.unified-dropdown-button .arrow {
  font-size: 12px;
  transition: transform var(--ud-transition-fast);
}

.unified-dropdown.open .unified-dropdown-button .arrow {
  transform: rotate(180deg);
}

/* 드롭다운 메뉴 - 기본 숨김 */
.unified-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 280px;
  background: var(--ud-bg-elev);
  border: 2px solid var(--ud-border);
  border-radius: var(--ud-radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  z-index: 200 !important; /* 사이드바(150)보다 위에 */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--ud-transition-fast) cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 500px;
  overflow-y: auto;
}

.unified-dropdown.open .unified-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 드롭다운 섹션 */
.dropdown-section {
  padding: 12px 8px;
  border-bottom: 1px solid var(--ud-border);
}

.dropdown-section:last-child {
  border-bottom: none;
}

.dropdown-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ud-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  margin-bottom: 4px;
}

/* 드롭다운 옵션 */
.dropdown-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ud-pad-y) var(--ud-pad-x);
  margin: 2px 0;
  border-radius: var(--ud-radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.dropdown-option:hover {
  background: var(--ud-hover-bg);
}

/* [변경] active 상태 흰색 처리 한 번에 묶기 (중복 제거) */
.dropdown-option.active,
.dropdown-option.active .icon,
.dropdown-option.active .name,
.dropdown-option.active .description {
  color: #ffffff !important;
}
.dropdown-option.active {
  background: var(--ud-primary);
}

.dropdown-option-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.dropdown-option-content .icon {
  font-size: 20px;
}

.dropdown-option-content .name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ud-text);
}

.dropdown-option-content .description {
  font-size: 12px;
  color: var(--ud-text-muted);
  margin-top: 2px;
}

.dropdown-option .badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
}

/* 토글 옵션 */

/* [변경] .dropdown-option, .toggle-option 공통 레이아웃 묶기 (완전 동일 부분만) */
.dropdown-option,
.toggle-option {
  /* 동일한 여백/모서리/레이아웃을 공유 (중복 제거) */
  padding: var(--ud-pad-y) var(--ud-pad-x);
  margin: 2px 0;
  border-radius: var(--ud-radius-sm);
}

.toggle-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--ud-border);
  border-radius: 24px;
  transition: all var(--ud-transition-mid);
}

.toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: all var(--ud-transition-mid);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--ud-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* 다크모드 */

/* [변경] 다크 모드 버튼/메뉴 공통 속성 묶기 (중복 제거) */
[data-theme="dark"] .unified-dropdown-button,
[data-theme="dark"] .unified-dropdown-menu {
  background: #2a2d3e;
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .unified-dropdown-button {
  color: #f4f5ff;
}

[data-theme="dark"] .dropdown-section {
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .dropdown-option-content .name {
  color: #f4f5ff;
}

[data-theme="dark"] .dropdown-option:hover {
  background: rgba(151, 141, 255, 0.12);
}

/* AI멀티 도우미 페이지에서 상단 드롭다운 숨기기 */
body:has(.multi-assistant-page) #top-left-dropdown {
  display: none !important;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
  /* 드롭다운 버튼 - 모바일 최적화 */
  .unified-dropdown-button {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 10px;
  }

  /* 모바일 아이콘 크기 */
  .unified-dropdown-button .icon { font-size: 16px; }
  .unified-dropdown-button .arrow { font-size: 10px; }

  /* 드롭다운 메뉴 - 모바일 최적화 */
  .unified-dropdown-menu {
    position: fixed !important; /* absolute에서 fixed로 변경 */
    top: auto !important;
    bottom: 80px !important; /* 입력창 위로 이동 */
    left: 12px !important;
    right: auto !important;
    min-width: 280px !important;
    max-width: 320px !important;
    max-height: 60vh !important;
    border-radius: 12px;
  }

  /* 드롭다운 섹션 */
  .dropdown-section {
    padding: 10px 6px;
  }



  /* 드롭다운 옵션 */
  .dropdown-option {
    padding: 10px;
    border-radius: 8px;
  }

  .dropdown-option-content .icon {
    font-size: 18px;
  }

  .dropdown-option-content .name {
    font-size: 13px;
  }

  .dropdown-option-content .description {
    font-size: 11px;
  }

  .dropdown-option .badge {
    font-size: 10px;
    padding: 3px 6px;
  }

  /* 토글 스위치 - 모바일 크기 조정 */
  .toggle-switch {
    width: 40px;
    height: 22px;
  }

  .toggle-slider:before {
    height: 16px;
    width: 16px;
  }

  .toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
  }
}
