/* 編集画面スタイル。モバイルファースト（仕様 9.2 要件4）。 */
* { box-sizing: border-box; }

:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --text: #1f2937;
  --sub: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --danger: #b91c1c;
  --ok: #15803d;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
}

/* ---- ヘッダー ---- */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .65rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.admin-header-left { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.admin-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-header-right { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.back-arrow {
  text-decoration: none;
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  padding: .25rem .4rem;
}
.save-status { font-size: .8rem; color: var(--sub); }
.save-status.is-saving { color: var(--sub); }
.save-status.is-saved { color: var(--ok); }
.save-status.is-error { color: var(--danger); }

.admin-main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}

/* ---- カード ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.15rem 1.15rem 1.25rem;
  margin-bottom: 1rem;
}
.card-title { font-size: 1.02rem; margin: 1.1rem 0 .8rem; }
.card-title:first-child { margin-top: 0; }
.login-card { max-width: 22rem; margin: 3rem auto; }

/* ---- ボタン ---- */
.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: .55rem 1.2rem;
  font: inherit;
  font-size: .95rem;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}
.button:hover { opacity: .9; }
.button:disabled { opacity: .5; cursor: default; }
.button-secondary {
  background: var(--surface);
  color: var(--accent);
}
.button-small { padding: .3rem .8rem; font-size: .85rem; border-radius: 6px; }
.button-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}
.link-button {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  padding: 0;
}
.action-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .75rem; }

/* ---- フォーム ---- */
.form-row { margin: 0 0 1rem; }
.form-row label, .form-label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: .3rem;
}
.form-row input[type="text"], .form-row input[type="url"], .form-row input[type="tel"],
.form-row input[type="email"], .form-row input[type="password"], .form-row input[type="date"],
.form-row input[type="number"], .form-row textarea, .form-row select,
.list-row input, .list-row select, .salary-row input, .salary-row select {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: .6rem .7rem;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus,
.list-row input:focus, .list-row select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.form-row-half input, .form-row-half select { max-width: 14rem; }
.radio { display: block; font-weight: 400; margin: .25rem 0; }
.radio input { margin-right: .4rem; }
.help-text { font-size: .82rem; color: var(--sub); }
.help-text.center { text-align: center; }
.error-text { color: var(--danger); font-size: .88rem; min-height: 1.3em; }
.error-list { color: var(--danger); font-size: .88rem; }
.error-list p { margin: .2rem 0; }

/* ---- リスト編集 ---- */
.list-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.list-row input { flex: 1; }
.list-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin: 0 0 1rem;
}
.list-card.is-closed { background: #f9fafb; }
.list-add { margin-top: .25rem; }
.time-row .time-input { max-width: 6.5rem; text-align: center; }
.social-row select { max-width: 11rem; }
.salary-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.salary-row .form-label { width: 100%; margin-bottom: 0; }
.salary-row select { width: auto; }
.salary-row input { width: 7rem; }

.hours-day {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .75rem 1rem;
  margin: 0 0 .75rem;
}
.hours-day legend { font-weight: 700; padding: 0 .4rem; }
.hours-day.is-closed .times-list { opacity: .45; }

/* ---- ダッシュボード ---- */
.site-meta { display: flex; align-items: center; gap: .6rem; margin: 0 0 .25rem; font-weight: 600; }
.site-meta-sub { margin: 0; font-size: .82rem; color: var(--sub); }
.badge {
  font-size: .72rem;
  border-radius: 999px;
  padding: .1rem .6rem;
  background: var(--line);
  color: var(--sub);
  white-space: nowrap;
}
.badge-active { background: #dcfce7; color: var(--ok); }
.badge-draft { background: #fef3c7; color: #92400e; }
.publish-result { font-size: .88rem; min-height: 1.3em; margin: .5rem 0 0; }
.publish-result.is-ok { color: var(--ok); }
.publish-result.is-error { color: var(--danger); }

.preview-url-row { margin: .5rem 0 0; }
.preview-url {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .3rem .6rem;
  font-size: .85rem;
  word-break: break-all;
}
.preview-slug-input {
  font: inherit;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: .5rem .7rem;
  max-width: 12rem;
}

.block-list { list-style: none; margin: 0; padding: 0; }
.block-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 0;
  border-bottom: 1px solid var(--line);
}
.block-row:last-child { border-bottom: none; }
.block-label { font-size: .95rem; }
.block-actions { display: flex; align-items: center; gap: .8rem; }

/* トグルスイッチ */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  transition: background .15s;
  cursor: pointer;
}
.switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
}
.switch input:checked + .switch-slider { background: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* ---- サイト一覧 ---- */
.site-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: inherit;
}
.site-card-name { font-weight: 700; }
.site-card-domain { color: var(--sub); font-size: .85rem; flex: 1; }

/* ---- 履歴 ---- */
.version-list { list-style: none; margin: 0; padding: 0; }
.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--line);
}
.version-row:last-child { border-bottom: none; }
.version-date { color: var(--sub); font-size: .85rem; margin-left: .5rem; }

/* ---- 画像ピッカー ---- */
.image-picker { display: flex; align-items: center; gap: .75rem; }
.image-picker-thumb {
  width: 72px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  flex-shrink: 0;
}
.image-picker-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-picker-buttons { display: flex; gap: .4rem; flex-wrap: wrap; }

.image-dialog {
  border: none;
  border-radius: 12px;
  padding: 1rem;
  width: min(92vw, 34rem);
  max-height: 80vh;
}
.image-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.image-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: .75rem;
}
.image-dialog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: .5rem;
  overflow-y: auto;
}
.image-dialog-grid button {
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: none;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.image-dialog-grid button:hover { border-color: var(--accent); }
.image-dialog-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-label { position: relative; overflow: hidden; }

@media (min-width: 640px) {
  .admin-main { padding-top: 1.5rem; }
}
