/* Header Styles */
.header {
  --background-color: #000000 !important;
  --default-color: #ffffff !important;
  --heading-color: #ffffff !important;
  --accent-color: #8b0000 !important;
  color: var(--default-color) !important;
  background-color: var(--background-color) !important;
  padding: 15px 0 !important;
  transition: all 0.5s !important;
  z-index: 9999 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  overflow: visible !important;
  display: block !important;
  visibility: visible !important;
}

.header .container {
  max-width: 1200px;
  overflow: visible !important;
}

.header .row {
  overflow: visible !important;
}

.header .logo {
  line-height: 1;
}

.header .logo a {
  text-decoration: none;
}

.header .logo img {
  max-height: 40px;
  margin-right: 8px;
}

.header .logo h1 {
  font-size: 28px;
  margin: 0;
  font-weight: 600;
  color: var(--heading-color);
}

.header .main-nav {
  display: flex;
  justify-content: center;
}

.header .nav-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 30px;
}

.header .nav-item {
  position: relative;
}

.header .nav-link {
  color: var(--default-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  padding: 8px 0;
  transition: color 0.3s ease;
}

.header .nav-link:hover {
  color: var(--accent-color);
}

.header .header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  overflow: visible !important;
}

.header .login-box {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: visible !important;
}

.header .login-box.logged-in {
  gap: 12px;
}

/* メニューボックス（横長、左：ユーザーアイコン / 右：三本線マーク） */
.header .menu-box {
  display: flex;
  align-items: stretch;
  height: 48px;
  width: 96px;
  border: 2px solid #ffffff;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2) !important;
  overflow: hidden;
  padding: 0 !important;
  cursor: pointer;
  transition: background 0.2s ease;
  box-shadow: none !important;
}

.header .menu-box:hover {
  background: rgba(0, 0, 0, 0.35) !important;
}

.header .menu-box:focus {
  box-shadow: none !important;
  outline: none;
}

.header .menu-left {
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-right: 1px solid #ffffff;
}

.header .menu-left img.menu-user-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  background: #111111;
}

.header .menu-left i {
  font-size: 24px;
  color: #ffffff;
}

.header .menu-divider {
  width: 1px;
  background: #ffffff;
}

.header .menu-right {
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: #ffffff;
  cursor: pointer;
}

.header .menu-right i {
  font-size: 20px;
}

/* メニューボックスのドロップダウンメニュー */
.header .dropdown:has(.menu-box) {
  position: relative;
  z-index: 110000;
}

.header .dropdown:has(.menu-box) .dropdown-menu {
  z-index: 110001 !important;
  background-color: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175) !important;
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  margin-top: 0.125rem !important;
}

.header .dropdown:has(.menu-box) .dropdown-menu.show {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.header .dropdown:has(.menu-box) .dropdown-menu .dropdown-item {
  color: #000000 !important;
  text-decoration: none;
}

.header .dropdown:has(.menu-box) .dropdown-menu .dropdown-item:hover {
  background-color: #f1f3f5 !important;
  color: #000000 !important;
}

.header .login-box .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header .login-box .user-name {
  color: var(--default-color);
  font-weight: 500;
}

.header .login-box .user-profile-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.header .login-box .dropdown,
.header .notification-dropdown {
  position: relative;
  z-index: 110000; /* 他要素より確実に上に配置 */
}

.header .login-box .dropdown-toggle {
  color: var(--default-color);
  border: none;
  background: none;
  padding: 5px;
  text-decoration: none;
  position: relative;
  z-index: 1;
}

.header .login-box .dropdown-toggle .notification-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background-color: #dc3545;
  border-radius: 50%;
  border: 2px solid var(--background-color);
  display: none;
}

.header .login-box .dropdown-toggle:focus {
  box-shadow: none;
}

.header .login-box .dropdown-menu,
.header .notification-menu {
  min-width: 200px;
  z-index: 110001 !important;
  background-color: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175) !important;
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  margin-top: 0.125rem !important;
}

.header .login-box .dropdown-menu.show,
.header .notification-menu.show {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.header .login-box .dropdown-menu .dropdown-item {
  position: relative;
  color: #000000 !important;
  text-decoration: none;
}

.header .login-box .dropdown-menu .dropdown-item .notification-dot {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background-color: #dc3545;
  border-radius: 50%;
  display: none;
  padding: 2px;
}

.header .mobile-menu-toggle {
  background: none;
  border: none;
  color: var(--default-color);
  font-size: 24px;
  padding: 5px;
  margin-left: 10px;
  display: none !important;
}

@media (max-width: 767.98px) {
  /* モバイル時のユーザードロップダウンボタンを一体化した長方形にする */
  .header .login-box .dropdown .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0px 0px;
    border: 1px solid #ffffff;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.35);
    color: #ffffff;
  }
  .header .login-box .dropdown .dropdown-toggle::after {
    margin-left: 4px;
    border-top-color: #ffffff;
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-left-color: transparent;
  }
  .header .login-box .dropdown .dropdown-toggle .user-profile-icon {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 8px 0 0 8px;
    border: 1px solid #ffffff;
    background: #111111;
  }
  .header .login-box .dropdown .dropdown-toggle i.bi-person-circle {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 8px 0 0 8px;
    border: 1px solid #ffffff;
    background: #111111;
  }
}

