/* カスタムCSS - ジュニアテニス大会情報アプリ (LUNASOL ブランドカラー準拠) */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&display=swap');

/* テニステーマカラー変数 */
:root {
  /* テニスボールイエロー */
  --ball-yellow: #FFD700;
  --ball-yellow-hover: #E6C200;
  --ball-yellow-light: #FFFACD;
  
  /* グラスグリーン */
  --grass-green: #228B22;
  --grass-green-hover: #1F7A1F;
  --grass-green-light: #E6F7E6;
  
  /* ハードコートブルー */
  --court-blue: #1E90FF;
  --court-blue-hover: #1A7FE6;
  --court-blue-light: #E6F3FF;
  
  /* 基本カラー */
  --base-white: #FFFFFF;
  --text-dark: #333333;
  --text-sub: #666666;
  --border-gray: #E0E0E0;
  --background-light: #FFFFFF;
  
  /* シャドウ */
  --shadow-light: rgba(0, 0, 0, 0.06);
  --shadow-medium: rgba(0, 0, 0, 0.12);
  --shadow-strong: rgba(0, 0, 0, 0.18);
  
  /* 旧変数との互換性（段階的移行用） */
  --primary-red: var(--grass-green);
  --primary-red-hover: var(--grass-green-hover);
  --primary-red-light: var(--grass-green-light);
  --neutral-gray: var(--text-sub);
  --accent-dark: var(--text-dark);
}

/* 基本設定 */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 17px; /* 大きめのベースフォントサイズ */
  line-height: 1.6;
  color: var(--accent-dark);
  background-color: var(--background-light);
  margin: 0;
  padding: 0;
}

/* 基本的なレスポンシブ設定 */
.container {
  max-width: 400px;
  margin: 0 auto;
}

/* プライマリーボタン（グラスグリーン） */
.btn-primary {
  background-color: var(--grass-green);
  color: var(--base-white);
  border: none;
  border-radius: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px; /* アクセシビリティ: タッチ領域 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 2px 4px var(--shadow-light);
}

.btn-primary:hover {
  background-color: var(--grass-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(34, 139, 34, 0.3);
}

.btn-primary:focus {
  outline: 3px solid var(--ball-yellow);
  outline-offset: 2px;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(34, 139, 34, 0.4);
}

/* セカンダリーボタン（白背景＋青枠＋青文字） */
.btn-secondary {
  background-color: var(--base-white);
  color: var(--court-blue);
  border: 1px solid var(--court-blue);
  border-radius: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 2px 4px var(--shadow-light);
}

.btn-secondary:hover {
  background-color: var(--court-blue-light);
  border-color: var(--court-blue-hover);
  color: var(--court-blue-hover);
}

.btn-secondary:focus {
  outline: 2px solid var(--court-blue);
  outline-offset: 2px;
}

.btn-secondary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px var(--shadow-light);
}

/* フォーカスとアクセシビリティ */
input:focus, select:focus, textarea:focus, button:focus, a:focus {
  outline: 2px solid var(--court-blue);
  outline-offset: 2px;
  border-color: var(--court-blue);
}

/* フォーム要素 */
input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* iOS zoom prevention */
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-gray);
  border-radius: 0.5rem;
  background-color: var(--base-white);
  color: var(--accent-dark);
  transition: border-color 0.2s ease;
  min-height: 48px; /* アクセシビリティ */
}

input:hover, select:hover, textarea:hover {
  border-color: var(--neutral-gray);
}

/* プレースホルダー */
::placeholder {
  color: var(--neutral-gray);
  opacity: 1;
}

/* カード（白背景＋ライトグレー枠＋青見出し） */
.card {
  background-color: var(--base-white);
  border: 1px solid var(--border-gray);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 2px 8px var(--shadow-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow-medium);
}

/* カード見出し（テニステーマ） */
.card h1, .card h2, .card h3, .card h4, .card h5, .card h6 {
  color: var(--court-blue);
  font-weight: 600;
}

.card .card-title {
  color: var(--court-blue);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.card .card-header {
  color: var(--court-blue);
  font-weight: 600;
  border-bottom: 1px solid var(--border-gray);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

/* 大会カード（テニステーマ） */
.tournament-card {
  background-color: var(--base-white);
  border: 1px solid var(--border-gray);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 2px 8px var(--shadow-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative; /* 公認バッジの配置用 */
}

.tournament-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow-medium);
}

/* 大会カード見出し */
.tournament-card h3, .tournament-card .tournament-title {
  color: var(--court-blue);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.tournament-card h4, .tournament-card .tournament-subtitle {
  color: var(--court-blue);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

/* 公認大会バッジ（黄色背景＋黒文字） */
.official-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background-color: var(--ball-yellow);
  color: var(--text-dark);
  border: none;
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  z-index: 10;
  box-shadow: 0 2px 4px var(--shadow-light);
}

/* 主催者表示 */
.organizer-text {
  color: var(--neutral-gray);
  font-size: 14px;
  font-weight: 400;
}

/* プラットフォームバッジ */
.platform-badge {
  background-color: var(--court-blue-light);
  color: var(--court-blue);
  border-radius: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-size: 12px;
  font-weight: 500;
}

/* モバイル最適化のためのタッチ領域 */
.touch-target {
  min-height: 48px;
  min-width: 48px;
}

/* スクロールバーのスタイル */
.scrollable::-webkit-scrollbar {
  width: 4px;
}

.scrollable::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.scrollable::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

/* ローディングアニメーション */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

/* カテゴリバッジ */
.category-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  display: inline-flex;
  align-items: center;
}

.category-12u { 
  background-color: #F0FDF4; 
  color: #166534; 
}
.category-14u { 
  background-color: #EFF6FF; 
  color: #1E40AF; 
}
.category-16u { 
  background-color: #F5F3FF; 
  color: #7C3AED; 
}
.category-18u { 
  background-color: var(--grass-green-light); 
  color: var(--grass-green); 
}

/* グレードアイコンのスタイル */
.grade-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
}

