/* Header and navigation shared styles for all pages */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background-color: #f8f8f8;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  height: 56px;
  border-bottom: 1px solid #e5e7eb;
}

header h1 {
  margin: 0;
  font-size: 20px;
  color: #000;
  line-height: 1;
}

#menu-toggle {
  display: none;
}

.hamburger {
  display: none;
  font-size: 28px;
  cursor: pointer;
}

header nav {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 10;
}

header nav a {
  text-decoration: none;
  color: #333;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}


.user-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.user-dropdown summary {
  list-style: none;
  cursor: pointer;
  color: #0f172a;
  outline: none;
  display: flex;
  align-items: center;
}

.user-dropdown summary::-webkit-details-marker {
  display: none;
}

.user-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dbe1ea;
  background: #ffffff;
  border-radius: 999px;
  padding: 4px 8px 4px 4px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  max-width: 180px;
}

.user-dropdown summary:hover .user-dropdown-trigger {
  border-color: #b8c3d3;
  background: #f8fafc;
}

.user-dropdown summary:focus-visible .user-dropdown-trigger {
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.12);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  max-width: 105px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.user-chevron {
  width: 12px;
  height: 12px;
  min-width: 12px;
  min-height: 12px;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  font-size: 11px;
  line-height: 1;
  flex: 0 0 12px;
}

.user-dropdown[open] .user-chevron {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 170px;
  background: #fff;
  border: 1px solid #dbe1ea;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  padding: 6px;
  z-index: 1001;
}

.user-dropdown[open] .user-dropdown-menu {
  display: block;
}

.user-dropdown-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
}

.user-dropdown-menu a:hover {
  background: #eef2f7;
}

@media (max-width: 768px) {
  header nav {
    display: none;
  }

  .hamburger {
    display: block;
    line-height: 1;
  }

  header nav.mobile-nav {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 56px;
    right: 12px;
    background-color: #fff;
    padding: 10px 12px;
    gap: 8px;
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 2147483647;
    min-width: 220px;
  }

  header nav.mobile-nav a {
    font-size: 14px;
    line-height: 1.2;
  }

  .user-dropdown-menu {
    position: static;
    border: 1px solid #e2e8f0;
    box-shadow: none;
    background: #f8fafc;
    padding: 6px;
    margin-top: 6px;
    border-radius: 10px;
    min-width: 0;
  }

  .user-dropdown-menu a {
    padding: 8px 10px;
  }

  .user-dropdown-trigger {
    max-width: 100%;
    width: 100%;
  }

  .user-name {
    max-width: 120px;
  }

  #menu-toggle:checked + .hamburger + nav.mobile-nav {
    display: flex;
  }
}