.header .mobile-nav {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  overflow: visible !important;
}

/* collapseコンテナのクリップを防止 */
.header .collapse {
  overflow: visible !important;
}

.header .collapse.show {
  overflow: visible !important;
}

/* モバイルメニュー内のドロップダウン - 非表示に */
#mobileMenu .dropdown {
  display: none !important;
}

#mobileMenu .notification-dropdown {
  display: none !important;
}

.header .mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header .mobile-nav-item {
  margin-bottom: 10px;
}

.header .mobile-nav-link {
  color: var(--default-color);
  text-decoration: none;
  font-size: 16px;
  padding: 8px 0;
  display: block;
  transition: color 0.3s ease;
}

.header .mobile-nav-link:hover {
  color: var(--accent-color);
}

/* Custom Login/Register Button Styles */
.header .btn-login {
  background-color: #28a745;
  border-color: #28a745;
  color: #ffffff;
}

.header .btn-login:hover {
  background-color: #218838;
  border-color: #1e7e34;
  color: #ffffff;
}

.header .btn-register {
  background-color: #ff8c00;
  border-color: #ff8c00;
  color: #ffffff;
}

.header .btn-register:hover {
  background-color: #e67e00;
  border-color: #cc7000;
  color: #ffffff;
}

/* Header on Scroll */
.scrolled .header {
  --background-color: rgba(0, 0, 0, 0.8);
  box-shadow: 0px 0 18px rgba(0, 0, 0, 0.1);
}

/* Mobile Styles */
@media (max-width: 991px) {
  .header .nav-list {
    gap: 20px;
  }

  .header .nav-link {
    font-size: 15px;
  }
}

@media (max-width: 767px) {
  .header .nav-list {
    gap: 15px;
  }

  .header .nav-link {
    font-size: 14px;
  }

  .header .login-box .user-name {
    display: none;
  }
}

/* Notification Styles */
.notification-dropdown {
  margin-right: 0px;
}

.notification-toggle {
  position: relative;
  padding: 0px;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.notification-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.notification-toggle i {
  font-size: 18px;
  color: gold; /* 通常時のgold */
  transition: all 0.3s ease;
}

/* 通知がある場合のスタイル */
.notification-toggle.has-notifications i {
  color: #dc3545; /* 赤 */
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 16px rgba(255, 255, 255, 0.6));
  animation: notification-glow 2s ease-in-out infinite alternate;
  /* ===== 通知ウインドウ モバイル中央表示 ===== */
  .header .notification-menu,
  .notification-menu {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 90vw !important;
    height: 50vh !important;
    max-height: 50vh !important;
    min-width: unset !important;
    margin: 0 !important;
    border-radius: 12px !important;
    z-index: 120000 !important;
    overflow-y: auto !important;
    box-shadow: 0 4px 32px rgba(0,0,0,0.25) !important;
    padding-bottom: 0 !important;
  }
  .header .notification-menu.show,
  .notification-menu.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}
}

@keyframes notification-glow {
  from {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 16px rgba(255, 255, 255, 0.6));
  }
  to {
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 1)) drop-shadow(0 0 24px rgba(255, 255, 255, 0.8));
  }
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: #dc3545;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: bold;
  min-width: 16px;
  text-align: center;
  line-height: 1;
  border: 2px solid #000000;
}

.notification-menu {
  min-width: 350px;
  max-width: 400px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 10000;
  background-color: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175) !important;
}

.notification-menu .dropdown-header {
  padding: 0.5rem 1rem !important;
  font-weight: bold !important;
  color: #000000 !important; /* 黒文字 */
  background-color: #f8f9fa !important; /* 薄い灰色の背景 */
  border-bottom: 1px solid #dee2e6 !important;
}

.notification-menu .dropdown-header h6 {
  color: #000000 !important;
  font-weight: bold !important;
  margin: 0 !important;
}

.notification-item {
  position: relative;
  transition: background-color 0.2s;
}

.notification-item:hover {
  background-color: #f8f9fa;
}

.notification-item.unread {
  background-color: #fff3cd;
}

.notification-link {
  padding: 0.75rem 1rem;
  color: inherit;
  text-decoration: none;
}

.notification-link:hover {
  color: inherit;
  text-decoration: none;
}

.notification-content {
  margin-right: 30px;
}

.notification-title {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 2px;
}

.notification-message {
  font-size: 13px;
  color: #6c757d;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-time {
  font-size: 11px;
  color: #adb5bd;
}

.notification-unread-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  background-color: #ffc107;
  border-radius: 50%;
}