/* ExamPass - カスタムスタイル */
/* 注意: このCSSは管理画面には適用されません */

:root {
  /* カラーパレット */
  --primary-gradient-start: #667eea;
  --primary-gradient-end: #764ba2;
  --primary-color: #667eea;
  --primary-dark: #764ba2;
  --secondary-color: #6c757d;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #3b82f6;
  
  /* テキストカラー */
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-light: #a0aec0;
  
  /* 背景カラー */
  --bg-primary: #ffffff;
  --bg-secondary: #f7fafc;
  --bg-light: #edf2f7;
  
  /* ボーダー */
  --border-color: #e2e8f0;
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;
  
  /* シャドウ */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.2);
  
  /* トランジション */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* フォント */
body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* グラデーション背景 */
.gradient-bg {
  background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
}

/* カード */
.card-modern {
  background: var(--bg-primary);
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}

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

/* ボタン */
.btn-gradient {
  background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  font-weight: 600;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
  background: linear-gradient(135deg, var(--primary-gradient-end) 0%, var(--primary-gradient-start) 100%);
  color: white;
}

.btn-gradient:active {
  transform: translateY(0);
}

/* ナビゲーションバー */
.navbar-modern {
  background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
  box-shadow: var(--shadow-md);
  padding: 1rem 0;
}

.navbar-modern .navbar-brand {
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  transition: all var(--transition-fast);
}

.navbar-modern .navbar-brand:hover {
  color: white;
  transform: scale(1.05);
}

/* バッジ */
.badge-modern {
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
}

