/* StudyBase カスタムスタイル */

/* タイマーアニメーション */
@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.timer-active {
  animation: pulse-ring 2s ease-out infinite;
}

/* カレンダー */
.calendar-day {
  transition: all 0.2s ease;
  cursor: pointer;
}
.calendar-day:hover {
  transform: scale(1.05);
}
.calendar-day.has-study {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}
.calendar-day.has-note {
  border-bottom: 3px solid #6366f1;
}
.calendar-day.has-exam {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}
.calendar-day.today {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: white;
}

/* ランキング */
.rank-1 { background: linear-gradient(135deg, #ffd700 0%, #ffb300 100%); }
.rank-2 { background: linear-gradient(135deg, #c0c0c0 0%, #9e9e9e 100%); }
.rank-3 { background: linear-gradient(135deg, #cd7f32 0%, #a0522d 100%); }

/* スクロールバー */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #6366f1; }

/* カード */
.card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.06);
}

/* ナビゲーション */
.nav-item {
  transition: all 0.2s ease;
}
.nav-item.active {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: white;
}
.nav-item:not(.active):hover {
  background: #e0e7ff;
  color: #4338ca;
}

/* ボタン */
.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
.btn-secondary {
  background: white;
  color: #4338ca;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  border: 2px solid #c7d2fe;
  transition: all 0.2s ease;
  cursor: pointer;
}
.btn-secondary:hover {
  background: #eef2ff;
}

/* アバター */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1rem;
}

/* モーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-content {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* フォーム */
.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
  outline: none;
}
.form-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* 気分アイコン */
.mood-btn {
  font-size: 1.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  border: 2px solid transparent;
}
.mood-btn:hover, .mood-btn.selected {
  transform: scale(1.3);
  border-color: #6366f1;
  background: #eef2ff;
}

/* バッジ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ストリーク炎 */
.streak-fire {
  animation: flicker 1.5s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1) rotate(5deg); }
}

/* レスポンシブ */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.open { display: block; }
  .mobile-nav { display: flex; }
}
@media (min-width: 769px) {
  .mobile-nav { display: none; }
}

/* 進捗バー */
.progress-bar {
  height: 8px;
  border-radius: 9999px;
  background: #e0e7ff;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #6366f1, #4338ca);
  transition: width 0.5s ease;
}

/* タブ */
.tab-btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: transparent;
  color: #6b7280;
}
.tab-btn.active {
  background: white;
  color: #4338ca;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* トースト通知 */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  color: white;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
}
.toast.success { background: linear-gradient(135deg, #059669, #047857); }
.toast.error { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.toast.info { background: linear-gradient(135deg, #4f46e5, #4338ca); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ローディングスピナー */
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* nav-active (active と tab-active の統一) */
.nav-active {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%) !important;
  color: white !important;
}
.tab-active {
  background: white;
  color: #4338ca;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  font-weight: 600;
}

/* バッジ追加 */
.badge-blue {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
}
.badge-gray {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 500;
  background: #f3f4f6;
  color: #374151;
}

/* カード padding */
.card {
  padding: 1.25rem;
}
