/* Navigation 바 스타일 */
.navbar {
  background-color: black;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 100%;
  /* overflow: hidden; */
  /* white-space: nowrap; */
}

/* 좌측 영역: 로고 + 메뉴 */
.navbar-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

/* 우측 영역: 세션 컨트롤 + 햄버거 메뉴 */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* 좌측 브랜드/로고 */
.navbar-brand {
  flex-shrink: 0;
}

.navbar-brand a {
  display: block;
  text-decoration: none;
}

.navbar-brand img {
  height: 40px;
  width: auto;
  max-width: 200px;
}

.navbar-menu {
  display: flex;
  gap: 2rem;
  align-items: center;
  /* flex-wrap: nowrap; */
  /* overflow: hidden; */
}

.navbar-menu a {
  text-decoration: none;
  color: white;
  font-weight: bold;
  transition: color 0.3s, background-color 0.3s;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.3rem;
  white-space: nowrap; /* 줄바꿈 방지 */
  line-height: 1.2;
  height: auto;
}

.navbar-menu a:hover {
    color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar-menu a.active {
  color: #f56033;
}

/* 메뉴 아이콘 스타일 */
.navbar-menu a img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* 네비게이션 바 세션 컨트롤 영역 스타일 */
.navbar-session-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 세션 연장 버튼 스타일 - 테두리 완전 제거 */
.session-extend-btn {
  background-color: transparent;
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.session-extend-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.session-extend-btn:active {
  transform: translateY(0);
}

/* 세션 타이머 스타일 */
.session-timer {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 80px;
  text-align: center;
  transition: all 0.3s ease;
}

.session-timer.warning {
  background-color: rgba(255, 193, 7, 0.2);
  border-color: rgba(255, 193, 7, 0.5);
  color: #ffc107;
  animation: pulse-warning 2s infinite;
}

.session-timer.danger {
  background-color: rgba(220, 53, 69, 0.2);
  border-color: rgba(220, 53, 69, 0.5);
  color: #dc3545;
  animation: pulse-danger 1s infinite;
}

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

@keyframes pulse-danger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.logout-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.logout-btn:hover {
  background-color: darkred;
}

/* ===== 사용자 드롭다운 메뉴 스타일 ===== */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-info:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    border-radius: 50%;
    color: white;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: white;
}

.username {
    font-size: 0.9rem;
    font-weight: bold;
    line-height: 1.2;
}

.user-role {
    font-size: 0.7rem;
    opacity: 0.8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-arrow {
    display: flex;
    align-items: center;
    color: white;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.user-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* 드롭다운 메뉴 */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 200px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

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

/* 드롭다운 항목 */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
}

.dropdown-item.logout:hover {
    background-color: #fee;
    color: #dc3545;
}

.dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.dropdown-item:hover svg {
    opacity: 1;
}

/* 구분선 */
.dropdown-divider {
    height: 1px;
    background-color: var(--light-gray);
    margin: 0.5rem 0;
}

/* 애니메이션 효과 */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background-color: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
}

/* 포커스 접근성 */
.user-info:focus-within .dropdown-menu,
.dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
    background-color: var(--background-color);
}

/* 역할별 아바타 색상 */
.user-dropdown[data-role="admin"] .user-avatar {
    background-color: var(--primary-color);
}

.user-dropdown[data-role="guest"] .user-avatar {
    background-color: #28a745;
}

/* IE 및 구형 브라우저 지원 */
@supports not (backdrop-filter: blur(10px)) {
    .dropdown-menu {
        background-color: rgba(255, 255, 255, 0.95);
    }
}

/* 내비게이션 메뉴 업데이트 알림 스타일 */
.navbar-menu a.has-updates {
  position: relative;
  animation: blink 1s infinite alternate;
}

.navbar-menu a.has-updates::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  background-color: #fce914;
  border-radius: 50%;
  animation: pulse 1s infinite;
}

@keyframes blink {
  0% { color: var(--text-color); }
  100% { color: #fce914; }
}

@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.2); opacity: 1; }
}