.grade-1 { @apply bg-yellow-400 text-yellow-900; }
.grade-2 { @apply bg-gray-400 text-gray-900; }
.grade-3 { @apply bg-orange-400 text-orange-900; }
.grade-4 { @apply bg-blue-400 text-blue-900; }
.grade-5 { @apply bg-green-400 text-green-900; }

/* モーダル */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(51, 51, 51, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background-color: var(--base-white);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin: 1rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* フォームの検証スタイル */
.form-error {
  border-color: #EF4444;
  background-color: #FEF2F2;
}

.form-success {
  border-color: #10B981;
  background-color: #F0FDF4;
}

/* ヘッダー（ハードコートブルー） */
.header-nav {
  background-color: var(--court-blue);
  color: var(--base-white);
  border-bottom: 1px solid var(--court-blue-hover);
  box-shadow: 0 2px 8px var(--shadow-light);
}

.header-nav h1 {
  color: var(--base-white);
}

.header-nav .btn-primary {
  background-color: var(--base-white);
  color: var(--court-blue);
}

.header-nav .btn-primary:hover {
  background-color: var(--court-blue-light);
  color: var(--court-blue-hover);
}

/* ナビゲーション（ハードコートブルー） */
.bottom-nav {
  background-color: var(--court-blue);
  border-top: 1px solid var(--court-blue-hover);
  box-shadow: 0 -2px 8px var(--shadow-medium);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  color: var(--court-blue-light);
  text-decoration: none;
  font-size: 12px;
  font-weight: 400;
  transition: all 0.2s ease;
  min-height: 64px; /* アクセシビリティ: タッチ領域 */
  min-width: 48px;
}

.nav-item:hover {
  color: var(--base-white);
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-item:focus {
  outline: 2px solid var(--base-white);
  outline-offset: 2px;
}

.nav-item.nav-active {
  color: var(--base-white);
  border-top: 3px solid var(--ball-yellow);
  background-color: rgba(255, 255, 255, 0.15);
}

.nav-item i {
  font-size: 20px;
  margin-bottom: 0.25rem;
}

/* プログレスバー */
.progress-bar {
  height: 4px;
  background: linear-gradient(90deg, #3B82F6, #8B5CF6);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* トーストメッセージ */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1100;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px var(--shadow-medium);
  animation: toastSlide 0.3s ease-out;
  max-width: calc(100vw - 2rem);
}

.toast-success {
  background-color: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
}

.toast-error {
  background-color: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.toast-info {
  background-color: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #DBEAFE;
}

.toast-warning {
  background-color: #FFFBEB;
  color: #D97706;
  border: 1px solid #FED7AA;
}

@keyframes toastSlide {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* テーブルのレスポンシブスタイル */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive table {
  min-width: 600px;
}

/* 検索フィルターのスタイル（テニステーマ） */
.filter-section {
  background: linear-gradient(135deg, var(--court-blue) 0%, var(--grass-green) 100%);
}

.filter-card {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.9);
}

/* エントリー状況の色分け */
.entry-planned { @apply bg-gray-100 text-gray-800; }
.entry-applied { @apply bg-blue-100 text-blue-800; }
.entry-confirmed { @apply bg-green-100 text-green-800; }
.entry-withdrawn { @apply bg-red-100 text-red-800; }

/* ユーティリティクラス */
.text-shadow {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.glass {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* プリント用スタイル */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  .tournament-card {
    break-inside: avoid;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    padding: 1rem;
  }
}

/* Google Maps */
.map-container {
  width: 100%;
  height: 200px;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border-gray);
}

.map-embed {
  width: 100%;
  height: 100%;
  border: none;
}

/* 住所表示 */
.venue-address {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  background-color: var(--background-light);
  border: 1px solid var(--border-gray);
  border-radius: 0.5rem;
  font-size: 14px;
  color: var(--accent-dark);
}

.venue-address i {
  color: var(--court-blue);
  margin-top: 0.125rem;
  flex-shrink: 0;
}

/* 申込ボタンエリア */
.entry-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background-color: var(--grass-green-light);
  border: 1px solid var(--grass-green);
  border-radius: 0.75rem;
}

.entry-platform-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--accent-dark);
}

/* ユーティリティクラス */
.text-shadow {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.glass {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* プリント用スタイル */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
    background: white;
  }
  
  .tournament-card {
    break-inside: avoid;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    padding: 1rem;
  }
}