/* ============================================================
   株式会社オーブ サイト構築概算見積システム
   グローバルCSS（Tailwind CDN補完）
   ============================================================ */

:root {
  --orb-primary: #1a56db;
  --orb-primary-dark: #1e40af;
  --orb-accent: #0ea5e9;
  --orb-success: #10b981;
  --orb-warning: #f59e0b;
  --orb-danger: #ef4444;
  --orb-gray-50: #f9fafb;
  --orb-gray-100: #f3f4f6;
  --orb-gray-200: #e5e7eb;
  --orb-gray-600: #4b5563;
  --orb-gray-700: #374151;
  --orb-gray-900: #111827;
}

* { box-sizing: border-box; }

body {
  font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: #f0f4f8;
  color: var(--orb-gray-900);
  min-height: 100vh;
  margin: 0;
}

/* ── ヘッダー ── */
.header {
  background: linear-gradient(135deg, #1a56db 0%, #1e3a8a 100%);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  box-shadow: 0 2px 8px rgba(26,86,219,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
}
.header-logo-badge {
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ── ステップインジケーター ── */
.steps-wrapper {
  background: #fff;
  border-bottom: 1px solid var(--orb-gray-200);
  padding: 16px 24px;
}
.steps {
  display: flex;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
  gap: 0;
}
.step-item {
  display: flex;
  align-items: center;
  flex: 1;
}
.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.2s;
}
.step-circle.done { background: var(--orb-success); color: #fff; }
.step-circle.active { background: var(--orb-primary); color: #fff; box-shadow: 0 0 0 4px rgba(26,86,219,0.2); }
.step-circle.pending { background: var(--orb-gray-200); color: var(--orb-gray-600); }
.step-label {
  font-size: 0.72rem;
  margin-left: 6px;
  font-weight: 500;
  white-space: nowrap;
}
.step-label.active { color: var(--orb-primary); font-weight: 700; }
.step-label.done { color: var(--orb-success); }
.step-label.pending { color: var(--orb-gray-600); }
.step-line {
  flex: 1;
  height: 2px;
  margin: 0 8px;
}
.step-line.done { background: var(--orb-success); }
.step-line.pending { background: var(--orb-gray-200); }

/* ── メインコンテナ ── */
.main-container {
  max-width: 860px;
  margin: 32px auto;
  padding: 0 16px 80px;
}
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.04);
  overflow: hidden;
}
.card-header {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f0fe 100%);
  border-bottom: 1px solid #dbeafe;
  padding: 24px 32px;
}
.card-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--orb-gray-900);
  margin: 0 0 4px;
}
.card-subtitle {
  font-size: 0.875rem;
  color: var(--orb-gray-600);
  margin: 0;
}
.card-body {
  padding: 32px;
}

/* ── フォーム ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-grid-full {
  grid-column: 1 / -1;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--orb-gray-700);
}
.form-label .required {
  color: var(--orb-danger);
  margin-left: 4px;
}
.form-input, .form-select, .form-textarea {
  border: 1.5px solid var(--orb-gray-200);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--orb-gray-900);
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
  outline: none;
  width: 100%;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--orb-primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}
.form-input::placeholder { color: #9ca3af; }
.form-textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.78rem; color: var(--orb-gray-600); }
.form-error { font-size: 0.78rem; color: var(--orb-danger); }

/* ── ボタン ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary {
  background: var(--orb-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--orb-primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,86,219,0.3); }
.btn-secondary {
  background: var(--orb-gray-100);
  color: var(--orb-gray-700);
  border: 1.5px solid var(--orb-gray-200);
}
.btn-secondary:hover { background: var(--orb-gray-200); }
.btn-success {
  background: var(--orb-success);
  color: #fff;
}
.btn-success:hover { background: #059669; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.btn-danger { background: var(--orb-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-lg { padding: 14px 36px; font-size: 1rem; }
.btn-sm { padding: 8px 16px; font-size: 0.8rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-full { width: 100%; }

/* ── カテゴリカード ── */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}
.category-card {
  border: 2px solid var(--orb-gray-200);
  border-radius: 12px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
  text-align: center;
}
.category-card:hover {
  border-color: var(--orb-primary);
  background: #f0f7ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26,86,219,0.12);
}
.category-card.selected {
  border-color: var(--orb-primary);
  background: #eff6ff;
  box-shadow: 0 0 0 4px rgba(26,86,219,0.1);
}
.category-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}
.category-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--orb-gray-900);
  margin: 0 0 6px;
}
.category-desc {
  font-size: 0.78rem;
  color: var(--orb-gray-600);
  margin: 0;
  line-height: 1.5;
}

/* ── オプションチェックボックス ── */
.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.option-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border: 1.5px solid var(--orb-gray-200);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
}
.option-item:hover { border-color: var(--orb-accent); background: #f0f9ff; }
.option-item.checked { border-color: var(--orb-primary); background: #eff6ff; }
.option-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--orb-gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.15s;
}
.option-checkbox.checked { background: var(--orb-primary); border-color: var(--orb-primary); }
.option-info {}
.option-label { font-size: 0.875rem; font-weight: 600; color: var(--orb-gray-900); margin: 0 0 2px; }
.option-price { font-size: 0.78rem; color: var(--orb-primary); font-weight: 700; margin: 0; }
.option-note { font-size: 0.72rem; color: var(--orb-gray-600); margin: 2px 0 0; }

/* ── セクション区切り ── */
.section-divider {
  border: none;
  border-top: 1px solid var(--orb-gray-200);
  margin: 28px 0;
}
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--orb-gray-700);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 18px;
  background: var(--orb-primary);
  border-radius: 2px;
}