/* アラート */
.alert-modern {
  border: none;
  border-radius: var(--border-radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* フォーム */
.form-control-modern {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  transition: all var(--transition-fast);
}

.form-control-modern:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* アニメーション */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* ホバー効果 */
.hover-lift {
  transition: all var(--transition-normal);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* グラデーションテキスト */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* ローディングスピナー */
.spinner-gradient {
  border: 3px solid rgba(102, 126, 234, 0.1);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

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

/* ============================================
   モバイル対応強化（Bootstrap活用）
   ============================================ */

/* 片手操作を意識した設計 - 固定を削除してスクロール可能に */
.mobile-bottom-action {
  position: relative; /* fixedから変更 */
  margin-top: 1rem;
  margin-bottom: 1rem;
  background: white;
  padding: 1rem;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  display: none;
}

/* 表とグラフの横スクロール対応（必須） */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.chart-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

/* レスポンシブ調整 */
@media (max-width: 991px) {
  /* タブレット対応 */
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .card-modern {
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
  }
  
  .btn-gradient {
    padding: 10px 20px;
    font-size: 0.95rem;
  }
  
  /* ダッシュボードカード */
  .row > [class*='col-'] {
    margin-bottom: 1rem;
  }
  
  /* ボタングループ - 縦並び */
  .d-flex.gap-2 {
    flex-direction: column;
    gap: 0.5rem !important;
  }
  
  .d-flex.gap-2 .btn {
    width: 100%;
  }
  
  /* テーブル - 横スクロール必須 */
  .table-responsive {
    font-size: 0.9rem;
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* ナビゲーション */
  .navbar-modern .container {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  /* 片手操作用のボトムアクション表示 */
  .mobile-bottom-action {
    display: block;
  }
  
  /* メインコンテンツの余白は不要（固定を削除したため） */
}

@media (max-width: 768px) {
  /* スマートフォン対応 - 片手操作重視 */
  body {
    font-size: 14px;
    /* padding-bottomは不要（固定を削除したため） */
  }
  
  h1 {
    font-size: 1.75rem;
    line-height: 1.3;
  }
  
  h2 {
    font-size: 1.5rem;
    line-height: 1.3;
  }
  
  h3 {
    font-size: 1.25rem;
    line-height: 1.3;
  }
  
  /* カード - タップしやすく */
  .card-modern {
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  /* ボタン - 片手で押しやすいサイズ */
  .btn-gradient {
    padding: 14px 20px;
    font-size: 1rem;
    min-height: 48px; /* タップエリア確保 */
  }
  
  .btn {
    min-height: 44px; /* 最小タップエリア */
  }
  
  /* テーブル - 横スクロール必須 */
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
  }
  
  .table {
    min-width: 600px; /* 最小幅を確保 */
  }
  
  /* グラフ - 横スクロール対応 */
  .chart-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  canvas {
    min-width: 600px; /* 最小幅を確保 */
  }
  
  /* フォーム - 入力しやすく */
  .form-control,
  .form-select {
    min-height: 48px;
    font-size: 16px; /* iOSのズーム防止 */
  }
  
  /* ナビゲーション - 元の設定に戻す（固定なし） */
  /* position: stickyは削除 - 元々設定されていなかった */
  
  /* ボトムナビゲーション */
  .mobile-bottom-action {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 0.5rem;
  }
  
  .mobile-bottom-action .btn {
    flex: 1;
    margin: 0;
  }
  
  /* ストリークカード */
  .streak-card .row {
    text-align: center;
  }
  
  .streak-card .col-md-4 {
    margin-bottom: 1rem;
  }
  
  /* 統計カード */
  .stat-card {
    margin-bottom: 1rem;
  }
  
  .stat-card h3 {
    font-size: 1.5rem;
  }
  
  /* アラート */
  .alert {
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
  }
  
  /* フォーム */
  .form-control-modern {
    padding: 10px 14px;
    font-size: 0.9rem;
  }
  
  /* モーダル */
  .modal-dialog {
    margin: 0.5rem;
  }
  
  .modal-content {
    border-radius: 12px;
  }
  
  /* ページネーション */
  .pagination {
    font-size: 0.85rem;
  }
  
  .pagination .page-link {
    padding: 0.375rem 0.75rem;
  }
  
  /* バッジ */
  .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
  
  /* ヘッダーアクション */
  .d-flex.justify-content-between {
    flex-direction: column;
    gap: 1rem;
  }
  
  .d-flex.justify-content-between > div {
    width: 100%;
  }
  
  /* グラフ */
  canvas {
    max-height: 250px !important;
  }
}

@media (max-width: 576px) {
  /* 小型スマートフォン対応 - 片手操作最優先 */
  body {
    font-size: 14px; /* 読みやすさ重視 */
  }
  
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }
  
  h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }
  
  h2 {
    font-size: 1.25rem;
    margin-bottom: 0.625rem;
  }
  
  h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }
  
  /* カード - コンパクトに */
  .card-modern {
    border-radius: 10px;
    padding: 0.875rem;
    margin-bottom: 0.875rem;
  }
  
  .card-body {
    padding: 0.875rem;
  }
  
  /* ボタン - 片手で押しやすく */
  .btn-gradient {
    padding: 12px 16px;
    font-size: 0.95rem;
    min-height: 48px;
  }
  
  .btn {
    min-height: 48px;
    font-size: 0.95rem;
  }
  
  .btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
    min-height: 40px;
  }
  
  /* テーブル - 横スクロール必須 */
  .table-responsive {
    font-size: 0.85rem;
  }
  
  .table {
    font-size: 0.85rem;
    min-width: 500px; /* 小型でも最小幅確保 */
  }
  
  .table th,
  .table td {
    padding: 0.5rem 0.375rem;
    white-space: nowrap; /* 改行防止 */
  }
  
  /* グラフ - 横スクロール対応 */
  .chart-wrapper {
    overflow-x: auto;
  }
  
  canvas {
    min-width: 500px !important;
    max-height: 200px !important;
  }
  
  /* フォーム - 入力しやすく */
  .form-control,
  .form-select {
    min-height: 48px;
    font-size: 16px; /* iOSズーム防止 */
    padding: 12px 14px;
  }
  
  .form-label {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
  }
  
  /* アイコン - 見やすく */
  .bi {
    font-size: 1.1rem;
  }
  
  /* ストリーク表示 */
  .streak-number {
    font-size: 2.5rem;
  }
  
  .streak-icon {
    font-size: 2.5rem;
  }
  
  /* 統計表示 */
  .stat-value {
    font-size: 1.5rem;
  }
  
  /* フッター */
  .footer-links {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .footer-link {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }
  
  /* ボトムアクション - 片手操作 */
  .mobile-bottom-action {
    padding: 0.75rem;
  }
  
  .mobile-bottom-action .btn {
    font-size: 0.9rem;
    padding: 10px 12px;
  }
  
  /* モーダル */
  .modal-dialog {
    margin: 0.5rem;
  }
  
  .modal-content {
    border-radius: 12px;
  }
  
  /* アラート */
  .alert {
    font-size: 0.9rem;
    padding: 0.875rem;
  }
  
  /* バッジ */
  .badge {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
  }
}

/* タッチデバイス専用最適化 */
@media (hover: none) and (pointer: coarse) {
  /* タップエリアを十分に確保 */
  .btn {
    min-height: 48px;
    min-width: 48px;
    padding: 12px 20px;
  }
  
  .btn-sm {
    min-height: 44px;
    min-width: 44px;
  }
  
  .form-control,
  .form-select {
    min-height: 48px;
    font-size: 16px; /* iOSズーム防止 */
  }
  
  .form-check-input {
    width: 28px;
    height: 28px;
    cursor: pointer;
  }
  
  .form-check-label {
    cursor: pointer;
    padding-left: 0.5rem;
  }
  
  /* リンク - タップしやすく */
  a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  
  /* テーブルの行 - タップしやすく */
  .table tbody tr {
    cursor: pointer;
  }
  
  .table tbody tr:active {
    background-color: rgba(102, 126, 234, 0.1);
  }
  
  /* カード - タップフィードバック */
  .card-modern {
    cursor: pointer;
    transition: background-color 0.1s;
  }
  
  .card-modern:active {
    background-color: rgba(102, 126, 234, 0.05);
  }
  
  /* ホバー効果を無効化（タッチデバイスでは不要） */
  .hover-lift:hover,
  .card-modern:hover,
  .btn:hover {
    transform: none;
  }
  
  /* タップ時のフィードバック */
  .btn:active {
    transform: scale(0.98);
    opacity: 0.9;
  }
  
  /* スクロールバーを見やすく */
  ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
  }
  
  ::-webkit-scrollbar-track {
    background: #f1f1f1;
  }
  
  ::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
  }
  
  ::-webkit-scrollbar-thumb:active {
    background: #555;
  }
}

/* 横向き対応 */
@media (max-width: 768px) and (orientation: landscape) {
  .modal-dialog {
    max-width: 90%;
  }
  
  .navbar-modern {
    padding: 0.5rem 0;
  }
  
  .card-modern {
    margin-bottom: 0.75rem;
  }
}