/* 햄버거 메뉴 기본 스타일 (숨김 상태) */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.mobile-menu-toggle span {
  width: 100%;
  height: 2px;
  background-color: white;
  transition: all 0.3s ease;
  transform-origin: center;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* 모바일 메뉴 드롭다운 */
.mobile-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: black;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
}

.mobile-menu-dropdown.active {
  display: block;
}

.mobile-menu-items {
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}

.mobile-menu-items a {
  display: block !important;
  padding: 0.8rem 1rem !important;
  color: white !important;
  text-decoration: none;
  font-size: 1rem !important;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color 0.3s ease;
  width: auto !important;
  height: auto !important;
  line-height: 1.5 !important;
}

.mobile-menu-items a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--primary-color) !important;
}

.mobile-menu-items a:last-child {
  border-bottom: none;
}

/* 모바일 메뉴 세션 정보 스타일 */
.mobile-session-info {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1rem;
  background-color: rgba(255, 255, 255, 0.05);
}

.mobile-user-info {
  color: var(--primary-color);
  font-weight: bold;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.mobile-session-timer {
  color: #ffc107;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.mobile-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-menu-actions a {
  display: block !important;
  padding: 0.5rem 0 !important;
  color: white !important;
  text-decoration: none;
  font-size: 0.9rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: color 0.3s ease;
}

.mobile-menu-actions a:hover {
  color: var(--primary-color) !important;
}

.mobile-menu-actions a:last-child {
  border-bottom: none;
  color: #dc3545 !important;
}

/* 아이콘 숨김 브레이크포인트 조정 */
@media (max-width: 1400px) {
  .navbar-brand img {
    max-height: 35px;
    width: auto;
  }

  .navbar-left {
    gap: 0.4rem;
  }
  
  .navbar-menu {
    gap: 0.5rem;
  }
  
  /* 메뉴 아이콘 숨기기 - 텍스트 줄바꿈 방지 */
  .navbar-menu a img {
    display: none;
  }
  
  .navbar-menu a {
    gap: 0;
    padding: 0.4rem;
    font-size: 0.9em;
  }

  /* 햄버거 메뉴는 아직 숨김 */
  .mobile-menu-toggle {
    display: none;
  }
}

/* 태블릿 반응형 디자인 (1024px 이하) */
/* @media (max-width: 1024px) {
  .mobile-menu-toggle {
    display: none;
  }
} */

/* 모바일 반응형 디자인 (768px 이하) */
@media (max-width: 960px) {
  .navbar {
    background-color: black;
    padding: 0.8rem;
    position: relative;
  }
  
  /* 좌측 이미지/로고 더 작게 조절 */
  .navbar-brand img {
    max-height: 30px;
    width: auto;
  }
  
  /* 기존 메뉴 숨기기 */
  .navbar-menu {
    display: none;
  }
  
  /* 세션 컨트롤 숨기기 */
  .navbar-session-controls {
    display: none;
  }
  
  /* 햄버거 메뉴 표시 */
  .mobile-menu-toggle {
    display: flex;
  }
  
  /* 우측 영역에서 햄버거 메뉴만 표시 */
  .navbar-right {
    justify-content: flex-end;
  }
}

/* 작은 모바일 화면 (480px 이하) */
@media (max-width: 480px) {
  .navbar {
    padding: 0.5rem;
  }
  
  /* 좌측 이미지/로고 가장 작게 */
  .navbar-brand img {
    max-height: 25px;
    width: auto;
  }
  
  /* 햄버거 메뉴 크기 조절 */
  .mobile-menu-toggle {
    width: 20px;
    height: 15px;
  }
  
  .mobile-menu-toggle span {
    height: 1.5px;
  }
  
  /* 모바일 메뉴 아이템 크기 조절 */
  .mobile-menu-items a {
    padding: 0.6rem 1rem !important;
    font-size: 0.9rem !important;
  }
  
  .mobile-session-info {
    padding: 0.8rem;
  }
  
  .mobile-user-info {
    font-size: 0.9rem;
  }
  
  .mobile-session-timer {
    font-size: 0.8rem;
  }
  
  .mobile-menu-actions a {
    font-size: 0.85rem !important;
  }
}