/**
 * wakame-kusowaro.com 共通CSSコンポーネントライブラリ
 * 各アプリケーション間で重複していたスタイルを統一
 */

/* =============================================================================
   カラーシステム (既存のcommon-header.cssと統合)
   ============================================================================= */
:root {
    /* Modern Color System */
    --background: #fafafa;      /* メイン背景 */
    --surface: #ffffff;         /* カード背景 */
    --accent: #12B5A0;          /* アクセントカラー（わかめ teal） */
    --accent-deep: #0E8576;     /* アクセント濃（hover等） */
    
    /* Text Colors */
    --text-primary: #1a1a1a;    /* メインテキスト */
    --text-secondary: #666666;  /* サブテキスト */
    --text-tertiary: #999999;   /* 補助テキスト */
    
    /* Border & Dividers */
    --border: #e5e5e5;          /* 境界線 */
    --border-hover: #d0d0d0;    /* ホバー時境界線 */
    
    /* State Colors */
    --hover: #f5f5f5;           /* ホバー背景 */
    --active: #d7f5ef;          /* アクティブ状態（teal tint） */
    --success: #22c55e;         /* 成功状態 */
    --error: #ef4444;           /* エラー状態 */
    --warning: #f59e0b;         /* 警告状態 */
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
    --gradient-success: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --gradient-dark: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    
    /* Typography Scale */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    
    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-24: 6rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* =============================================================================
   レイアウトコンポーネント
   ============================================================================= */

/* アプリケーション共通レイアウト */
.app-layout {
    min-height: 100vh;
    background: var(--background);
    font-family: var(--font-sans);
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.app-main {
    padding: var(--space-8) 0;
    min-height: calc(100vh - 60px); /* ヘッダー分を除く */
}

/* センター配置コンテナ */
.center-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

/* =============================================================================
   カードコンポーネント
   ============================================================================= */

/* 基本カードスタイル */
.app-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: all var(--transition-base);
    overflow: hidden;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.app-card-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border);
}

.app-card-body {
    padding: var(--space-6);
}

.app-card-footer {
    padding: var(--space-4) var(--space-6);
    background: var(--hover);
    border-top: 1px solid var(--border);
}

/* ゲーム専用カード */
.game-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: all var(--transition-base);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.game-card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--hover);
}

.game-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

.game-card:hover .game-card-image img {
    transform: scale(1.05);
}

.game-card-content {
    padding: var(--space-4);
    flex: 1;
}

.game-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.game-card-description {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-4);
}

.game-card-footer {
    padding: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

/* =============================================================================
   ボタンコンポーネント
   ============================================================================= */

/* ベースボタンスタイル */
.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

/* プライマリボタン */
.app-btn-primary {
    background: var(--accent);
    color: white;
}

.app-btn-primary:hover {
    background: var(--accent-deep); /* var(--accent)の濃い版 */
    transform: translateY(-1px);
}

/* セカンダリボタン */
.app-btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.app-btn-secondary:hover {
    background: var(--hover);
    border-color: var(--border-hover);
}

/* 成功ボタン */
.app-btn-success {
    background: var(--success);
    color: white;
}

.app-btn-success:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

/* エラー/危険ボタン */
.app-btn-danger {
    background: var(--error);
    color: white;
}

.app-btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* グラデーションボタン */
.app-btn-gradient {
    background: var(--gradient-primary);
    color: white;
    position: relative;
}

.app-btn-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
    border-radius: inherit;
}

.app-btn-gradient:hover::before {
    opacity: 0.1;
}

/* ボタンサイズバリエーション */
.app-btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: 0.75rem;
}

.app-btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: 1rem;
}

.app-btn-xl {
    padding: var(--space-6) var(--space-12);
    font-size: 1.125rem;
}

/* 全幅ボタン */
.app-btn-full {
    width: 100%;
}

/* 無効状態 */
.app-btn:disabled,
.app-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* =============================================================================
   フォームコンポーネント
   ============================================================================= */

.app-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: var(--surface);
    color: var(--text-primary);
    transition: all var(--transition-base);
}

.app-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(18, 181, 160, 0.15);
}

.app-input::placeholder {
    color: var(--text-tertiary);
}

.app-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    background-size: 1em;
    padding-right: var(--space-8);
}

/* =============================================================================
   ユーティリティクラス
   ============================================================================= */

/* テキストユーティリティ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* スペーシングユーティリティ */
.m-0 { margin: 0; }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* マージントップ/ボトム */
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-8 { margin-bottom: var(--space-8); }

/* フレックスユーティリティ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* グリッドユーティリティ */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 境界ユーティリティ */
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* シャドウユーティリティ */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* =============================================================================
   レスポンシブ対応
   ============================================================================= */

@media (max-width: 768px) {
    .app-container {
        padding: 0 var(--space-3);
    }
    
    .app-card-header,
    .app-card-body {
        padding: var(--space-4);
    }
    
    .app-btn {
        min-height: 48px; /* タッチターゲット最小サイズ */
    }
    
    .game-card-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* グリッドレスポンシブ */
    .grid-cols-3 { grid-template-columns: 1fr; }
    .grid-cols-2 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .app-main {
        padding: var(--space-4) 0;
    }
    
    .app-container {
        padding: 0 var(--space-2);
    }
    
    .app-card-header,
    .app-card-body {
        padding: var(--space-3);
    }
}

/* =============================================================================
   アクセシビリティ
   ============================================================================= */

/* 動きを減らす設定 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ハイコントラストモード */
@media (prefers-contrast: high) {
    .app-card {
        border-color: var(--text-primary);
    }
    
    .app-btn {
        border: 2px solid currentColor;
    }
}

/* フォーカス表示の強化 */
.app-btn:focus-visible,
.app-input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(18, 181, 160, 0.25);
}

/* スクリーンリーダー専用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}