/* ── 見積結果 ── */
.result-summary {
  background: linear-gradient(135deg, #1a56db 0%, #1e3a8a 100%);
  border-radius: 16px;
  padding: 32px;
  color: #fff;
  text-align: center;
  margin-bottom: 24px;
}
.result-total-label { font-size: 0.9rem; opacity: 0.85; margin: 0 0 8px; }
.result-total-price {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin: 0 0 8px;
}
.result-delivery {
  font-size: 0.9rem;
  opacity: 0.85;
  background: rgba(255,255,255,0.15);
  display: inline-block;
  padding: 4px 16px;
  border-radius: 20px;
  margin-top: 8px;
}
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
}
.breakdown-table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--orb-gray-600);
  padding: 8px 12px;
  border-bottom: 2px solid var(--orb-gray-200);
}
.breakdown-table td {
  padding: 10px 12px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--orb-gray-100);
}
.breakdown-table tr:last-child td { border-bottom: none; }
.breakdown-table .price-cell { text-align: right; font-weight: 600; color: var(--orb-primary); }
.breakdown-total { font-weight: 700; background: var(--orb-gray-50); }
.breakdown-total td { border-top: 2px solid var(--orb-gray-200) !important; }

/* ── 価格レンジバッジ ── */
.price-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}
.price-badge.low { background: #d1fae5; color: #065f46; }
.price-badge.mid { background: #dbeafe; color: #1e40af; }
.price-badge.high { background: #fce7f3; color: #9d174d; }

/* ── アクションバー ── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--orb-gray-200);
}

/* ── 完了画面 ── */
.complete-icon {
  width: 80px;
  height: 80px;
  background: #d1fae5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 24px;
}

/* ── 管理画面テーブル ── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--orb-gray-600);
  padding: 12px 16px;
  background: var(--orb-gray-50);
  border-bottom: 2px solid var(--orb-gray-200);
  white-space: nowrap;
}
.admin-table td {
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--orb-gray-100);
  vertical-align: middle;
}
.admin-table tr:hover td { background: #f8faff; }
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  gap: 4px;
}
.status-draft { background: #f3f4f6; color: #6b7280; }
.status-sent { background: #dbeafe; color: #1d4ed8; }
.status-accepted { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }

/* ── 数値入力スライダー ── */
.range-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.range-input {
  flex: 1;
  accent-color: var(--orb-primary);
}
.range-value {
  min-width: 60px;
  text-align: center;
  font-weight: 700;
  color: var(--orb-primary);
  font-size: 1rem;
}

/* ── アラートボックス ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ── ローディング ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ラジオグループ ── */
.radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-card {
  flex: 1;
  min-width: 100px;
  border: 2px solid var(--orb-gray-200);
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  background: #fff;
}
.radio-card:hover { border-color: var(--orb-primary); }
.radio-card.selected { border-color: var(--orb-primary); background: #eff6ff; }
.radio-card-label { font-size: 0.875rem; font-weight: 600; color: var(--orb-gray-900); }
.radio-card-price { font-size: 0.75rem; color: var(--orb-primary); font-weight: 700; margin-top: 2px; }

/* ── レスポンシブ ── */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .option-grid { grid-template-columns: 1fr; }
  .card-body { padding: 20px 16px; }
  .card-header { padding: 16px 20px; }
  .result-total-price { font-size: 2.2rem; }
  .action-bar { flex-direction: column; }
  .action-bar .btn { width: 100%; }
}

/* ── フェードインアニメーション ── */
.fade-in {
  animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── ツールチップ ── */
.tooltip-wrap { position: relative; display: inline-block; }
.tooltip-wrap:hover .tooltip { display: block; }
.tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--orb-gray-900);
  color: #fff;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  margin-bottom: 6px;
  z-index: 10;
}

/* ── ページャー ── */
.pager { display: flex; gap: 4px; align-items: center; justify-content: center; }
.pager-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--orb-gray-200);
  background: #fff; color: var(--orb-gray-700); transition: all 0.15s;
}
.pager-btn:hover { border-color: var(--orb-primary); color: var(--orb-primary); }
.pager-btn.active { background: var(--orb-primary); color: #fff; border-color: var(--orb-primary); }

/* ============================================================
   管理画面専用レイアウト
   ============================================================ */

/* 管理画面 body */
.admin-body {
  background: #f0f4f8;
}

/* 管理画面ヘッダー */
.admin-header {
  background: linear-gradient(135deg, #1a56db 0%, #1e3a8a 100%);
  color: #fff;
  height: 56px;
  box-shadow: 0 2px 8px rgba(26,86,219,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.admin-header-inner {
  max-width: 100%;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.admin-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.admin-nav-link {
  color: rgba(255,255,255,0.85);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.admin-nav-link:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.admin-nav-logout {
  color: rgba(255,200,200,0.9);
  margin-left: 8px;
  border: 1px solid rgba(255,255,255,0.2);
}
.admin-nav-logout:hover {
  background: rgba(239,68,68,0.25);
  color: #fff;
}

/* 管理画面メインエリア */
.admin-main {
  padding: 24px 24px 64px;
}

/* 管理画面コンテナ：横幅いっぱい・最大幅なし */
.admin-container {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

/* 管理画面カードのタイトルサイズ調整 */
.admin-container .card-title {
  font-size: 1.2rem;
}

/* 管理テーブル：管理画面内では列を広げる */
.admin-container .admin-table th,
.admin-container .admin-table td {
  padding: 11px 14px;
}

/* 管理画面のフィルターバー */
.admin-filter-bar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--orb-gray-200);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--orb-gray-50);
}

/* 管理画面内の card は角丸を少し小さく */
.admin-container .card {
  border-radius: 12px;
}

/* ログイン画面のみ中央寄せ */
.admin-login-wrap {
  max-width: 420px;
  margin: 60px auto 0;
}
