/**
 * Global Header Styles v2.0
 * AI Link Platform
 * 
 * °³¼±»çÇ×:
 * - ¸Þ°¡¸Þ´º µå·Ó´Ù¿î
 * - Ç®½ºÅ©¸° °Ë»ö ¸ð´Þ
 * - ½ºÅ©·Ñ ½Ã Çì´õ Ãà¼Ò
 * - »ç¿ëÀÚ ¿ªÇÒ ¹îÁö
 * - ¸ð¹ÙÀÏ ½½¶óÀÌµå ¸Þ´º
 */

/* ========== º¯¼ö ========== */
:root {
  --header-height: 64px;
  --header-height-scrolled: 56px;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --primary-bg: #eef2ff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
  --z-header: 100;
  --z-dropdown: 150;
  --z-modal: 200;
  --z-mobile-menu: 250;
}

/* ========== Çì´õ ±âº» ========== */
.global-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  z-index: var(--z-header);
  transition: all 0.3s ease;
}

.global-header.scrolled {
  height: var(--header-height-scrolled);
  box-shadow: var(--shadow-md);
}

.header-container {
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ¸¶ÀÌÆäÀÌÁö Àü¿ë */
.global-header.page-mypage .header-container {
  max-width: 100%;
}

.global-header.page-mypage .header-left {
  width: var(--sidebar-width, 260px);
  padding-left: 20px;
  flex-shrink: 0;
  border-right: 1px solid var(--gray-100);
  height: 100%;
  display: flex;
  align-items: center;
}

/* ========== ·Î°í ========== */
.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  transition: transform 0.2s;
}

.header-logo:hover .logo-icon {
  transform: scale(1.05);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.global-header.scrolled .logo-icon {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

/* ========== ÁÂÃø ¿µ¿ª ========== */
.header-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

/* ========== ³×ºñ°ÔÀÌ¼Ç ========== */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-item-wrapper {
  position: relative;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 0.15s;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--gray-900);
  background: var(--gray-50);
}

.nav-item.has-dropdown i {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.nav-item-wrapper:hover .nav-item.has-dropdown i {
  transform: rotate(180deg);
}

/* ========== ¸Þ°¡ µå·Ó´Ù¿î ========== */
.dropdown-mega {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: var(--z-dropdown);
}

.dropdown-mega.open,
.nav-item-wrapper:hover .dropdown-mega {
  opacity: 1;
  visibility: visible;
}

.mega-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 24px;
}

.mega-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.mega-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mega-list li {
  margin-bottom: 8px;
}

.mega-list a {
  display: block;
  padding: 8px 12px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: var(--radius);
  transition: all 0.15s;
}

.mega-list a:hover {
  background: var(--primary-bg);
  color: var(--primary);
}

.mega-list a.highlight {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: var(--gray-800);
  font-weight: 600;
}

.mega-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.mega-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.mega-footer-link:hover {
  text-decoration: underline;
}

/* ========== ½ÉÇÃ µå·Ó´Ù¿î ========== */
.dropdown-simple {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: var(--z-dropdown);
}

.dropdown-simple.open,
.nav-item-wrapper:hover .dropdown-simple {
  opacity: 1;
  visibility: visible;
}

.dropdown-simple .dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: var(--radius);
  transition: all 0.15s;
}

.dropdown-simple .dropdown-item:hover {
  background: var(--gray-50);
  color: var(--primary);
}

.dropdown-simple .dropdown-item i {
  width: 18px;
  color: var(--gray-400);
}

/* ========== ¿ìÃø ¿µ¿ª ========== */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== °Ë»ö ¹öÆ° ========== */
.header-search-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  color: var(--gray-500);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.header-search-btn:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-700);
}

.header-search-btn .search-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.header-search-btn .search-text {
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* ========== °Ë»ö ¸ð´Þ ========== */
.search-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 99999 !important;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.search-modal.open {
  opacity: 1;
  visibility: visible;
}

.search-modal-backdrop {
  display: none;
}

.search-modal-content {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform 0.2s ease;
}

.search-modal.open .search-modal-content {
  transform: translateY(0);
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.search-modal-header .search-modal-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.search-modal-header input {
  flex: 1;
  border: none;
  font-size: 1.1rem;
  color: var(--gray-800);
  outline: none;
}

.search-modal-header input::placeholder {
  color: var(--gray-400);
}

.search-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.15s;
}

.search-modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.search-modal-body {
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.search-suggestions-title,
.search-shortcuts-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.search-tag {
  padding: 6px 14px;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.15s;
}

.search-tag:hover {
  background: var(--primary-bg);
  color: var(--primary);
}

.search-shortcut-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: var(--gray-700);
  text-decoration: none;
  border-radius: var(--radius);
  transition: all 0.15s;
}

.search-shortcut-item:hover {
  background: var(--gray-50);
}

.search-shortcut-item .shortcut-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.search-shortcut-item i {
  width: 20px;
  color: var(--gray-400);
}

/* ========== CTA ¹öÆ° ========== */
.header-cta-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all 0.2s;
}

