/* =======================================
   Components
   - ボタン
   - カード
   - モーダル
   - ドロワー
   - フォーム
   - テーブル
   ----------------------------------------
   サイト内で共通して使われる
   UIコンポーネントのベーススタイル
======================================= */

/* -------------------------
   Button
   ----------------------------------------
   基本ボタンスタイル。
   必要に応じてmodifierでバリエーションを作成します。
------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-regular);
  background: var(--color-primary);
  color: #fff;
  transition: all var(--duration) var(--ease);
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--color-primary-light);
}

/* -------------------------
   Card
   ----------------------------------------
   カード型レイアウト。
   gridやflexと併用して使用します。
------------------------- */
.card {
  border: var(--border-thin) solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration) var(--ease);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* -------------------------
   Modal
   ----------------------------------------
   モーダルウィンドウ用
   is-activeクラスで表示制御
------------------------- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) var(--ease);
}

.modal.is-active {
  opacity: 1;
  pointer-events: auto;
}

.modal__content {
  background: var(--color-bg);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  max-width: 600px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

/* -------------------------
   Drawer
   ----------------------------------------
   スマートフォン向けのドロワーメニュー
   is-activeで開閉制御
------------------------- */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 80%;
  max-width: 320px;
  background: var(--color-bg);
  transform: translateX(100%);
  transition: transform var(--duration) var(--ease);
  z-index: var(--z-fixed);
  padding: var(--space-lg);
}

.drawer.is-active {
  transform: translateX(0);
}

.drawer__close {
  text-align: right;
  margin-bottom: var(--space-md);
  cursor: pointer;
}

.drawer__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* -------------------------
   Form
   ----------------------------------------
   入力フォーム共通
   input, textarea, select共通化
------------------------- */
input,
textarea,
select {
  width: 100%;
  padding: var(--space-xs);
  border: var(--border-thin) solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  transition: border-color var(--duration) var(--ease);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* -------------------------
   Table
   ----------------------------------------
   テーブルの基本スタイル。
   WordPressの出力tableにも対応可能。
------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-md);
}

th,
td {
  padding: var(--space-xs);
  border: var(--border-thin) solid var(--color-border);
  text-align: left;
}

th {
  background: var(--color-bg-sub);
  font-weight: var(--fw-medium);
}
