/**
 * 設定モーダル - ダッシュボードスタイル
 * モダンでクリーンなダッシュボードUI
 */

/* ========== モーダルコンテナ ========== */
#settingsModal {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#settingsModal[aria-hidden="true"] {
  opacity: 0;
  visibility: hidden;
}

#settingsModal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

/* ========== モーダルコンテンツ ========== */
#settingsModal .modal-content {
  max-width: 520px;
  width: 90%;
  max-height: 85vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: settingsModalSlideIn 0.3s ease-out;
}

@keyframes settingsModalSlideIn {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ========== ヘッダー ========== */
#settingsModal .modal-header {
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

#settingsModal .modal-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
}

#settingsModal .modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Noto Sans JP", sans-serif;
  letter-spacing: -0.5px;
}

#settingsModal .modal-title::before {
  content: '⚙️';
  font-size: 20px;
  animation: settingsIconRotate 3s ease-in-out infinite;
}

@keyframes settingsIconRotate {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(90deg);
  }
  75% {
    transform: rotate(-90deg);
  }
}

#settingsModal #settingsClose {
  width: 32px;
  height: 32px;
  border: none;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 20px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
}

#settingsModal #settingsClose:hover {
  background: #e5e7eb;
  color: #374151;
  transform: rotate(90deg);
}

#settingsModal #settingsClose:active {
  transform: rotate(90deg) scale(0.95);
}

/* ========== ボディ ========== */
#settingsModal .modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  background: #f8fafc;
  min-height: 0;
}

/* スクロールバーのスタイル */
#settingsModal .modal-body::-webkit-scrollbar {
  width: 8px;
}

#settingsModal .modal-body::-webkit-scrollbar-track {
  background: transparent;
}

#settingsModal .modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

#settingsModal .modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ========== セクション（カード型） ========== */
#settingsModal .modal-section {
  background: #ffffff;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
  box-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.05),
    0 0 0 1px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

#settingsModal .modal-section:hover {
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

#settingsModal .modal-section-title {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
  font-family: "Noto Sans JP", sans-serif;
  display: flex;
  align-items: center;
  gap: 5px;
  padding-bottom: 6px;
  border-bottom: 2px solid #f3f4f6;
}

#settingsModal .modal-section-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 2px;
}

#settingsModal .modal-section-desc {
  margin: 0 0 8px 0;
  font-size: 11px;
  color: #6b7280;
  line-height: 1.5;
  font-family: "Noto Sans JP", sans-serif;
}

/* ========== ボタン ========== */
#settingsModal .button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Noto Sans JP", sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 
    0 2px 4px rgba(59, 130, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#settingsModal .button:hover {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 
    0 4px 8px rgba(59, 130, 246, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

#settingsModal .button:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 4px rgba(59, 130, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* セカンダリボタン */
#settingsModal .button.secondary {
  background: linear-gradient(180deg, #f3f4f6 0%, #e5e7eb 100%);
  color: #374151;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

#settingsModal .button.secondary:hover {
  background: linear-gradient(180deg, #e5e7eb 0%, #d1d5db 100%);
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ========== レイアウトエディター ========== */
#settingsModal .layout-editor-list {
  background: #f9fafb;
  border-radius: 6px;
  padding: 6px;
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
  min-height: 80px;
}

#settingsModal .layout-editor-list > div:not([style*="height:1px"]),
#settingsModal .layout-editor-item,
#settingsModal .layout-editor-name-row {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 4px;
  cursor: move;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-size: 12px;
  color: #374151;
  font-family: "Noto Sans JP", sans-serif;
}

#settingsModal .layout-editor-name-row {
  cursor: not-allowed;
  opacity: 0.6;
}

#settingsModal .layout-editor-name {
  font-weight: 600;
  flex: 1;
}

#settingsModal .layout-editor-drag-handle {
  font-size: 16px;
  opacity: 0.5;
}

#settingsModal .layout-editor-list > div:not([style*="height:1px"]):hover:not(.layout-editor-name-row),
#settingsModal .layout-editor-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
  transform: translateX(4px);
}

#settingsModal .layout-editor-list > div.dragging,
#settingsModal .layout-editor-item.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

#settingsModal .layout-editor-list > div:not([style*="height:1px"]):not(.layout-editor-name-row)::before,
#settingsModal .layout-editor-item::before {
  content: '☰';
  color: #9ca3af;
  font-size: 18px;
  flex-shrink: 0;
  margin-right: 4px;
}

/* 区切り線 */
#settingsModal .layout-editor-list > div[style*="height:1px"] {
  height: 1px;
  background: #e5e7eb;
  margin: 8px 0;
  padding: 0;
  border: none;
  box-shadow: none;
  cursor: default;
}

#settingsModal .layout-editor-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ========== 入力フィールド ========== */
#settingsModal input[type="text"],
#settingsModal input[type="number"],
#settingsModal select,
#settingsModal textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: "Noto Sans JP", sans-serif;
  background: #ffffff;
  color: #1f2937;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#settingsModal input[type="text"]:focus,
#settingsModal input[type="number"]:focus,
#settingsModal select:focus,
#settingsModal textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 
    0 0 0 3px rgba(59, 130, 246, 0.1),
    0 2px 4px rgba(0, 0, 0, 0.05);
}

#settingsModal input[type="text"]:disabled,
#settingsModal input[type="number"]:disabled,
#settingsModal select:disabled,
#settingsModal textarea:disabled {
  background: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

/* ========== ラベル ========== */
#settingsModal label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
  font-family: "Noto Sans JP", sans-serif;
}

/* ========== モバイル対応 ========== */
@media (max-width: 768px) {
  #settingsModal .modal-content {
    max-width: 95vw;
    width: calc(100% - 16px);
    max-height: 95vh;
  }

  #settingsModal .modal-header {
    padding: 10px 14px;
  }

  #settingsModal .modal-title {
    font-size: 16px;
  }

  #settingsModal .modal-body {
    padding: 10px 14px;
  }

  #settingsModal .modal-section {
    padding: 10px 12px;
  }

  #settingsModal .modal-section-title {
    font-size: 13px;
  }
}