.header-cta .cta-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.header-cta.primary {
  background: var(--primary);
  color: white;
}

.header-cta.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.header-cta.secondary {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.header-cta.secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.header-cta i {
  font-size: 0.8rem;
}

/* ========== ·Î±×ÀÎ ¹öÆ° ========== */
.header-login-btn {
  padding: 8px 16px;
  color: var(--gray-700);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  transition: all 0.15s;
}

.header-login-btn:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

/* ========== ¾Ë¸² ========== */
.header-notification {
  position: relative;
}

.notification-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}

.notification-btn:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--error);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: var(--z-dropdown);
}

.notification-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--gray-100);
}

.notification-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.notification-header button {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  cursor: pointer;
}

.notification-list {
  max-height: 320px;
  overflow-y: auto;
}

.notification-empty {
  padding: 40px;
  text-align: center;
  color: var(--gray-400);
}

.notification-empty i {
  font-size: 2rem;
  margin-bottom: 8px;
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-50);
  transition: background 0.15s;
}

.notification-item:hover {
  background: var(--gray-50);
}

.notification-item.read {
  opacity: 0.6;
}

.notification-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-content p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--gray-700);
  line-height: 1.4;
}

.notification-content span {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.notification-footer {
  display: block;
  padding: 12px;
  text-align: center;
  color: var(--primary);
  font-size: 0.85rem;
  text-decoration: none;
  border-top: 1px solid var(--gray-100);
}

.notification-footer:hover {
  background: var(--gray-50);
}

/* ========== ¾ÆÀÌÄÜ ¹öÆ° ========== */
.header-icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.15s;
}

.header-icon-btn:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* ========== ÇÁ·ÎÇÊ ========== */
.header-profile {
  position: relative;
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s;
}

.profile-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

.profile-role-badge {
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.profile-role-badge.buyer {
  background: #dbeafe;
  color: #1d4ed8;
}

.profile-role-badge.seller {
  background: #d1fae5;
  color: #047857;
}

.profile-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.profile-btn > i {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: var(--z-dropdown);
}

.profile-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.dropdown-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
}

.dropdown-user-detail {
  display: flex;
  flex-direction: column;
}

.dropdown-user-name {
  font-weight: 600;
  color: var(--gray-900);
}

.dropdown-user-role {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-top: 4px;
  width: fit-content;
}

.dropdown-user-role.buyer {
  background: #dbeafe;
  color: #1d4ed8;
}

.dropdown-user-role.seller {
  background: #d1fae5;
  color: #047857;
}

.dropdown-divider {
  height: 1px;
  background: var(--gray-100);
}

.dropdown-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.9rem;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-menu-item:hover {
  background: var(--gray-50);
}

.dropdown-menu-item i {
  width: 18px;
  color: var(--gray-400);
}

.dropdown-menu-item.logout {
  color: var(--error);
}

.dropdown-menu-item.logout i {
  color: var(--error);
}

/* ========== ¸ð¹ÙÀÏ ¸Þ´º ¹öÆ° ========== */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--gray-600);
  cursor: pointer;
}

/* ========== ¸ð¹ÙÀÏ ¸Þ´º ========== */
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  height: 100vh;
  background: white;
  z-index: var(--z-mobile-menu);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-mobile-menu) - 1);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.mobile-menu-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
}

.mobile-menu-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
}

.mobile-nav-item:hover {
  background: var(--gray-50);
}

.mobile-submenu {
  display: none;
  background: var(--gray-50);
  padding: 8px 0;
}

.mobile-submenu.open {
  display: block;
}

.mobile-submenu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px 10px 36px;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.9rem;
}

.mobile-submenu-item:hover {
  color: var(--primary);
}

.mobile-menu-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-cta {
  display: block;
  padding: 14px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
}

.mobile-cta.primary {
  background: var(--primary);
  color: white;
}

.mobile-cta.secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* ========== ¹Ì´Ï¸Ö ¸ðµå ========== */
.global-header.minimal .header-container {
  justify-content: center;
}

/* ========== ¹ÝÀÀÇü ========== */
@media (max-width: 1024px) {
  .header-nav {
    display: none;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 0 16px;
  }

  .logo-text {
    display: none;
  }

  .header-cta span {
    display: none;
  }

  .header-cta {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius);
  }

  .header-cta-group {
    gap: 4px;
  }

  .header-cta.secondary {
    display: none;
  }

  .profile-role-badge {
    display: none;
  }

  .header-search-btn .search-shortcut {
    display: none;
  }

  .search-modal-content {
    margin: 16px;
    max-width: calc(100% - 32px);
  }

  .notification-panel,
  .profile-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
  }

  .notification-panel.open,
  .profile-dropdown.open {
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .header-right {
    gap: 4px;
  }

  .notification-btn,
  .header-icon-btn {
    width: 36px;
    height: 36px;
  }
}