/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   らくらくAI秘書 — セットアップページ
   モバイルファースト / iPhone Safari 最適化
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

:root {
  --primary: #4A90D9;
  --primary-dark: #3A7BC8;
  --success: #34C759;
  --error: #FF3B30;
  --warning: #FF9500;
  --bg: #F5F5F7;
  --card-bg: #FFFFFF;
  --text: #1D1D1F;
  --text-secondary: #86868B;
  --border: #D2D2D7;
  --line-green: #06C755;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* ── ヘッダー ── */
.header {
  text-align: center;
  padding: 20px 0;
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* ── 進捗バー ── */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 16px 0 8px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 25%;
}

.step-label {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ── ステップ共通 ── */
.step h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.description {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.hidden {
  display: none !important;
}

/* ── サービス選択グリッド ── */
.service-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.service-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.service-card input[type="checkbox"] {
  display: none;
}

.service-card:has(input:checked) {
  border-color: var(--primary);
  background: #EBF2FC;
}

.service-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.service-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.service-desc {
  font-size: 11px;
  color: var(--text-secondary);
}

.service-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  justify-content: center;
}

.example-tag {
  font-size: 10px;
  color: var(--primary-dark);
  background: #EBF2FC;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.4;
}

.section-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 20px 0 12px;
  padding-left: 4px;
}

.hint {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 20px;
}

/* ── ボタン ── */
.btn {
  display: block;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
  margin-bottom: 12px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:active {
  background: var(--primary-dark);
  transform: scale(0.98);
}

.btn-back {
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 10px;
}

.btn-sm {
  display: inline-block;
  width: auto;
  padding: 10px 20px;
  font-size: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 12px;
}

.btn-sm:active {
  background: var(--bg);
}

.btn-line {
  background: var(--line-green);
  color: white;
}

.btn-line:active {
  background: #05B34B;
}

/* ── 権限説明 ── */
.permissions-box {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0;
}

.permissions-box h3 {
  font-size: 15px;
  margin-bottom: 12px;
}

.permission-service-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 4px;
  font-size: 14px;
  font-weight: 600;
  border-top: 1px solid var(--bg);
  margin-top: 8px;
}

.permission-service-header:first-child {
  border-top: none;
  margin-top: 0;
}

.permission-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 6px 20px;
  font-size: 13px;
  color: var(--text-secondary);
}


.permission-example-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 0 4px 20px;
}

.permission-example-item {
  font-size: 12px;
  color: var(--primary-dark);
  background: #EBF2FC;
  padding: 6px 12px;
  margin: 4px 0 4px 20px;
  border-radius: 6px;
}

.permissions-note {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 12px;
  line-height: 1.5;
}

/* ── LINE設定ステップ ── */
.line-steps {
  margin-bottom: 20px;
}

.line-step {
  background: var(--card-bg);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.line-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
}

.line-step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}

.line-step-title {
  font-size: 15px;
  font-weight: 600;
}

.line-step-body {
  padding: 16px;
}

.line-step-body p {
  font-size: 14px;
  margin-bottom: 12px;
}

.line-step-body ul {
  font-size: 14px;
}

.simple-list {
  list-style: none;
  padding: 0;
}

.simple-list li {
  padding: 6px 0;
  padding-left: 16px;
  position: relative;
}

.simple-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary);
}

/* ── 入力フィールド ── */
.input-group {
  margin: 12px 0;
}

.input-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: var(--primary);
}

.validation-status {
  font-size: 13px;
  margin-top: 6px;
  min-height: 20px;
}

.validation-status.success {
  color: var(--success);
}

.validation-status.error {
  color: var(--error);
}

/* ── スピナー ── */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto 20px;
}

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

/* ── 完了画面 ── */
.complete-icon, .error-icon {
  font-size: 64px;
  text-align: center;
  margin: 30px 0 16px;
}

.usage-examples {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0;
}

.usage-examples h3 {
  font-size: 15px;
  margin-bottom: 12px;
}

.example-card {
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 8px;
}

.example-card:last-child {
  margin-bottom: 0;
}

/* ── セットアップログ ── */
.setup-log {
  text-align: left;
  background: var(--card-bg);
  border-radius: 8px;
  padding: 12px;
  margin-top: 20px;
  font-size: 13px;
  max-height: 200px;
  overflow-y: auto;
}

.setup-log-item {
  padding: 4px 0;
  color: var(--text-secondary);
}

.setup-log-item.done {
  color: var(--success);
}

.setup-log-item.active {
  color: var(--text);
}

/* ── サポートボックス ── */
.support-box {
  text-align: center;
  padding: 16px;
  background: var(--card-bg);
  border-radius: 12px;
  margin-top: 20px;
}

.support-box p {
  font-size: 14px;
  margin: 4px 0;
}

/* ── フッター ── */
.footer {
  text-align: center;
  padding: 24px 0;
  color: var(--text-secondary);
  font-size: 12px;
}

/* ── レスポンシブ ── */
@media (max-width: 360px) {
  .service-grid {
    grid-template-columns: 1fr;
  }
}
