.header {
  background-color: #000;
  padding: 8px 12px;
  color: #FFFFFF;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  z-index: 1001;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.header-inner-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 8px;
}

/* 左側：ロゴ */
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hamburger-menu {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.hamburger-menu:hover {
  background-color: #282828;
}

.header-logo-link {
  display: flex;
  align-items: center;
}

.header-smipe-logo {
  width: 32px;
  height: 32px;
}

.header-site-name {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  margin-left: 8px;
}

/* 中央：ホームボタン + 検索バー */
.header-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 546px;
}

.header-home-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #1f1f1f;
  color: #b3b3b3;
  text-decoration: none;
  transition: transform 0.2s, color 0.2s, background-color 0.2s;
  flex-shrink: 0;
}

.header-home-btn:hover {
  transform: scale(1.04);
  color: #fff;
  background-color: #2a2a2a;
}

.header-home-btn svg {
  width: 24px;
  height: 24px;
}

/* 検索バー */
.header-search-wrapper {
  flex: 1;
  position: relative;
}

.header-search-container {
  display: flex;
  align-items: center;
  background-color: #1f1f1f;
  border-radius: 500px;
  padding: 0 12px;
  height: 48px;
  transition: background-color 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
}

.header-search-container:hover {
  background-color: #2a2a2a;
  border-color: #3e3e3e;
}

.header-search-container:focus-within {
  background-color: #2a2a2a;
  border-color: #fff;
}

.header-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 8px;
  color: #b3b3b3;
  cursor: pointer;
  flex-shrink: 0;
}

.header-search-container:focus-within .header-search-icon {
  color: #fff;
}

.header-search-icon svg {
  width: 24px;
  height: 24px;
}

.header-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  outline: none;
  padding: 0 8px;
  min-width: 0;
}

.header-search-input::placeholder {
  color: #b3b3b3;
}

/* 右側：ユーザーコントロール */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-user-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #282828;
  border: none;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: transform 0.2s, background-color 0.2s;
}

.header-user-btn:hover {
  transform: scale(1.04);
  background-color: #3e3e3e;
}

.header-user-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-user-initial {
  color: #000;
  font-size: 13px;
  font-weight: 700;
  background-color: #f573a0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logout-link {
  display: none;
  text-decoration: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 16px;
  border: 1px solid #727272;
  border-radius: 500px;
  transition: transform 0.2s, border-color 0.2s, background-color 0.2s;
}

.header-logout-link:hover {
  transform: scale(1.04);
  border-color: #fff;
}

/* Signup Link */
.header-signup-link {
  color: #b3b3b3;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 16px;
  transition: color 0.2s, transform 0.2s;
}

.header-signup-link:hover {
  color: #fff;
  transform: scale(1.04);
}

/* Login Button */
.header-login-btn {
  background-color: #fff;
  color: #000;
  border: none;
  border-radius: 500px;
  padding: 8px 32px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  white-space: nowrap;
}

.header-login-btn:hover {
  transform: scale(1.04);
  background-color: #f0f0f0;
}

/* PC表示 */
@media (min-width: 769px) {
  .header {
    left: 0;
    width: 100%;
    padding: 8px 24px;
  }

  /* ロゴはサイドバー幅に収まるように配置 */
  .header-left {
    width: 200px;
    flex-shrink: 0;
  }

  .header-logout-link {
    display: block;
  }
}

/* モバイル表示 */
@media (max-width: 768px) {
  .header {
    padding: 8px 12px;
    height: 56px;
  }

  .hamburger-menu {
    display: flex;
  }

  .header-site-name {
    display: none;
  }

  .header-center {
    flex: 1;
  }

  .header-home-btn {
    width: 40px;
    height: 40px;
  }

  .header-home-btn svg {
    width: 20px;
    height: 20px;
  }

  .header-search-container {
    height: 40px;
    padding: 0 8px;
  }

  .header-search-icon {
    padding: 4px;
  }

  .header-search-icon svg {
    width: 20px;
    height: 20px;
  }

  .header-search-input {
    font-size: 13px;
  }

  .header-google-login-btn {
    padding: 6px 16px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .header-search-input::placeholder {
    font-size: 12px;
  }
}

/* 検索結果ドロップダウン */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background-color: #282828;
  border-radius: 8px;
  box-shadow: 0 16px 24px rgba(0, 0, 0, 0.3), 0 6px 8px rgba(0, 0, 0, 0.2);
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1002;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
  padding: 4px 0;
}

.search-results.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.search-results::-webkit-scrollbar {
  width: 8px;
}

.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
  background: #ffffff40;
  border-radius: 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.2s;
  overflow: visible;
}

.search-result-item:hover,
.search-result-item.selected {
  background-color: #3e3e3e;
}

.search-result-item:first-child {
  border-radius: 8px 8px 0 0;
}

.search-result-item:last-child {
  border-radius: 0 0 8px 8px;
}

.search-result-thumbnail {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-artist {
  color: #b3b3b3;
  font-size: 12px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-duration {
  color: #b3b3b3;
  font-size: 12px;
  flex-shrink: 0;
}

.search-no-results {
  padding: 20px;
  text-align: center;
  color: #b3b3b3;
  font-size: 14px;
}

/* 検索トースト */
.search-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background-color: #1DB954;
  color: #000;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  z-index: 2000;
  animation: toastFadeInOut 3s ease-in-out;
}

@keyframes toastFadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  90% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* モバイル用の検索結果調整 */
@media (max-width: 768px) {
  .search-results {
    max-height: 300px;
  }

  .search-result-item {
    padding: 8px 12px;
    gap: 10px;
  }

  .search-result-thumbnail {
    width: 40px;
    height: 40px;
  }

  .search-result-title {
    font-size: 13px;
  }

  .search-result-artist {
    font-size: 11px;
  }
}
