/* ページミル スタイルシート */

/* ============================================================
   CSS変数 / カラーパレット
   ============================================================ */
:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-bg: #ffffff;
  --color-bg-secondary: #f9fafb;
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;
  --color-success: #059669;
  --color-success-bg: #ecfdf5;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

/* ============================================================
   リセット・ベース
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

ul { list-style: none; }

/* ============================================================
   レイアウト
   ============================================================ */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ============================================================
   ヘッダー
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.nav-link:hover { color: var(--color-text); text-decoration: none; }

/* ============================================================
   メインコンテンツ
   ============================================================ */
.main-content {
  flex: 1;
}

/* ============================================================
   フッター
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ============================================================
   ボタン
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .5rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline:hover {
  background: var(--color-primary-light);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.btn-ghost:hover {
  background: var(--color-bg-secondary);
}

.btn-full { width: 100%; }

.btn-lg {
  padding: .75rem 2rem;
  font-size: 1rem;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ============================================================
   セクション
   ============================================================ */
.section {
  padding: 4rem 0;
  border-bottom: 1px solid var(--color-border);
}
.section:last-child { border-bottom: none; }

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2.5rem;
}

/* ============================================================
   LP - ヒーロー
   ============================================================ */
.lp-hero {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, #fff 60%);
  padding: 5rem 0 4rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 1.25rem;
}

.hero-desc {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  line-height: 1.75;
}

/* ============================================================
   LP - カードグリッド
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: .75rem;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .5rem;
}

.feature-card p {
  font-size: .875rem;
  color: var(--color-text-muted);
}

/* ============================================================
   LP - ステップ
   ============================================================ */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  text-align: center;
}

.step-number {
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.step h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: .5rem;
}

.step p {
  font-size: .9rem;
  color: var(--color-text-muted);
}

/* ============================================================
   LP - 料金
   ============================================================ */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 700px;
  margin: 0 auto;
}

.pricing-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  background: var(--color-bg);
  box-shadow: var(--shadow);
  position: relative;
}

.pricing-card-pro {
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(37,99,235,.15);
}

.pro-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: .2rem .75rem;
  border-radius: 999px;
}

.pricing-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.price {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
}

.price span {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.feature-list {
  margin-bottom: 1.5rem;
}

.feature-list li {
  padding: .35rem 0;
  font-size: .9rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
.feature-list li:last-child { border-bottom: none; }

/* ============================================================
   LP - CTA
   ============================================================ */
.cta-section {
  text-align: center;
}

.cta-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: .75rem;
}

.cta-section p {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

/* ============================================================
   認証ページ
   ============================================================ */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px - 80px);
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-description {
  color: var(--color-text-muted);
  font-size: .9rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .375rem;
}

.form-group label {
  font-size: .875rem;
  font-weight: 600;
}

.form-input {
  padding: .625rem .875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ============================================================
   送信完了
   ============================================================ */
.sent-message {
  text-align: center;
}

.sent-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.sent-message h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: .75rem;
}

.sent-message p {
  color: var(--color-text-muted);
  font-size: .9rem;
  margin-bottom: .75rem;
  line-height: 1.7;
}

.sent-note {
  font-size: .8rem !important;
  color: #9ca3af !important;
  margin-bottom: 1.5rem !important;
}

/* ============================================================
   アラート
   ============================================================ */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid #fecaca;
}

.alert-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid #a7f3d0;
}

/* ============================================================
   アプリ画面
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 0 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ============================================================
   空状態
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 5rem 1rem;
  max-width: 500px;
  margin: 0 auto;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1.25rem;
}

.empty-state h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: .75rem;
}

.empty-state p {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  line-height: 1.7;
}

.empty-examples {
  font-size: .875rem;
  background: var(--color-bg-secondary);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: left;
  line-height: 2;
}

/* ============================================================
   カード
   ============================================================ */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

