/* ===============================================
   Utility Classes - 汎用ユーティリティクラス
   =============================================== */

/* Spacing - マージン・パディング */
.m-0 { margin: 0; }
.m-1 { margin: 0.5rem; }
.m-2 { margin: 1rem; }
.m-3 { margin: 1.5rem; }
.m-4 { margin: 2rem; }
.m-5 { margin: 2.5rem; }
.m-6 { margin: 3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 2.5rem; }
.mt-6 { margin-top: 3rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 2.5rem; }
.mb-6 { margin-bottom: 3rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.p-5 { padding: 2.5rem; }
.p-6 { padding: 3rem; }

.py-8 { padding-top: 4rem; padding-bottom: 4rem; }

/* Text Alignment - テキスト配置 */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Display - 表示制御 */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.flex { display: flex; }
.grid { display: grid; }

/* Flex - フレックスボックス */
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

.align-start { align-items: flex-start; }
.align-center { align-items: center; }
.align-end { align-items: flex-end; }
.align-stretch { align-items: stretch; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

/* Gap - 間隔 */
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/* Width - 幅 */
.w-25 { width: 25%; }
.w-50 { width: 50%; }
.w-75 { width: 75%; }
.w-100 { width: 100%; }
.w-auto { width: auto; }

/* Height - 高さ */
.h-100 { height: 100%; }
.h-auto { height: auto; }

/* Colors - 色 */
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-info { color: var(--color-info); }
.text-muted { color: var(--color-text-muted); }

.bg-primary { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-secondary); }
.bg-light { background-color: var(--color-bg-light); }
.bg-white { background-color: #fff; }

/* Font Weight - 文字の太さ */
.fw-normal { font-weight: 400; }
.fw-medium { font-weight: 500; }
.fw-bold { font-weight: 700; }

/* Font Size - 文字サイズ */
.fs-sm { font-size: 0.875rem; }
.fs-base { font-size: 1rem; }
.fs-lg { font-size: 1.125rem; }
.fs-xl { font-size: 1.25rem; }
.fs-2xl { font-size: 1.5rem; }

/* Border - ボーダー */
.border { border: 1px solid var(--color-border); }
.border-top { border-top: 1px solid var(--color-border); }
.border-bottom { border-bottom: 1px solid var(--color-border); }
.border-0 { border: 0; }

/* Border Radius - 角丸 */
.rounded { border-radius: var(--border-radius-base); }
.rounded-sm { border-radius: var(--border-radius-sm); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.rounded-full { border-radius: 9999px; }

/* Shadow - シャドウ */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-base); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Overflow - オーバーフロー */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-scroll { overflow: scroll; }

/* Position - 位置 */
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }
.position-sticky { position: sticky; }

/* Cursor - カーソル */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

/* Visibility - 可視性 */
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* Responsive Utilities - レスポンシブユーティリティ */
@media (max-width: 768px) {
  .d-md-none { display: none; }
  .d-md-block { display: block; }
}

@media (min-width: 769px) {
  .d-md-inline-block { display: inline-block; }
}

/* Loader - ローディングスピナー */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error/Success Messages - エラー・成功メッセージ */
.error-message,
.success-message {
  padding: 1rem;
  margin: 1rem 0;
  border-radius: var(--border-radius-base);
  font-weight: 500;
}

.error-message {
  background-color: #fee;
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

.success-message {
  background-color: #efe;
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

/* Accessibility - アクセシビリティ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Display utilities */
.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}
