/* Common Header Styles - Based on index.html standard */

/* Base header structure */
header {
  background-color: #e0f2f1;
  height: 100px;
  padding: 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  font-family: 'Playfair Display', 'Noto Serif JP', '游明朝', 'Yu Mincho', 'Hiragino Mincho ProN', 'MS P明朝', serif;
  position: relative;
  border: none;
  box-shadow: none;
}

/* Desktop view - header-second-line acts as transparent container */
.header-second-line {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
}

/* Logo styles */
.logo-wrapper {
  display: inline-block;
  width: auto;
}

header img {
  height: 100px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

/* Profile container */
.profile-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 42px;
  cursor: pointer;
  position: relative;
  font-family: 'Noto Serif JP', '游明朝', serif;
  max-width: 100%;
  overflow: visible;
}

.profile-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #00897B;
}

.profile-circle:hover {
  color: #00695c;
}

.profile-circle svg {
  width: 36px;
  height: 36px;
}

/* Plan color circles - static thin borders */
.profile-circle.bronze-plan,
.profile-circle.silver-plan,
.profile-circle.gold-plan {
  position: relative;
  border: 2px solid transparent;
  border-radius: 50%;
  background-clip: padding-box;
}

.profile-circle.bronze-plan {
  background-image: linear-gradient(#e0f2f1, #e0f2f1), linear-gradient(135deg, #8B4513 0%, #CD7F32 25%, #F4A460 50%, #CD7F32 75%, #8B4513 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.profile-circle.silver-plan {
  background-image: linear-gradient(#e0f2f1, #e0f2f1), linear-gradient(135deg, #808080 0%, #C0C0C0 25%, #F5F5F5 50%, #C0C0C0 75%, #808080 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.profile-circle.gold-plan {
  background-image: linear-gradient(#e0f2f1, #e0f2f1), linear-gradient(45deg, #bfa76f, #e8d4a2, #9d8448);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.profile-name {
  font-size: 0.85em;
  color: #00695c;
  font-weight: bold;
  font-family: 'Noto Serif JP', '游明朝', 'Yu Mincho', 'Hiragino Mincho ProN', 'MS P明朝', serif;
  text-align: center;
}

.profile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Logout Menu Styles */
.logout-menu {
  position: fixed;
  background-color: #ffffff;
  border: 1px solid #00897B;
  box-shadow: 0 4px 10px rgba(0, 137, 123, 0.2);
  width: auto;
  min-width: 120px;
  max-width: 200px;
  display: none;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
  transform: translateY(-8px) scale(0.98);
  z-index: 1000;
  font-family: 'Noto Serif JP', '游明朝', 'Yu Mincho', 'Hiragino Mincho ProN', 'MS P明朝', serif;
  padding: 0;
  border-radius: 0;
  overflow: hidden;
}

.logout-menu * {
  box-sizing: border-box;
}

.logout-menu.show {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.logout-menu a {
  padding: 10px 15px;
  text-decoration: none;
  color: #004D40;
  font-weight: bold;
  font-size: 0.85em;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
  display: block;
  font-family: 'Noto Serif JP', '游明朝', 'Yu Mincho', 'Hiragino Mincho ProN', 'MS P明朝', serif;
  border-radius: 0;
}

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

.logout-menu a:hover {
  background-color: #e0f2f1;
  color: #004D40;
}

/* Logout button specific styles */
.logout-link-button {
  width: 100%;
  padding: 10px 15px;
  text-align: left;
  background: none;
  border: none;
  color: #d32f2f;
  font-weight: bold;
  font-family: 'Noto Serif JP', '游明朝', 'Yu Mincho', 'Hiragino Mincho ProN', 'MS P明朝', serif;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-size: 0.85em;
  line-height: 1.3em;
  white-space: nowrap;
}

.logout-link-button:hover {
  background-color: #ffebee;
  color: #b71c1c;
}

/* Menu navigation */
.menu-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  flex: 1;
  margin-left: 50px;
}

.menu-item {
  position: relative;
  font-family: 'Noto Serif JP', '游明朝', 'Yu Mincho', 'Hiragino Mincho ProN', 'MS P明朝', serif;
}

.menu-link {
  color: #004D40;
  font-weight: bold;
  font-size: 1.05em;
  cursor: pointer;
  padding: 10px 0;
  transition: color 0.3s;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.menu-link:hover {
  color: #00897B;
}

.menu-link::after {
  content: '›';
  font-size: 1.2em;
  transition: transform 0.3s ease;
  transform: rotate(90deg);
  margin-left: 5px;
  display: inline-block;
}

.menu-item.active .menu-link::after {
  transform: rotate(270deg);
}

/* Submenu styles */
.submenu {
  position: fixed;
  left: auto;
  background-color: #ffffff;
  border: 1px solid #00897B;
  box-shadow: 0 4px 10px rgba(0, 137, 123, 0.2);
  min-width: auto;
  width: max-content;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.menu-item.active .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.submenu a {
  display: block;
  padding: 12px 18px;
  color: #004D40;
  font-weight: bold;
  font-size: 0.95em;
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s;
  white-space: nowrap;
  text-decoration: none;
}

.submenu a:last-child {
  border-bottom: none;
}

.submenu a:hover {
  background-color: #e0f2f1;
}

/* Language switcher styles */
.language-switcher {
  display: flex;
  align-items: center;
  margin-right: 20px;
  font-family: 'Noto Serif JP', '游明朝', serif;
  font-weight: 600;
  font-size: 0.95em;
  position: relative;
}

.language-switcher span {
  color: #00897B;
  cursor: pointer;
  padding: 5px 8px;
  transition: all 0.3s ease;
  user-select: none;
}

.language-switcher span:hover {
  color: #00695c;
  background-color: rgba(0, 137, 123, 0.08);
  border-radius: 4px;
}

.language-switcher .language-divider {
  cursor: default !important;
  padding: 0 !important;
}

.language-switcher .language-divider:hover {
  background-color: transparent !important;
  color: #b0bec5 !important;
}

.language-switcher span.active {
  color: #004D40;
  font-weight: 700;
  background-color: rgba(0, 137, 123, 0.12);
  border-radius: 3px;
}

/* Mobile-specific active state with tighter padding */
@media (max-width: 900px) {
  .language-switcher span.active {
    padding: 2px 4px;
    margin: 2px 1px;
  }
}

.language-divider {
  color: #b0bec5;
  margin: 0 3px;
  font-weight: 400;
  user-select: none;
}

/* Notification wrapper */
.notification-wrapper {
  position: relative;
  margin-right: 14px;
  cursor: pointer;
  display: inline-block;
}

/* Notification menu styles */
.notification-menu {
  position: fixed;
  background-color: #ffffff;
  border: 1px solid #00897B;
  box-shadow: 0 4px 10px rgba(0, 137, 123, 0.2);
  min-width: 220px;
  max-width: 280px;
  display: none;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
  transform: translateY(-8px) scale(0.98);
  z-index: 1000;
  font-family: 'Noto Serif JP', '游明朝', serif;
  padding: 0;
  border-radius: 0;
}

.notification-menu.show {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.notification-item {
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 0.9em;
  line-height: 1.4;
  color: #004D40;
}

.notification-item:last-child {
  border-bottom: none;
}

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

.notification-item a {
  text-decoration: none;
  color: inherit;
}

.unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #f44336;
  border-radius: 50%;
  margin-left: 6px;
}

@media (max-width: 900px) {
  .notification-menu {
    min-width: 140px;
    max-width: 200px;
    width: auto;
    right: 10px;
    left: auto !important;
  }

  .notification-item {
    padding: 8px 10px;
    font-size: 0.75em;
    line-height: 1.3;
  }

  .notification-item.mobile-hide {
    display: none;
  }
}

.bell-icon {
  font-size: 32px;
  color: #004D40;
  transition: color 0.3s ease;
}

.bell-icon:hover {
  color: #00897B;
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: #2196F3;
  color: white;
  font-size: 0.75em;
  padding: 0;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  text-align: center;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Login/Signup links for non-logged-in users */
.login-signup-links {
  display: flex;
  align-items: center;
  font-family: 'Noto Serif JP', '游明朝', serif;
  font-weight: bold;
}

.login-signup-links a {
  color: #00695c;
  text-decoration: underline;
}

/* Hide mobile-only switcher on desktop */
@media (min-width: 901px) {
  .mobile-only {
    display: none;
  }
}

/* Mobile menu button - hidden by default */
.mobile-menu-button {
  display: none !important;
}

/* Responsive styles */
@media (max-width: 1200px) {
  .menu-nav {
    gap: 20px;
    margin-left: 30px;
  }
  
  .menu-link {
    font-size: 0.95em;
  }
}

/* Mobile responsive styles */
@media (max-width: 900px) {
  header {
    display: flex;
    flex-direction: column !important;
    height: auto;
    padding: 10px;
    overflow: visible;
    justify-content: flex-start;
    align-items: stretch;
    border: none;
    box-shadow: none;
    box-sizing: border-box;
    position: relative;
  }
  
  /* First line - logo only */
  .logo-wrapper {
    display: inline-block;
    width: auto;
    margin-bottom: 15px;
    flex: 0 0 auto;
    align-self: flex-start;
    position: relative;
  }
  
  .logo-wrapper a {
    display: block;
  }
  
  header img {
    height: 80px;
    display: block;
    width: auto;
  }
  
  /* Second line container - all elements horizontally */
  .header-second-line {
    width: 100%;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex: 0 0 auto;
  }
  
  .menu-nav {
    margin-left: 0;
    gap: 5px;
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-start;
  }
  
  .menu-link {
    font-size: 0.7em;
    padding: 4px 2px;
    white-space: nowrap;
  }
  
  .menu-link::after {
    font-size: 1.1em;
  }
  
  .submenu {
    width: auto;
    min-width: 150px;
    right: auto;
    position: fixed;
    max-width: calc(100vw - 20px);
    z-index: 1000;
  }
  
  .submenu a {
    font-size: 0.65em;
    padding: 8px 12px;
    white-space: nowrap;
  }
  
  .profile-container {
    gap: 10px;
    flex-shrink: 0;
    display: flex;
    flex-direction: row !important;
    align-items: center;
    justify-content: flex-end;
    max-width: calc(100vw - 40px);
    overflow: visible;
  }
  
  .profile-info {
    flex-direction: row;
    gap: 8px;
    overflow: visible;
  }
  
  .profile-circle svg {
    width: 24px;
    height: 24px;
  }
  
  .profile-name {
    font-size: 0.75em;
    display: none !important;
  }
  
  .notification-wrapper {
    margin-right: 8px;
    flex-shrink: 0;
  }
  
  .bell-icon {
    font-size: 28px;
  }
  
  /* Mobile language switcher positioning */
  .language-switcher.mobile-only {
    display: flex !important;
    position: absolute;
    top: 55px;
    right: 15px;
    margin-right: 0;
    font-size: 0.85em;
    z-index: 100;
  }
  
  /* Hide desktop language switchers on mobile */
  .language-switcher.desktop-only {
    display: none !important;
  }
  
  .language-switcher span {
    padding: 4px 5px;
    min-width: auto;
    min-height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  .language-switcher .language-divider {
    padding: 4px 1px;
    min-width: auto;
  }
  
  .notification-badge {
    font-size: 0.7em;
    padding: 0;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
  }
  
  .logout-menu {
    width: auto;
    min-width: 110px;
    max-width: calc(100vw - 20px);
    right: 10px;
    left: auto !important;
  }
  
  .logout-menu a, .logout-link-button {
    font-size: 0.8em;
    padding: 8px 10px;
    white-space: nowrap;
    text-align: left;
  }
  
  .login-signup-links {
    font-size: 0.7em;
  }
}

/* Simple language content rules */
body.lang-jp .lang-en:not(.language-switcher .lang-en) {
  display: none !important;
}

body.lang-en .lang-jp:not(.language-switcher .lang-jp) {
  display: none !important;
}

/* Simple language content rules */
body.lang-jp .lang-en:not(.language-switcher .lang-en) {
  display: none !important;
}

body.lang-en .lang-jp:not(.language-switcher .lang-jp) {
  display: none !important;
}