/* ========================================
   SidePanel -- 共通サイドパネル
   ======================================== */

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  background: var(--color-surface, #fafbfc);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.side-panel.open {
  transform: translateX(0);
}

/* minimize状態: 右端にちょっとだけ見える */
.side-panel.minimized {
  transition: transform 0.25s ease;
}

/* リサイズハンドル */
.side-panel__resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 10;
  transition: background 0.15s;
}

@media (hover: hover) and (pointer: fine) {
  .side-panel__resize-handle:hover,
  .side-panel__resize-handle:active {
    background: var(--color-accent-strong, #7986cb);
    opacity: 0.4;
  }
}

/* 幅リセットボタン(ドラッグ直後の数秒だけ表示、左下でコンテンツの邪魔をしない) */
.side-panel__reset-width {
  position: absolute;
  left: 10px;
  bottom: 14px;
  z-index: 11;
  padding: 3px 9px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface, #fafbfc);
  color: var(--color-muted);
  font-size: 11px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.side-panel__reset-width.visible {
  opacity: 1;
  pointer-events: auto;
}

.side-panel__reset-width:hover {
  border-color: var(--color-accent-strong, #7986cb);
  color: var(--color-accent-strong, #7986cb);
}

/* 取っ手ボタン（minimize/restore トグル） */
.side-panel__toggle {
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 64px;
  border: 1px solid var(--color-surface);
  border-radius: 6px 0 0 6px;
  background: var(--color-surface);
  color: var(--color-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 11;
  transition:
    color 0.15s,
    background 0.15s;
  touch-action: manipulation;
  padding: 0;
}

@media (hover: hover) and (pointer: fine) {
  .side-panel__toggle:hover {
    color: var(--color-text);
    background: var(--color-surface-alt);
  }
}

/* minimize時（閉じてるとき）の取っ手 */
.side-panel.minimized .side-panel__toggle {
  background: var(--color-target);
  border-color: var(--color-target);
}

/* ヘッダー */
.side-panel__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.side-panel__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ボディ（スクロール可能） */
.side-panel__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
/* 文書系パネルの標準内余白 (SidePanel.open の padded: true で付く)。
   一覧系は区切り線を端まで届かせるため余白なしの既定を使う */
.side-panel__body--padded {
  padding: 12px 16px;
}

/* ヘッダー内の戻るボタン (アイコンのみ) */
.side-panel__back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition:
    color 0.15s,
    background 0.15s;
  touch-action: manipulation;
  position: relative;
}

/* タップ領域 44x44 確保 (見た目は 28x28 維持、 qc-btn-consult パターン、
   2026-06-04 UI スイープで検出) */
.side-panel__back-btn::before {
  content: '';
  position: absolute;
  inset: -8px;
}

@media (hover: hover) and (pointer: fine) {
  .side-panel__back-btn:hover:not(:disabled) {
    color: var(--color-text);
    background: var(--color-surface-alt);
  }
}

.side-panel__back-btn:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

/* ヘッダー内アクションボタン */
.side-panel__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.side-panel__action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition:
    color 0.15s,
    background 0.15s;
  touch-action: manipulation;
  position: relative;
}

/* タップ領域 44x44 確保 */
.side-panel__action-btn::before {
  content: '';
  position: absolute;
  inset: -8px;
}

@media (hover: hover) and (pointer: fine) {
  .side-panel__action-btn:hover:not(:disabled) {
    color: var(--color-text);
    background: var(--color-surface-alt);
  }
}

.side-panel__action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* 閉じるボタン */
.side-panel__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition:
    color 0.15s,
    background 0.15s;
  touch-action: manipulation;
  flex-shrink: 0;
  position: relative;
}

/* タップ領域 44x44 確保 */
.side-panel__close::before {
  content: '';
  position: absolute;
  inset: -8px;
}

@media (hover: hover) and (pointer: fine) {
  .side-panel__close:hover {
    color: var(--color-text);
    background: var(--color-surface-alt);
  }
}

/* ユーザープロフィールパネル */
.user-profile-panel {
  padding: 16px;
}

/* カード: アバター + 情報 + レベル */
.user-profile-panel__card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--color-surface-alt);
  border-radius: 12px;
  margin-bottom: 12px;
}

.user-profile-panel__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-profile-panel__avatar--editable {
  cursor: pointer;
  transition: opacity 0.15s;
}

.user-profile-panel__avatar--editable:hover {
  opacity: 0.8;
}

.user-profile-panel__avatar--placeholder {
  background: var(--color-accent-bg);
  color: var(--color-accent-text);
  font-size: 1.4rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-profile-panel__info {
  flex: 1;
  min-width: 0;
}

.user-profile-panel__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-profile-panel__title {
  font-size: 0.75rem;
  color: var(--color-accent);
  margin-top: 2px;
}

.user-profile-panel__role-badge {
  display: inline-block;
  font-size: 0.65rem;
  color: var(--color-muted);
  background: var(--color-bg);
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
}

.user-profile-panel__deleted-badge {
  display: block;
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-muted);
  background: var(--color-surface-alt);
  padding: 6px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.user-profile-panel__level {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-accent);
  white-space: nowrap;
}

/* ステータス: 横並び */
.user-profile-panel__stats {
  display: flex;
  gap: 1px;
  background: var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}

.user-profile-panel__stat {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  background: var(--color-surface);
}

.user-profile-panel__stat-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
}

.user-profile-panel__stat-label {
  font-size: 0.65rem;
  color: var(--color-muted);
  margin-top: 2px;
}

/* プロフィール内セクション */
.user-profile-panel__section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.user-profile-panel__section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* アクションボタン */
.user-profile-panel__actions {
  display: flex;
  gap: 8px;
}

.user-profile-panel__action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.15s;
}

.user-profile-panel__action-btn:hover {
  background: var(--color-surface-alt);
}

/* レスポンシブ: モバイルでは全幅 */
@media (max-width: 1199px) {
  .side-panel {
    width: 100% !important;
  }

  .side-panel__resize-handle {
    display: none;
  }
}
