/* ===========================================================
   IKIZAMA Portal — 共通 UI コンポーネント（デザインシステム）
   既存ページに <link rel="stylesheet" href="/assets/ikizama-ui.css">
   =========================================================== */

/* ── デザイントークン ── */
:root {
  --ikz-primary:        #8B1A1A;
  --ikz-primary-dark:   #5a0f0f;
  --ikz-primary-hover:  #6d1414;
  --ikz-primary-soft:   #fef5f5;
  --ikz-gold:           #FFD700;
  --ikz-bg:             #f5f3f0;
  --ikz-bg-soft:        #fdf8f5;
  --ikz-border:         #d4c9c0;
  --ikz-border-soft:    #e2d9d0;
  --ikz-text:           #1a1a1a;
  --ikz-text-muted:     #6b5d55;
  --ikz-text-soft:      #8a7e76;
  --ikz-radius-sm:      4px;
  --ikz-radius:         6px;
  --ikz-radius-lg:      10px;
  --ikz-radius-pill:    16px;
  --ikz-shadow-sm:      0 1px 3px rgba(0,0,0,0.06);
  --ikz-shadow:         0 2px 8px rgba(0,0,0,0.08);
  --ikz-shadow-lg:      0 10px 40px rgba(0,0,0,0.3);
}

/* ── ピル型トグル（multi-select chip）── */
.ikz-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 12px;
  border: 1px solid var(--ikz-border);
  border-radius: var(--ikz-radius);
  background: var(--ikz-bg-soft);
}
.ikz-pills label {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border: 1.5px solid var(--ikz-border);
  border-radius: var(--ikz-radius-pill);
  background: white;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ikz-primary-dark);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all 0.12s;
}
.ikz-pills label:hover { border-color: var(--ikz-primary); background: var(--ikz-primary-soft); }
.ikz-pills label:has(input:checked) {
  background: var(--ikz-primary); color: white; border-color: var(--ikz-primary);
  box-shadow: 0 1px 4px rgba(139,26,26,0.3);
}
.ikz-pills label:has(input:checked)::before {
  content: '✓'; margin-right: 2px; font-weight: 700;
}
.ikz-pills input[type=checkbox],
.ikz-pills input[type=radio] {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}

/* ── ボタン ── */
.ikz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--ikz-radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  text-decoration: none;
  line-height: 1.2;
}
.ikz-btn-primary {
  background: var(--ikz-primary); color: white;
}
.ikz-btn-primary:hover { background: var(--ikz-primary-hover); }
.ikz-btn-secondary {
  background: white; border: 1px solid var(--ikz-border); color: var(--ikz-text-muted);
}
.ikz-btn-secondary:hover { border-color: var(--ikz-primary); color: var(--ikz-primary); }
.ikz-btn-danger {
  background: white; border: 1px solid var(--ikz-primary); color: var(--ikz-primary);
}
.ikz-btn-danger:hover { background: var(--ikz-primary); color: white; }
.ikz-btn-sm { padding: 4px 10px; font-size: 0.78rem; }
.ikz-btn-lg { padding: 12px 22px; font-size: 0.95rem; min-height: 44px; }

/* ── バッジ（小型ステータス表示）── */
.ikz-badge {
  display: inline-block; padding: 2px 9px;
  border-radius: var(--ikz-radius-pill);
  font-size: 0.72rem; font-weight: 600;
  white-space: nowrap;
}
.ikz-badge-success  { background: #d1fae5; color: #065f46; }
.ikz-badge-warning  { background: #fef3c7; color: #92400e; }
.ikz-badge-danger   { background: #fecaca; color: #991b1b; }
.ikz-badge-info     { background: #e0f2fe; color: #0c4a6e; }
.ikz-badge-neutral  { background: #f3f4f6; color: #6b7280; }
.ikz-badge-primary  { background: var(--ikz-primary); color: white; }

/* ── インラインタグ（細い表示用）── */
.ikz-tag {
  display: inline-block; padding: 1px 6px;
  background: #e0f2fe; color: #0c4a6e;
  border-radius: 3px; font-size: 0.7rem;
  margin: 1px 2px;
}

/* ── 入力フィールド ── */
.ikz-input, .ikz-select, .ikz-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--ikz-border);
  border-radius: var(--ikz-radius-sm);
  font-size: 0.88rem;
  background: white;
  color: var(--ikz-text);
  transition: border-color 0.12s;
  font-family: inherit;
}
.ikz-input:focus, .ikz-select:focus, .ikz-textarea:focus {
  outline: none;
  border-color: var(--ikz-primary);
  box-shadow: 0 0 0 3px rgba(139,26,26,0.12);
}

/* ── カード ── */
.ikz-card {
  background: white;
  border: 1px solid var(--ikz-border-soft);
  border-radius: var(--ikz-radius);
  padding: 14px 16px;
  box-shadow: var(--ikz-shadow-sm);
}

/* ── モーダル（dialog 要素）── */
.ikz-dialog {
  padding: 0; border: none; border-radius: var(--ikz-radius-lg);
  max-width: 1400px; width: 95vw;
  box-shadow: var(--ikz-shadow-lg);
  margin: auto;
}
.ikz-dialog::backdrop { background: rgba(0,0,0,0.5); }
.ikz-dialog-header {
  background: linear-gradient(135deg, var(--ikz-primary) 0%, var(--ikz-primary-dark) 100%);
  color: white; padding: 14px 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.ikz-dialog-title { font-family: 'Noto Serif JP', serif; font-size: 1.1rem; }
.ikz-dialog-close {
  background: none; border: none; color: white;
  font-size: 1.4rem; cursor: pointer; padding: 0 4px;
}
.ikz-dialog-body { padding: 18px 20px; max-height: 70vh; overflow-y: auto; }
.ikz-dialog-footer {
  padding: 12px 20px; background: var(--ikz-bg);
  display: flex; gap: 8px; justify-content: flex-end;
  border-top: 1px solid var(--ikz-border-soft);
}

/* ── スマホ最適化（〜768px）── */
@media (max-width: 768px) {
  .ikz-dialog {
    width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh;
    border-radius: 0; margin: 0;
  }
  .ikz-dialog-body { max-height: calc(100vh - 110px); padding: 14px; }
  .ikz-pills { padding: 10px; gap: 5px; }
  .ikz-pills label { padding: 8px 14px; font-size: 0.88rem; }
  .ikz-btn { min-height: 40px; }
  .ikz-btn-lg { min-height: 48px; }
}
