/* 俺雀 - カスタムスタイル */

/* Noto Emoji フォントを読み込み（麻雀牌の統一デザイン用） */
@import url('https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&display=swap');

:root {
  --primary-color: #4b5563;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-600: #475569;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.5;
}

/* 麻雀牌の絵文字スタイル統一（画像ベース） */
.mahjong-tile,
#selectedTilesDisplay,
#tileSelector button,
#optionSelector,
#nanikituList,
#nanikituDetailContent,
#nanikituAnswer,
#nanikituDora,
[class*="tile"] {
  font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}

/* 牌ボタンのスタイル調整 */
.tile-btn {
  font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 牌画像のサイズとスタイル */
.mahjong-tile img,
#selectedTilesDisplay img,
#tileSelector img,
#optionSelector img,
#nanikituList img,
#nanikituDetailContent img {
  height: 2.5rem; /* 40px */
  width: auto;
  display: inline-block;
  vertical-align: middle;
  margin: 0 1px;
}

/* タイルセレクター内の牌画像 */
#tileSelector button img {
  height: 2.5rem;
  width: auto;
}

/* 選択済み牌表示エリアの牌画像 */
#selectedTilesDisplay img {
  height: 2rem; /* 32px - slightly smaller for selected tiles display */
  width: auto;
}

/* スマホ版で牌画像を小さくして一行に収める */
@media (max-width: 640px) {
  #nanikituList img,
  #nanikituDetailContent img {
    height: 1.5rem; /* 24px - スマホでは小さく */
    margin: 0;
  }
  
  /* 一覧の手牌表示はさらに小さく */
  #nanikituList .text-2xl {
    font-size: 1rem;
    line-height: 1.5rem;
  }
  
  /* 詳細の手牌表示も調整 */
  #nanikituDetailContent .text-3xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }
}

.tab-button {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.tab-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom right, #6b7280, #4b5563);
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

.tab-active::before {
  opacity: 1;
}

.tab-active {
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(75, 85, 99, 0.3);
  transform: translateY(-1px);
}

.calendar-day {
  min-height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.loading-spinner {
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

/* タッチデバイス用のホバー効果無効化 */
@media (hover: none) {
  .hover\:bg-gray-100:hover,
  .hover\:bg-gray-200:hover,
  .hover\:bg-blue-700:hover {
    background-color: inherit;
  }
}

/* アクティブ時のフィードバック */
button:active, 
.calendar-day:active {
  transform: scale(0.98);
}

/* スクロールバーのカスタマイズ（Webkitベース） */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

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

/* レスポンシブ対応 */
@media (max-width: 640px) {
  body {
    font-size: 14px;
  }
  
  .calendar-day {
    min-height: 45px;
    font-size: 0.75rem;
    padding: 2px;
  }
  
  /* モーダルの最適化 */
  .modal-content {
    max-height: 90vh;
    overflow-y: auto;
  }
  
  /* 入力フィールドのサイズ調整 */
  input[type="text"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important; /* iOSのズーム防止 */
  }
  
  /* タブレット以下ではグラフの高さを調整 */
  #ratingChart {
    max-height: 250px;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .calendar-day {
    min-height: 50px;
    font-size: 0.875rem;
  }
  
  #ratingChart {
    max-height: 300px;
  }
}

/* 日記タブスタイル */
.diary-tab-button {
  color: #6b7280;
  border-color: transparent;
}

.diary-tab-button:hover {
  color: #1f2937;
  background-color: #f3f4f6;
}

.diary-tab-active {
  color: #000000;
  border-color: #000000 !important;
  font-weight: 800;
}

.diary-tab-content {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Pull to Refresh インジケーター */
.pull-to-refresh-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(to bottom right, #374151, #1f2937);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  color: white;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.pull-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.pull-text {
  font-size: 14px;
  white-space: nowrap;
}

.rotating {
  animation: rotate 1s linear infinite;
}

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

/* フレンド詳細モーダル - タブスタイル */
.friend-detail-tab {
  transition: all 0.3s ease;
}

.friend-detail-content {
  animation: fadeIn 0.3s ease-in;
}

/* タブスライダー（Instagram/Twitter風） */
#tabSlider {
  touch-action: pan-y; /* 縦スクロールは許可 */
}

.tab-slide {
  flex-shrink: 0;
  width: 100vw; /* ビューポート幅に固定 */
  max-width: 100%; /* 親要素を超えないように */
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  box-sizing: border-box; /* paddingを含めた幅計算 */
}

/* タブボタンのトランジション強化 */
.tab-button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-button:active {
  transform: scale(0.95);
}

.tab-active {
  transform: scale(1);
}

/* タブコンテンツの滑らかな切り替えアニメーション */
.tab-content {
  transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.tab-fade-out {
  opacity: 0;
  transform: translateX(-10px);
}

.tab-fade-in {
  animation: slideInFade 0.25s ease-out forwards;
}

@keyframes slideInFade {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* トグルチェックボックス（iOS風スイッチ） */
.toggle-checkbox {
  appearance: none;
  width: 48px;
  height: 26px;
  background-color: #cbd5e1;
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.3s;
  flex-shrink: 0;
}

.toggle-checkbox::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 11px;
  background-color: white;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-checkbox:checked {
  background-color: #1f2937;
}

.toggle-checkbox:checked::before {
  transform: translateX(22px);
}
