/* ============================================================
   topmenu.css - 데이터 플랫폼 스타일 상단 네비게이션
   메인 컬러: 딥 블루, 블랙, 네이비
   포인트 컬러: 에메랄드 그린, 스카이 블루, 딥 브라운
   ============================================================ */

:root {
  /* 메인 컬러 */
  --deep-blue: #001F3F;
  --black: #000000;
  --navy: #003366;
  
  /* 포인트 컬러 */
  --emerald: #50C878;
  --sky-blue: #87CEEB;
  --deep-brown: #654321;
  
  /* 보조 컬러 */
  --light-bg: #f8fafb;
  --white: #ffffff;
  --border-color: #e8ecf1;
  --text-light: #718096;
}

/* nav를 기준 컨테이너로 */
.nav {
  --pad-x: 24px;
  --row-h: 56px;
  position: relative;
  background: linear-gradient(135deg, var(--deep-blue) 0%, #002850 100%);
  border-bottom: 3px solid var(--emerald);
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 공통: 같은 grid 틀 공유 */
.nav-row {
  display: grid;
  grid-template-columns: 200px minmax(auto, 1fr) 280px;
  align-items: center;
  padding: 0 var(--pad-x);
}

/* 1행(탑바) */
.nav-top {
  height: var(--row-h);
  justify-content: center;
}

/* 브랜드 - 프리미엄 스타일 */
.nav-brand {
  display: flex;
  align-items: center;
}

.nav-brand .brand {
  font-weight: 900;
  text-decoration: none;
  color: var(--white);
  font-size: 20px;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  padding-left: 12px;
}

.nav-brand .brand::before {
  content: "";
  position: absolute;
  left: 0;
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, var(--emerald), var(--sky-blue));
  border-radius: 2px;
}

/* 탭들: 섹션 수에 따라 자동 */
.nav-tabs {
  display: grid;
  grid-template-columns: repeat(var(--menu-cols), 220px);
  gap: 0;
  height: var(--row-h);
  align-items: stretch;
  margin: 0 auto;
  justify-self: center;
}

.tab {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  height: 100%;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.tab:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.tab + .tab {
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* 탭 활성 상태 - 그라데이션 밑줄 */
.tab.active {
  color: var(--white);
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 3px;
  background: linear-gradient(90deg, var(--emerald), var(--sky-blue));
  box-shadow: 0 0 8px rgba(80, 200, 120, 0.4);
}

/* 유저 링크 영역 */
.nav-user {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  align-items: center;
}

.nav-user a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  padding: 6px 12px;
  border-radius: 6px;
}

.nav-user a:hover {
  color: var(--white);
  background: rgba(80, 200, 120, 0.15);
  border: 1px solid rgba(80, 200, 120, 0.3);
}

/* 알림함 배지 */
.notif-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-badge {
  background: linear-gradient(135deg, #ff4757, #ff6b7a);
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  min-width: 22px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(255, 71, 87, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* ============================================================
   메가 드롭다운 메뉴
   ============================================================ */

/* mega dropdown */
.nav-mega {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--row-h);
  display: none;
  background: var(--white);
  border-top: 3px solid var(--emerald);
  box-shadow: 0 12px 32px rgba(0, 31, 63, 0.12);
  animation: slideDown 0.25s ease-out;
  grid-template-columns: 200px 1fr 280px;
  padding: 0 var(--pad-x);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav.open .nav-mega {
  display: grid;
}

/* brand/user 칼럼 스페이서 */
.mega-spacer,
.mega-user-spacer {
  height: 100%;
}

/* 섹션 그리드도 동일한 cols */
.mega-grid {
  display: grid;
  grid-template-columns: repeat(var(--menu-cols), 220px);
  gap: 0;
  justify-self: center;
}

.mega-col {
  padding: 20px 18px 24px 18px;
  border-left: 1px solid var(--border-color);
  min-height: 160px;
  transition: all 0.2s ease;
}

.mega-col:first-child {
  border-left: 0;
}

.mega-col.active {
  background: linear-gradient(135deg, rgba(80, 200, 120, 0.04), rgba(135, 206, 235, 0.04));
  border-left: 3px solid var(--emerald);
  padding-left: 15px;
}

.mega-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mega-list li {
  margin: 12px 0;
}

.mega-list a {
  text-decoration: none;
  color: var(--deep-blue);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-block;
  position: relative;
}

.mega-list a::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 3px;
  background: var(--emerald);
  border-radius: 50%;
  opacity: 0;
  transition: all 0.2s ease;
}

.mega-list a:hover {
  color: var(--emerald);
  padding-left: 8px;
}

/* ============================================================
   반응형 디자인
   ============================================================ */

@media (max-width: 1024px) {
  .nav-row {
    grid-template-columns: 160px 1fr 240px;
  }

  .nav-tabs {
    grid-template-columns: repeat(var(--menu-cols), 1fr);
  }

  .tab {
    padding: 0 12px;
    font-size: 12px;
  }

  .nav-brand .brand {
    font-size: 16px;
  }

  .mega-grid {
    grid-template-columns: repeat(var(--menu-cols), 1fr);
  }
}

@media (max-width: 768px) {
  .nav-row {
    grid-template-columns: 120px 1fr 180px;
    padding: 0 12px;
  }

  .nav-user {
    gap: 8px;
  }

  .nav-user a {
    padding: 4px 8px;
    font-size: 12px;
  }

  .tab {
    padding: 0 8px;
    font-size: 11px;
  }

  .nav-brand .brand {
    font-size: 14px;
  }

  .mega-col {
    padding: 12px 10px 14px 10px;
    min-height: 120px;
  }

  .mega-list a {
    font-size: 12px;
  }
}