/* ============================================================
   テーブル
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.watch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.watch-table th {
  text-align: left;
  padding: .75rem 1rem;
  background: var(--color-bg-secondary);
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
  white-space: nowrap;
}

.watch-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.watch-row:hover td {
  background: var(--color-primary-light);
}

.watch-name {
  font-weight: 600;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-url .url-text {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  color: var(--color-text-muted);
  font-size: .85rem;
}

/* ============================================================
   バッジ
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-paused {
  background: #fef3c7;
  color: #d97706;
}

.badge-error {
  background: var(--color-error-bg);
  color: var(--color-error);
}

/* ============================================================
   watchカウント表示
   ============================================================ */
.watch-count {
  font-size: .875rem;
  color: var(--color-text-muted);
  margin-top: .25rem;
}

/* ============================================================
   フォーム
   ============================================================ */
.watch-form {
  margin-bottom: 1.5rem;
}

.form-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.form-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
}

.required {
  color: var(--color-error);
}

.muted {
  color: var(--color-text-muted);
  font-size: .85rem;
  font-weight: 400;
}

/* ============================================================
   アップグレードバナー
   ============================================================ */
.upgrade-banner {
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.upgrade-banner p {
  margin: 0;
  font-size: .9rem;
}

.btn-sm {
  padding: .35rem .9rem;
  font-size: .8rem;
}

/* ============================================================
   詳細ページ
   ============================================================ */
.back-link {
  font-size: .875rem;
  color: var(--color-text-muted);
  display: inline-block;
  margin-bottom: .5rem;
}

.watch-url-display {
  font-size: .875rem;
  color: var(--color-text-muted);
  margin-top: .25rem;
}

.header-actions {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}

.detail-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.detail-settings h2,
.detail-diff h2,
.detail-events h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.watch-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}

.btn-danger {
  background: transparent;
  color: var(--color-error);
  border-color: var(--color-error);
}

.btn-danger:hover {
  background: var(--color-error-bg);
}

.upgrade-hint {
  font-size: .8rem;
  color: var(--color-text-muted);
}

/* ============================================================
   差分表示
   ============================================================ */
.diff-view {
  font-family: monospace;
  font-size: .85rem;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.diff-line {
  display: flex;
  padding: 2px 8px;
  line-height: 1.5;
}

.diff-added {
  background: #dcfce7;
}

.diff-removed {
  background: #fee2e2;
}

.diff-unchanged {
  background: transparent;
}

.diff-prefix {
  width: 1.25rem;
  flex-shrink: 0;
  color: var(--color-text-muted);
  user-select: none;
}

.diff-text {
  white-space: pre-wrap;
  word-break: break-all;
}

.snapshot-preview {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem;
}

.snapshot-text {
  font-size: .8rem;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================================
   イベントタイムライン
   ============================================================ */
.event-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.event-item {
  padding: .875rem 0;
  border-bottom: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);
  padding-left: .875rem;
  margin-left: .25rem;
}

.event-item:last-child {
  border-bottom: none;
}

.event-changed { border-left-color: var(--color-primary); }
.event-keyword { border-left-color: #7c3aed; }
.event-error { border-left-color: var(--color-error); }
.event-recovered { border-left-color: var(--color-success); }

.event-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: .375rem;
}

.event-label {
  font-size: .875rem;
  font-weight: 600;
}

.event-time {
  font-size: .8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.event-summary {
  font-size: .8rem;
  font-family: monospace;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: .5rem .75rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 150px;
  overflow-y: auto;
}

.detail-right {
  min-width: 0;
}

/* ============================================================
   レスポンシブ
   ============================================================ */
@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-nav { gap: .5rem; }
  .nav-link { display: none; }

  .lp-hero { padding: 3rem 0 2.5rem; }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 1.75rem 1.25rem;
  }

  /* スマホでは URL の列も隠して、名前・状態・間隔を見せる(URL は詳細の画面にある) */
  .watch-table th:nth-child(2),
  .watch-table td:nth-child(2),
  .watch-table th:nth-child(4),
  .watch-table td:nth-child(4),
  .watch-table th:nth-child(5),
  .watch-table td:nth-child(5) {
    display: none;
  }

  .upgrade-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}
