/**
 * 設定モーダル スタイル
 * 左ペインにメニュー、右ペインにコンテンツを表示
 */

/* ========================================
   背景スクロール防止
   ======================================== */
body:has(.settings-modal.show) {
  overflow: hidden;
}

/* ========================================
   モーダルオーバーレイ
   ======================================== */
.settings-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2100;
  justify-content: center;
  align-items: center;
}

.settings-modal.show {
  display: flex;
}

/* ========================================
   モーダルコンテンツ
   ======================================== */
.settings-modal-content {
  background: #ffffff;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  height: 70vh;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: settingsModalIn 0.3s ease;
  display: flex;
  flex-direction: column;
}

@keyframes settingsModalIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   ヘッダー
   ======================================== */
.settings-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}

.settings-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.settings-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.settings-modal-close:hover {
  color: #1f2937;
}

/* ========================================
   ボディ（左右ペイン構造）
   ======================================== */
.settings-modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ========================================
   左ペイン：メニュー
   ======================================== */
.settings-menu {
  width: 200px;
  min-width: 200px;
  background: #f3f4f6;
  border-right: 1px solid #e5e7eb;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.settings-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.settings-menu-item:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.settings-menu-item.active {
  background: #ffffff;
  color: #2563eb;
  border-left: 3px solid #2563eb;
  padding-left: 13px;
}

.settings-menu-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.settings-menu-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   右ペイン：コンテンツ
   ======================================== */
.settings-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: #ffffff;
}

/* ========================================
   ご利用にあたって コンテンツ
   ======================================== */
.settings-terms h4 {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  padding-bottom: 12px;
  border-bottom: 2px solid #e5e7eb;
}

.terms-section {
  margin-bottom: 24px;
}

.terms-section:last-child {
  margin-bottom: 0;
}

.terms-section h5 {
  margin: 0 0 12px 0;
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

.terms-section p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: #4b5563;
}

.terms-section ul {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: #4b5563;
}

.terms-section li {
  margin-bottom: 6px;
}

.terms-section li:last-child {
  margin-bottom: 0;
}

/* ========================================
   ユーザー情報 コンテンツ
   ======================================== */
.settings-userinfo h4 {
  margin: 0 0 24px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  padding-bottom: 12px;
  border-bottom: 2px solid #e5e7eb;
}

.userinfo-item {
  display: flex;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid #f3f4f6;
}

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

.userinfo-label {
  width: 160px;
  min-width: 160px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
}

.userinfo-value {
  flex: 1;
  font-size: 14px;
  color: #1f2937;
  font-weight: 500;
}

.userinfo-item-list {
  flex-direction: column;
  gap: 8px;
}

.userinfo-item-list .userinfo-label {
  width: auto;
  margin-bottom: 8px;
}

.userinfo-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: #1f2937;
}

.userinfo-list li {
  margin-bottom: 4px;
}

.userinfo-list li:last-child {
  margin-bottom: 0;
}

/* グループ付き試合種別リスト */
.userinfo-grouped-list {
  padding-left: 0;
  list-style: none;
}

.userinfo-group {
  margin-bottom: 12px;
}

.userinfo-group:last-child {
  margin-bottom: 0;
}

.userinfo-group-name {
  display: block;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
  font-size: 14px;
}

.userinfo-sublist {
  margin: 0;
  padding-left: 20px;
  list-style: disc;
  font-size: 13px;
  line-height: 1.6;
  color: #4b5563;
}

.userinfo-sublist li {
  margin-bottom: 2px;
}

.userinfo-sublist li:last-child {
  margin-bottom: 0;
}

/* ========================================
   ローディング表示
   ======================================== */
.settings-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #6b7280;
}

.settings-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: settingsSpinner 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes settingsSpinner {
  to {
    transform: rotate(360deg);
  }
}

.settings-loading p {
  margin: 0;
  font-size: 14px;
}

/* ========================================
   エラー表示
   ======================================== */
.settings-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #dc2626;
}

.settings-error p {
  margin: 0 0 16px 0;
  font-size: 14px;
}

.settings-retry-btn {
  padding: 8px 16px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.settings-retry-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* ========================================
   レスポンシブ対応
   ======================================== */
@media (max-width: 640px) {
  .settings-modal-content {
    width: 95%;
    height: 85vh;
    max-height: calc(100vh - 24px);
  }

  .settings-modal-body {
    flex-direction: column;
  }

  .settings-menu {
    width: 100%;
    min-width: 100%;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    gap: 8px;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }

  .settings-menu-item {
    flex-shrink: 0;
    padding: 10px 14px;
    border-radius: 6px;
    white-space: nowrap;
  }

  .settings-menu-item.active {
    border-left: none;
    padding-left: 14px;
    border-bottom: 2px solid #2563eb;
    border-radius: 6px 6px 0 0;
  }

  .settings-content {
    padding: 16px;
  }

  .settings-terms h4 {
    font-size: 18px;
  }
}
