/* src/main/webapp/resources/css/pages/fragments/top-menu.css */

/* =========================
   헤더 전체(배경/섀도우/고정)
========================= */
.site-header {
  width: 100%;
  background: #348BEE;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 70px;
}

/* 컨테이너: 가운데 정렬 */
.header-flex-wrap {
  display: flex;
  height: 100%;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 0 90px;
  box-sizing: border-box;
}

/* 로고 */
.header-logo { align-items: center; }
.header-logo img {
  display: flex;
  align-items: center;
  width: 80px;
  filter: drop-shadow(0 0 7px rgba(255,255,255,0.8));
}

/* 메인 내비(메뉴) */
.main-nav {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-menu {
  display: flex;
  align-items: center;
  gap: 30px;
  margin: 0;
  padding: 0;
  height: 100%;
}
.nav-item {
  position: relative;
  padding: 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  height: 70px;
  letter-spacing: 0.19em;
  border-bottom: 0 solid transparent;
  transition: color 0.2s, border-bottom 0.2s;
}
.nav-item > a {
  color: #fff;
  display: block;
  padding: 0 8px;
  transition: color 0.2s, border-bottom 0.2s;
  font-weight: 700;
}
/* 메인메뉴 hover */
.nav-item:hover > a,
.nav-item:hover {
  color: #ffdd57;
  border-bottom: 3px solid #ffdd57;
  background: none;
}
/* 드롭다운 기본 */
.nav-menu li,
.nav-menu a {
  margin-bottom: 0;
  font-weight: 500;
  font-size: 1.4rem;
}
.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #e8f0fe;
  color: #4257ae;
  border: 1px solid #e5e7ef;
  border-radius: 6px;
  min-width: 210px;
  box-shadow: 0 4px 16px rgba(52,139,238,0.07);
  padding: 8px 0;
  z-index: 999;
}
.nav-item:hover .submenu {
  display: block; 
}
.submenu li {
  padding: 7px 18px;
  margin-bottom: 0; 
}

.submenu li:hover {
  background-color: #d7e4f8;
  color: #003366;
}

.submenu a {
  display: block;
  color: inherit;
  font-size: 1.2rem;
  line-height: 1.2;
  font-weight: 400;
}

/* =========================
   로그인/로그아웃 영역
========================= */
.header-login-logout {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-left: 35px;
  padding-bottom: 20px;
  height: 100%;
  position: relative;
  /* 필요 시 미세 보정용
     bottom: 8px; */
}
.login-icon {
  width: 28px;
  height: 28px;
 }
.login-icon.purple {
  width: 28px;
  height: 28px;
  filter: invert(37%) sepia(82%) saturate(1084%) hue-rotate(211deg) brightness(93%) contrast(90%);
}

/* 로그인 전: 아이콘 + 버튼 그룹 가로 정렬 */
#headerLogin.header-login-before {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* 버튼 그룹 가로 정렬 */
.header-login-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.login-button {
  min-width: 90px;
  text-align: center;
  padding: 0 10px;
  font-size: 1rem;
  font-weight: 300;
  height: 27px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: transparent;
  color: #fff;
  border: 1px solid #fff;
  transition: background 0.3s, color 0.3s;
}
.login-button:hover {
  background: #fff;
  color: #003366;
}

/* 로그인 후: 사용자 표시 */
.user-name {
  font-size: 1.03rem;
  font-weight: 300;
  color: #fff; margin-left: 3px;
 }
.online-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: #20c20e;
  border-radius: 50%;
  margin-left: 8px;
  box-shadow: 0 0 5px #40e040;
}
.online-text {
  color: #20c20e;
  margin-left: 3px;
  font-weight: 400;
  font-size: 1.03rem;
}

/* 트리거: .user-menu-open (header.jspf와 일치) */
.user-info.user-menu-open {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  position: relative;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
.user-info.user-menu-open:hover,
.user-info.user-menu-open:focus {
  background: rgba(120,170,255,0.11);
}
.user-info.user-menu-open:focus {
  outline: 2px solid rgba(255,255,255,0.7);
  outline-offset: 2px;
}

/* 드롭다운 (표시는 JS: .active + 전역 .hidden 토글) */
.user-dropdown-menu {
  display: none;           /* 기본값 */
  position: absolute;
  top: 70px;
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid #c9def9;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,40,100,0.08);
  z-index: 1000;
  padding: 8px 0;
}
.user-dropdown-menu.active {
  display: block;
}
.user-dropdown-menu .dropdown-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 10px 18px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 20px;
  transition: background 0.12s;
}
.user-dropdown-menu .dropdown-item:hover {
  background: #eef7fe;
}

/* =========================
   2차 서브메뉴 (회원 관리 하위)
========================= */
/* 1. 2차 메뉴의 기준점이 되는 부모 li */
.has-second-submenu {
    position: relative;
}

/* 2. 2차 메뉴 본체 */
.second-submenu {
    display: none;
    position: absolute;
    /* 핵심 보정: 부모 submenu의 padding(8px) 만큼 위로 올려서 1차 메뉴와 높이를 맞춤 */
    top: -8px; 
    left: 100%;       /* 부모의 오른쪽 끝에서 시작 */
    background: #e8f0fe;
    color: #4257ae;
    border: 1px solid #e5e7ef;
    border-radius: 6px;
    min-width: 190px;
    box-shadow: 6px 4px 16px rgba(52,139,238,0.15);
    padding: 8px 0;
    z-index: 1010;
    /* 텍스트가 다음 줄로 넘어가지 않게 방지 */
    white-space: nowrap; 
}

/* 3. 호버 시 노출 (명확한 선택자 사용) */
.has-second-submenu:hover > .second-submenu {
    display: block;
}

/* 4. 부모 메뉴(회원 관리) 아이템 스타일 정리 */
.has-second-submenu > a {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

/* 오른쪽 화살표 아이콘 */
.has-second-submenu .arrow {
    font-size: 0.7rem;
    margin-left: 15px;
    color: #348BEE;
    opacity: 0.7;
}

/* 5. 2차 메뉴 내부 호버 효과 */
.second-submenu li:hover {
    background-color: #d7e4f8;
    color: #003366;
}

/* =========================
   반응형
========================= */
@media (max-width: 1200px) {
  .header-flex-wrap { max-width: 100%; padding: 0 10px; gap: 10px; }
  .nav-menu { gap: 14px; }
  .login-button { min-width: 84px; font-size: 0.97rem; }
  .header-logo img { width: 70px; height: 20px; }
}
@media (max-width: 900px) {
  .header-flex-wrap { flex-direction: column; height: auto; padding: 5px; gap: 0; }
  .main-nav { justify-content: flex-start; }
  .header-login-logout { margin-left: 0; gap: 8px; }
}

/* 반응형 대응: 모바일/좁은 화면에서는 아래로 펼쳐지도록 보정 */
@media (max-width: 900px) {
    .second-submenu {
        position: static; /* 우측이 아닌 아래로 흐르게 */
        box-shadow: none;
        background: #f1f6ff;
        padding-left: 15px;
        border: none;
    }
    .has-second-submenu .arrow {
        transform: rotate(90deg); /* 화살표 방향 아래로 */
    }
}