/* ========================================
   🧭 NAVBAR COMPONENT
   ======================================== */

/* 🔥 Navbar Base */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 40px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
    z-index: 1001;
  height: 65px;
  background-color: var(--bg-primary);
}

.navbar .logo {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--primary-color);
  text-decoration: none;
}

.navbar .logo img {
  display: block;
  margin-top: 0px;
  height: 30px;
}

.navbar nav {
  margin-left: 24px;
}

/* 헤더 nav 메뉴 한 줄 정렬 및 커뮤니티 드롭다운 버튼 정렬 개선 */
.navbar nav ul {
  display: flex;
  align-items: center;
  gap: 36px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.navbar nav ul li {
  display: flex;
  align-items: center;
  font-size: 1.18em;
  font-weight: 700;
  color: #23272f;
  line-height: 1.2;
  position: relative;
  height: 56px;
}

.navbar nav ul li .dropdown-toggle {
  font-size: 16.8px;
  display: flex;
  align-items: center;
  height: 56px;
  line-height: 56px;
  font-weight: 700;
  color: #23272f;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 8px;
}

.navbar nav ul li .dropdown-menu {
  top: 56px;
  padding: 8px 0 !important;
  min-width: 120px;
  width: 120px;
  box-sizing: border-box;
}

.navbar nav ul li .dropdown-menu li {
  width: 100%;
  margin: 0;
  padding: 0;
}

.navbar nav ul li .dropdown-menu a {
  display: block;
  width: 100%;
  padding: 8px 16px;
  margin: 0;
  box-sizing: border-box;
}

.navbar nav a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 8px 0;
  position: relative;
  transition: color 0.2s;
}

.navbar nav a:after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 50%;
  background-color: var(--primary-color);
  transition: all 0.3s ease-out;
}

.navbar nav a:hover {
  color: var(--primary-color);
}

.navbar nav a:hover:after {
  width: 100%;
  left: 0;
}

.header-right {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 8px;
}

.auth-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-buttons .login {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 78px;
  height: 30px;
  color: var(--text-color);
  border: 1px solid var(--border-color-button, #dbdfe6);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s;
}

.auth-buttons .login:hover {
  background-color: var(--bg-secondary-color);
}

.auth-buttons .signup {
  background-color: var(--primary-color);
  color: #fff;
}

.auth-buttons .signup:hover {
  background-color: #2563eb;
}

#user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-color);
  background-color: var(--bg-secondary-color);
  padding: 6px 12px;
  border-radius: 8px;
}

#user-profile #user-level {
  font-weight: 700;
}

#user-profile #user-display-name {
  font-weight: 600;
}

.icon-button {
  background: none;
  border: none;
  color: var(--text-color-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s;
  text-decoration: none;
}

.icon-button:hover {
  background-color: var(--bg-secondary-color);
  color: var(--text-color);
}

.icon-button i {
  font-size: 1.2rem;
  line-height: 1;
}

body.dark-mode .navbar nav a:hover:after {
  background-color: var(--primary-color);
}

/* --- 커뮤니티 드롭다운 메뉴 --- */
.navbar nav ul li.dropdown {
  position: relative;
}

.navbar nav ul li .dropdown-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.navbar nav ul li .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0 0 12px 12px;
  min-width: 160px;
  box-shadow: 0 4px 16px var(--shadow-color);
  z-index: 100;
  padding: 8px 0;
}

.navbar nav ul li.dropdown:hover .dropdown-menu,
.navbar nav ul li.dropdown:focus-within .dropdown-menu {
  display: block;
}

.navbar nav ul li .dropdown-menu li {
  width: 100%;
}

.navbar nav ul li .dropdown-menu a {
  display: block;
  padding: 10px 20px;
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s;
}

.navbar nav ul li .dropdown-menu a:hover {
  background: var(--bg-secondary-color);
  color: var(--primary-color);
}

/* 테마 버튼 */
.theme-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-color);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
  font-size: 1.2em;
  border-radius: 50%;
}

.theme-button:hover {
  color: var(--primary-color);
}

.theme-button i {
  font-size: 1.2rem;
  line-height: 1;
}

/* ========================================
   🔥 모바일 반응형 스타일
   ======================================== */
@media (max-width: 768px) {
  /* 모바일에서 네비게이션 메뉴 숨기기 */
  .navbar nav {
    display: none !important;
  }
  
  /* 모바일에서 사용자 프로필 숨기기 */
  #user-profile {
    display: none !important;
  }
  
  /* 모바일에서 마이페이지 링크 숨기기 */
  #my-page-link {
    display: none !important;
  }
  
  /* 모바일에서 로고 클릭 비활성화 */
  .navbar .logo {
    pointer-events: none !important;
    cursor: default !important;
  }
  
  /* 모바일용 사용자 정보 스타일 - 기본적으로 숨김 */
  .mobile-user-info {
    display: none !important;
  }
  
  /* PC 버전에서는 완전히 숨김 */
  @media (min-width: 769px) {
    .mobile-user-info {
      display: none !important;
    }
  }

  /* 모바일에서만 표시 */
  @media (max-width: 768px) {
    /* 로그인 후에만 모바일용 사용자 정보 표시 */
    .mobile-user-info[style*="display: flex"] {
      display: flex !important;
      align-items: center;
      gap: 8px;
    }
  }
  
  .mobile-user-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-color);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 8px;
    border-radius: 6px;
  }
  
  .mobile-user-link i {
    font-size: 16px;
    color: var(--text-color-secondary);
  }
  
  .mobile-user-name {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  #mobile-logout-btn {
    background: none;
    border: none;
    color: var(--text-color-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
  }
  
  #mobile-logout-btn:hover {
    background-color: var(--bg-secondary-color);
    color: var(--text-color);
  }
  
  /* 모바일에서 헤더 패딩 조정 */
  .navbar {
    padding: 12px 16px;
    height: 60px;
  }
  
  /* 모바일에서 로고 크기 조정 */
  .navbar .logo img {
    height: 28px;
  }
  
  /* 모바일에서 헤더 우측 영역 정렬 */
  .header-right {
    gap: 8px;
  }
  
  /* 모바일에서 로그인 버튼 크기 조정 */
  .auth-buttons .login {
    width: 70px;
    height: 32px;
    font-size: 13px;
    padding: 8px 12px;
  }
  
  /* 모바일에서 테마 버튼 크기 조정 */
  .theme-button {
    width: 32px;
    height: 32px;
  }
  
  .theme-button i {
    font-size: 1.1rem;
  }
  
  /* 모바일에서 터치 인터랙션 개선 */
  .auth-buttons .login:active,
  .theme-button:active,
  #mobile-logout-btn:active {
    transform: scale(0.95);
  }
  
  /* 모바일에서 헤더 그림자 효과 */
  .navbar {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  /* 모바일에서 로그인 후 로그인 버튼 숨기기 */
  .auth-buttons[style*="display: none"] {
    display: none !important;
  }
}

/* ========== 다크 모드 ========== */
:root.dark-mode .navbar nav > ul > li > a {
  color: #ffffff;
}

:root.dark-mode .dropdown-menu {
  background-color: var(--card-bg);
  border-color: var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

:root.dark-mode .dropdown-item {
  color: var(--text-color);
}

:root.dark-mode .dropdown-item:hover {
  background-color: var(--bg-secondary-color);
  color: var(--text-color);
} 