/*
 * components.css
 *
 * 複数ページで再利用するコンポーネントの CSS。
 * Tailwind ユーティリティで表現できないトランジションや
 * 疑似要素などのカスタムスタイルのみ記述する。
 *
 * 依存: tokens.css（CSS カスタムプロパティを使用）
 *
 * クラス名は cn- プレフィックスで Tailwind や第三者ライブラリとの衝突を防ぐ。
 */

/* -----------------------------------------------------------------------
   商品カード
----------------------------------------------------------------------- */

/* 商品一覧グリッドカードのホバートランジション */
.cn-product-card {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.cn-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -6px rgba(10, 63, 122, 0.15);
}

/* -----------------------------------------------------------------------
   フラッシュメッセージ（PHP flash() 関数から render_flash() で出力）
----------------------------------------------------------------------- */
.flash-box {
  padding: 0.875rem 1.25rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.flash-box.success {
  background-color: #E6F4EA;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.flash-box.error {
  background-color: #FEF2F2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.flash-box.info {
  background-color: #EEF4FA;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

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

/* -----------------------------------------------------------------------
   フォームエラーメッセージ（バリデーション失敗時）
----------------------------------------------------------------------- */
.cn-field-error {
  color: #dc2626;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: none; /* JS が .cn-has-error の親に付いたとき表示 */
}
.cn-has-error .cn-field-error {
  display: block;
}
.cn-has-error input,
.cn-has-error select,
.cn-has-error textarea {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

/* -----------------------------------------------------------------------
   ページ送り（ページネーション）
----------------------------------------------------------------------- */
.cn-pagination a,
.cn-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: background-color 0.15s;
}
.cn-pagination a {
  color: var(--cn-blue);
}
.cn-pagination a:hover {
  background-color: var(--cn-lightnavy);
}
.cn-pagination span.active {
  background-color: var(--cn-blue);
  color: #fff;
  font-weight: 700;
}
.cn-pagination span.disabled {
  color: var(--cn-textmuted);
  cursor: default;
}

/* -----------------------------------------------------------------------
   ステップインジケーター（カート・チェックアウト・問い合わせ）
----------------------------------------------------------------------- */
.cn-step {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--cn-textmuted);
  font-weight: 500;
}
.cn-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: #E2E8F0;
  color: var(--cn-textmuted);
  font-weight: 700;
  margin-right: 0.375rem;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.cn-step.active .cn-step-num {
  background: var(--cn-blue);
  color: #fff;
}
.cn-step.active {
  color: var(--cn-blue);
}
.cn-step.done .cn-step-num {
  background: var(--cn-green);
  color: #fff;
}
.cn-step-sep {
  flex: 1;
  height: 2px;
  background: #E2E8F0;
  margin: 0 0.5rem;
}
.cn-step-sep.done {
  background: var(--cn-green);
}

/* -----------------------------------------------------------------------
   スクロールで消えるヘッダーの影
   （JS が .scrolled クラスを付与）
----------------------------------------------------------------------- */
#site-header.scrolled {
  box-shadow: 0 2px 12px rgba(10, 63, 122, 0.12);
}
