/**
 * Findout User Menu Styles
 * ユーザーメニューショートコードのスタイル
 */

/* テーマの content-box でも padding+width で横にはみ出さない */
.findout-user-menu-container,
.findout-user-menu-container * {
  box-sizing: border-box;
}

.findout-user-menu-container {
  display: flex;
  justify-content: flex-end;
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-top: 10px;
}

.findout-user-menu-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 20px;
  max-width: 100%;
  min-width: 0;
}

/* 未読お知らせアイコン */
.findout-notification-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  height: 20px;
}

/* アイコンとドロワー間の8pxギャップをホバーで繋ぐ（フォーカスが外れて再読み込みしないように） */
.findout-notification-icon-wrapper::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 8px;
  pointer-events: auto;
}

.findout-notification-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none !important;
  color: inherit;
  transition: background-color 0.2s ease;
  position: relative;
  line-height: 1;
}

.findout-notification-icon-link:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.findout-notification-icon {
  font-size: 20px;
  color: #333;
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

.findout-notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: #ff4444;
  color: #fff;
  border-radius: 10px;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  padding: 0 6px;
  box-sizing: border-box;
  border: 2px solid #fff;
}

/* お知らせドロワー */
.findout-notification-drawer {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: min(400px, calc(100vw - 24px));
  min-width: 0;
  max-width: min(400px, calc(100vw - 24px));
  max-height: 500px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.findout-notification-icon-wrapper:hover .findout-notification-drawer,
.findout-notification-drawer.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.findout-notification-drawer-content {
  display: flex;
  flex-direction: column;
  max-height: 500px;
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
}

.findout-notification-drawer-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.findout-notification-drawer-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.findout-notification-drawer-list {
  flex: 1;
  overflow-y: auto;
  max-height: 400px;
  padding: 8px 0;
}

.findout-notification-drawer-list::-webkit-scrollbar {
  width: 6px;
}

.findout-notification-drawer-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.findout-notification-drawer-list::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.findout-notification-drawer-list::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.findout-notification-drawer-item {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
  cursor: pointer;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.findout-notification-drawer-item:hover {
  background-color: #f5f5f5;
}

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

.findout-notification-drawer-item-title {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.findout-notification-drawer-item-date {
  font-size: 12px;
  color: #666;
}

.findout-notification-drawer-loading,
.findout-notification-drawer-empty {
  padding: 20px 16px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.findout-notification-drawer-footer {
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
  text-align: center;
}

.findout-notification-drawer-all-link {
  display: inline-block;
  color: #0073aa;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.findout-notification-drawer-all-link:hover {
  color: #005a87;
}

/* ユーザーアバター */
.findout-user-avatar-wrapper {
  position: relative;
  height: 30px;
}

.findout-user-avatar-btn,
.findout-user-avatar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background-color: transparent;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  text-decoration: none;
}

.findout-user-avatar-btn:hover,
.findout-user-avatar-link:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.findout-user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.findout-user-avatar-initial {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e7ecf1;
  color: #334155;
  font-weight: 700;
  font-size: 14px;
}

/* ドロワーメニュー */
.findout-user-drawer {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: min(280px, calc(100vw - 24px));
  min-width: min(200px, 100%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease;
  z-index: 1000;
  overflow-x: hidden;
}

.findout-user-avatar-wrapper:hover .findout-user-drawer,
.findout-user-drawer.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.findout-user-drawer-content {
  padding: 12px 0;
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
}

.findout-user-drawer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 8px;
}

.findout-user-drawer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.findout-user-drawer-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.findout-user-drawer-menu {
  display: flex;
  flex-direction: column;
}

.findout-user-drawer-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  text-decoration: none;
  color: #333;
  font-size: 14px;
  transition: background-color 0.2s ease;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-align: left;
  overflow-wrap: anywhere;
}

.findout-user-drawer-item:hover {
  background-color: #f5f5f5;
}

.findout-user-drawer-item-logout {
  color: #d32f2f;
}

.findout-user-drawer-item-logout:hover {
  background-color: #ffebee;
}

.findout-user-drawer-item-text {
  display: block;
}

/* ログインボタン */
.findout-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background-color: #0073aa;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.findout-login-btn:hover {
  background-color: #005a87;
  color: #fff;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .findout-user-menu-wrapper {
    gap: 8px;
  }

  .findout-notification-icon-link,
  .findout-user-avatar-btn {
    width: 36px;
    height: 36px;
  }

  .findout-notification-icon {
    width: 20px;
    height: 20px;
  }
}
