/* Custom styles for MuscleRotationManager */

:root {
  /* ブランドカラー */
  --color-primary: #6b5be2;
  --color-primary-light: #8b7bef;
  --color-primary-dark: #4a3fb8;
  --color-secondary: #764ba2;
  --color-accent: #f093fb;
  --color-accent-light: #f5576c;

  /* ニュートラルカラー */
  --color-bg-light: #f9fafb;
  --color-bg-white: #ffffff;
  --color-text-dark: #1f2937;
  --color-border: #e5e7eb;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
}

body {
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ヘッダー固定スタイル */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ヘッダー固定時のメインコンテンツ調整 */
body {
  padding-top: 64px; /* ヘッダーの高さ分のパディングを追加 */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* フッター固定スタイル */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #1f2937;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* ヘッダー・フッター固定時のページコンテンツ調整 */
#app {
  flex: 1;
  padding-top: 0; /* アプリコンテナのパディングをリセット */
  padding-bottom: 80px; /* コンパクトフッターの高さ分のパディングを追加 */
}

/* サイドバーフォーカス管理 */
.desktop-sidebar {
  transition: all 0.3s ease;
}

.desktop-sidebar:focus-within {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.desktop-sidebar.hidden {
  display: none !important;
}

.desktop-sidebar.flex {
  display: flex !important;
}

/* ナビゲーションアイテムのフォーカススタイル */
.nav-item {
  transition: all 0.2s ease;
  outline: none;
}

.nav-item:focus {
  background-color: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  transform: translateX(2px);
}

.nav-item:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.nav-item:hover:not(:focus) {
  background-color: #f9fafb;
  transform: translateX(1px);
}

/* モバイルサイドバーのフォーカス管理 */
.mobile-sidebar {
  transition: all 0.3s ease;
}

.mobile-sidebar:focus-within {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.mobile-sidebar.hidden {
  display: none !important;
}

.mobile-sidebar.block {
  display: block !important;
}

/* サイドバー表示時のアニメーション */
@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.desktop-sidebar.show,
.mobile-sidebar.show {
  animation: slideInFromLeft 0.3s ease-out;
}

/* フォーカス時のサイドバー表示 */
.sidebar-focused {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 1000;
}

/* キーボードナビゲーション用のスタイル */
.nav-item[tabindex='0'] {
  position: relative;
}

.nav-item[tabindex='0']::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: #3b82f6;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav-item[tabindex='0']:focus::before {
  opacity: 1;
}

/* アクセシビリティ対応 */
@media (prefers-reduced-motion: reduce) {
  .desktop-sidebar,
  .mobile-sidebar,
  .nav-item {
    transition: none;
    animation: none;
  }
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
  .nav-item:focus {
    background-color: #000;
    color: #fff;
    border: 2px solid #fff;
  }

  .nav-item:focus-visible {
    outline: 3px solid #fff;
  }
}

/* ヘッダー内のコンテンツ調整 */
header .max-w-7xl {
  height: 64px; /* ヘッダーの高さを固定 */
}

/* ユーザープロフィール表示のスタイル */
#user-profile-container {
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

#user-profile-container:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#user-display-name {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  font-weight: 500;
  letter-spacing: 0.025em;
}

/* ドロップダウンアニメーション */
#user-dropdown {
  animation: dropdownFadeIn 0.2s ease-out;
}

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

/* モバイルでのユーザー名表示調整 */
@media (max-width: 768px) {
  #user-display-name {
    display: none !important;
  }

  #user-profile-container {
    padding: 8px 12px;
  }

  #user-avatar {
    width: 32px;
    height: 32px;
  }
}

/* タブレットサイズでの調整 */
@media (min-width: 769px) and (max-width: 1024px) {
  #user-display-name {
    max-width: 24ch;
    font-size: 0.875rem;
  }
}

/* 大画面での最適化 */
@media (min-width: 1025px) {
  #user-display-name {
    max-width: 40ch;
    font-size: 0.9rem;
  }

  #user-profile-container {
    padding: 10px 16px;
  }
}

/* モバイル対応 */
@media (max-width: 768px) {
  body {
    padding-top: 56px; /* モバイルでのヘッダー高さ調整 */
  }

  header .max-w-7xl {
    height: 56px;
  }

  /* モバイルでのフッター調整 */
  #app {
    padding-bottom: 100px; /* モバイルでのコンパクトフッター高さ調整 */
  }

  footer {
    padding: 12px 0; /* モバイルでのフッターパディング調整 */
  }

  /* モバイルでのフッターレイアウト調整 */
  footer .flex-col {
    text-align: center;
  }

  footer .flex-wrap {
    justify-content: center;
    gap: 8px;
  }

  footer .space-x-4 > * + * {
    margin-left: 8px;
  }
}

.font-size-xs {
  font-size: 0.625rem;
}
.font-size-sm {
  font-size: 0.75rem;
}
.font-size-base {
  font-size: 1rem;
}
.font-size-lg {
  font-size: 1.125rem;
}
.font-size-xl {
  font-size: 1.5rem;
}

.muscle-gradient {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.muscle-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.recovery-bar {
  height: 8px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.recovery-excellent {
  background: linear-gradient(90deg, #10b981, #34d399);
}
.recovery-good {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.recovery-warning {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.muscle-part {
  transition: all 0.3s ease;
  cursor: pointer;
}

.muscle-part:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.muscle-part.active {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.1);
}

.hidden {
  display: none;
}

.calendar-day {
  min-height: 80px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calendar-day:hover {
  background: #f9fafb;
}

.calendar-day.has-workout {
  background: rgba(102, 126, 234, 0.1);
}

.workout-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin: 1px;
}

.chest-color {
  background: #ef4444;
}
.back-color {
  background: #10b981;
}
.shoulder-color {
  background: #f59e0b;
}
.arm-color {
  background: #8b5cf6;
}
.leg-color {
  background: #3b82f6;
}
.core-color {
  background: #ec4899;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-circle {
  stroke-dasharray: 0 100;
  stroke-dashoffset: 0;
  transition: stroke-dasharray 0.3s ease;
}

@media (max-width: 768px) {
  .desktop-sidebar {
    display: none;
  }
  .mobile-menu {
    display: block;
  }
}

@media (min-width: 769px) {
  .desktop-sidebar {
    display: block;
  }
  .mobile-menu {
    display: none;
  }
}

/* 遅延ローディング対応スタイル */
img[data-src] {
  opacity: 0;
  transition: opacity 0.3s ease;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
}

img[data-src].loaded {
  opacity: 1;
  background: none;
  animation: none;
}

img[data-src].error {
  opacity: 0.5;
  background: #f8f9fa;
  animation: none;
}

@keyframes loading-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* 遅延ロードコンポーネントのローディング状態 */
[data-lazy-component] {
  min-height: 100px;
  position: relative;
}

[data-lazy-component]:not(.loaded) {
  background: linear-gradient(90deg, #f8f9fa 25%, #e9ecef 50%, #f8f9fa 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
}

[data-lazy-component].loaded {
  background: none;
  animation: none;
}

/* パフォーマンス最適化: GPU加速 */
.muscle-part,
.recovery-bar,
.progress-ring-circle {
  will-change: transform;
  transform: translateZ(0);
}

/* スクロール最適化 */
.calendar-day,
.muscle-card {
  contain: layout style paint;
}

/* オフラインモード表示 */
body.offline-mode::before {
  content: 'オフラインモード';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #f59e0b;
  color: white;
  text-align: center;
  padding: 4px 8px;
  font-size: 12px;
  z-index: 9999;
  animation: offline-pulse 2s infinite;
}

@keyframes offline-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.sidebar-transition {
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.sidebar-transition.open {
  transform: translateX(0);
}

.loading-spinner {
  border: 3px solid #f3f4f6;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

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

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.notification.show {
  transform: translateX(0);
}

.notification.success {
  background: #10b981;
}
.notification.error {
  background: #ef4444;
}
.notification.warning {
  background: #f59e0b;
}

.chart-container {
  position: relative;
  height: 400px;
  margin: 20px 0;
}

.modal {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-height: 90vh;
  overflow-y: auto;
}

.exercise-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin: 8px 0;
  transition: all 0.2s ease;
}

.exercise-card:hover {
  background: #f1f5f9;
  border-color: #667eea;
}

.difficulty-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.difficulty-beginner {
  background: #dcfce7;
  color: #166534;
}
.difficulty-intermediate {
  background: #fef3c7;
  color: #92400e;
}
.difficulty-advanced {
  background: #fee2e2;
  color: #991b1b;
}

.lang-switch {
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.lang-switch:hover {
  background: rgba(255, 255, 255, 0.1);
}

.lang-switch.active {
  background: rgba(255, 255, 255, 0.2);
}

.affiliate-banner {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  text-align: center;
}

.affiliate-banner a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  border: 1px solid white;
  padding: 8px 16px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 8px;
  transition: all 0.2s ease;
}

.affiliate-banner a:hover {
  background: white;
  color: #667eea;
}

.print-hidden {
  display: none;
}

@media print {
  .print-hidden {
    display: block;
  }
  .no-print {
    display: none;
  }
  body {
    font-size: 12px;
  }
  .container {
    max-width: none;
  }
}

/* カレンダー専用スタイル */
.calendar-container {
  max-width: 100%;
  overflow-x: auto;
}

.calendar-date-cell {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.calendar-date-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.calendar-grid {
  user-select: none;
}

/* カレンダーモーダル */
.calendar-modal {
  backdrop-filter: blur(4px);
}

.calendar-modal .modal-content {
  animation: modalSlideIn 0.3s ease-out;
}

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

/* 部位別色分けの改善 */
.muscle-legend {
  display: grid;
  gap: 0.5rem;
}

.muscle-legend-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.muscle-legend-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* カレンダーナビゲーション */
.calendar-nav-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.calendar-nav-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
  transform: scale(1.05);
}

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

/* 統計カードのスタイル */
.stats-card {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.7)
  );
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.stats-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* カレンダーローディング */
.calendar-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #6b7280;
}

.calendar-loading .spinner {
  width: 2rem;
  height: 2rem;
  margin-bottom: 1rem;
}

/* ワークアウトドットのアニメーション */
.workout-dot {
  animation: dotPulse 2s infinite;
}

.workout-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.workout-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* ホバー効果の改善 */
.calendar-date-cell:hover .workout-dot {
  animation-play-state: paused;
  transform: scale(1.2);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  /* カレンダーのモバイル対応 */
  .calendar-date-cell {
    min-height: 60px;
    font-size: 0.875rem;
  }

  .calendar-grid {
    gap: 1px;
  }

  .workout-dot {
    width: 6px;
    height: 6px;
    margin: 0.5px;
  }

  /* モーダルのモバイル対応 */
  .calendar-modal .modal-content {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }

  /* 凡例のモバイル対応 */
  .muscle-legend {
    grid-template-columns: repeat(2, 1fr);
  }

  .muscle-legend-item {
    padding: 0.375rem;
    font-size: 0.75rem;
  }
}

@media (min-width: 769px) {
  /* デスクトップでのカレンダー表示 */
  .calendar-date-cell {
    min-height: 96px;
  }

  .muscle-legend {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (min-width: 1024px) {
  /* 大画面での最適化 */
  .calendar-date-cell {
    min-height: 120px;
  }

  .calendar-grid {
    gap: 2px;
  }
}

/* タブレット対応 */
@media (min-width: 640px) and (max-width: 1023px) {
  .calendar-date-cell {
    min-height: 80px;
  }

  .muscle-legend {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* アクセシビリティ対応 */
@media (prefers-reduced-motion: reduce) {
  .workout-dot,
  .calendar-date-cell,
  .modal-content {
    animation: none;
    transition: none;
  }

  .calendar-date-cell:hover {
    transform: none;
  }
}

/* ダークモード対応（将来の拡張用） */
@media (prefers-color-scheme: dark) {
  .calendar-date-cell {
    border-color: #374151;
  }

  .calendar-date-cell:hover {
    background-color: #1f2937;
  }
}

/* ツールチップスタイル */
.tooltip-container {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tooltip {
  position: absolute;
  max-width: 300px;
  padding: 8px 12px;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  opacity: 0;
  transform: translateY(5px);
  transition: all 0.2s ease;
  word-wrap: break-word;
  z-index: 10001;
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
}

.tooltip-dark {
  background: #1f2937;
  color: #f9fafb;
  border-color: #374151;
}

.tooltip::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border: 5px solid transparent;
}

.tooltip[data-position='top']::before {
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: #e5e7eb;
}

.tooltip[data-position='bottom']::before {
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: #e5e7eb;
}

.tooltip[data-position='left']::before {
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: #e5e7eb;
}

.tooltip[data-position='right']::before {
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: #e5e7eb;
}

.tooltip-dark[data-position='top']::before {
  border-top-color: #374151;
}

.tooltip-dark[data-position='bottom']::before {
  border-bottom-color: #374151;
}

.tooltip-dark[data-position='left']::before {
  border-left-color: #374151;
}

.tooltip-dark[data-position='right']::before {
  border-right-color: #374151;
}

/* ツールチップアニメーション */
.tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.tooltip.fade-out {
  opacity: 0;
  transform: translateY(5px);
}

/* 筋肉部位用ツールチップ */
.muscle-tooltip {
  max-width: 250px;
  font-size: 13px;
}

.muscle-tooltip .muscle-name {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
  display: block;
}

.muscle-tooltip .muscle-details {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.3;
}

/* エクササイズ用ツールチップ */
.exercise-tooltip {
  max-width: 300px;
  font-size: 13px;
}

.exercise-tooltip .exercise-name {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
  display: block;
}

.exercise-tooltip .exercise-difficulty {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 4px;
}

.exercise-tooltip .difficulty-beginner {
  background: #dcfce7;
  color: #166534;
}

.exercise-tooltip .difficulty-intermediate {
  background: #fef3c7;
  color: #92400e;
}

.exercise-tooltip .difficulty-advanced {
  background: #fee2e2;
  color: #991b1b;
}

.exercise-tooltip .exercise-muscles {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.exercise-tooltip .exercise-description {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.3;
}

/* 統計データ用ツールチップ */
.stats-tooltip {
  max-width: 200px;
  font-size: 12px;
}

.stats-tooltip .stats-title {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
  display: block;
}

.stats-tooltip .stats-description {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.3;
}

/* ナビゲーション用ツールチップ */
.nav-tooltip {
  max-width: 150px;
  font-size: 12px;
  text-align: center;
}

.nav-tooltip .nav-name {
  font-weight: 500;
  color: #1f2937;
  display: block;
}

.nav-tooltip .nav-description {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

/* ボタン用ツールチップ */
.button-tooltip {
  max-width: 200px;
  font-size: 12px;
  text-align: center;
}

.button-tooltip .button-title {
  font-weight: 500;
  color: #1f2937;
  display: block;
  margin-bottom: 2px;
}

.button-tooltip .button-description {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.3;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .tooltip {
    max-width: 250px;
    font-size: 13px;
    padding: 6px 10px;
  }

  .muscle-tooltip {
    max-width: 200px;
  }

  .exercise-tooltip {
    max-width: 250px;
  }

  .stats-tooltip {
    max-width: 180px;
  }

  .nav-tooltip {
    max-width: 120px;
  }

  .button-tooltip {
    max-width: 150px;
  }
}

@media (max-width: 480px) {
  .tooltip {
    max-width: 200px;
    font-size: 12px;
    padding: 5px 8px;
  }

  .muscle-tooltip,
  .exercise-tooltip,
  .stats-tooltip,
  .nav-tooltip,
  .button-tooltip {
    max-width: 150px;
  }
}

/* アクセシビリティ対応 */
@media (prefers-reduced-motion: reduce) {
  .tooltip {
    transition: none;
    animation: none;
  }

  .tooltip.show {
    opacity: 1;
    transform: none;
  }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
  .tooltip {
    background: #1f2937;
    color: #f9fafb;
    border-color: #374151;
  }

  .muscle-tooltip .muscle-name,
  .exercise-tooltip .exercise-name,
  .stats-tooltip .stats-title,
  .nav-tooltip .nav-name,
  .button-tooltip .button-title {
    color: #f9fafb;
  }

  .muscle-tooltip .muscle-details,
  .exercise-tooltip .exercise-muscles,
  .exercise-tooltip .exercise-description,
  .stats-tooltip .stats-description,
  .nav-tooltip .nav-description,
  .button-tooltip .button-description {
    color: #d1d5db;
  }
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
  .tooltip {
    border: 2px solid #000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  }

  .tooltip::before {
    border-width: 6px;
  }
}

/* カレンダー印刷対応 */
@media print {
  .calendar-nav-button,
  .calendar-modal,
  .notification {
    display: none !important;
  }

  .calendar-date-cell {
    border: 1px solid #000;
    min-height: 60px;
    break-inside: avoid;
  }

  .workout-dot {
    background: #000 !important;
  }

  .tooltip-container {
    display: none !important;
  }
}

/* ワークアウトウィザードスタイル */
.workout-wizard {
  max-width: 800px;
  margin: 0 auto;
}

/* ステップインジケーター */
.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.step-indicator.active {
  opacity: 1;
}

.step-indicator.completed {
  opacity: 1;
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #6b7280;
  transition: all 0.3s ease;
  margin-bottom: 8px;
}

.step-indicator.active .step-circle {
  background: #3b82f6;
  color: white;
}

.step-indicator.completed .step-circle {
  background: #10b981;
  color: white;
}

.step-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
}

.step-indicator.active .step-label,
.step-indicator.completed .step-label {
  color: #374151;
}

.step-connector {
  width: 60px;
  height: 2px;
  background: #e5e7eb;
  margin: 0 16px;
  margin-top: 20px;
}

/* ウィザードステップ */
.wizard-step {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.wizard-step.active {
  display: block;
}

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

/* プリセットボタン */
.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: white;
  transition: all 0.2s ease;
  cursor: pointer;
  text-align: center;
  min-height: 120px;
}

.preset-btn:hover {
  border-color: #3b82f6;
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.preset-btn.selected {
  border-color: #3b82f6;
  background: #eff6ff;
}

.preset-btn i {
  font-size: 1.5rem;
  display: block;
}

.preset-btn span {
  font-weight: 600;
  color: #374151;
  margin: 4px 0;
  display: block;
}

.preset-btn small {
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.2;
}

/* 筋肉部位選択ボタン */
.muscle-group-btn {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  transition: all 0.2s ease;
  cursor: pointer;
  min-height: 60px;
}

.muscle-group-btn:hover {
  border-color: #3b82f6;
  background: #f8fafc;
}

.muscle-group-btn.selected {
  border-color: #3b82f6;
  background: #eff6ff;
}

.muscle-group-btn i {
  font-size: 1.25rem;
  margin-right: 12px;
  width: 20px;
  text-align: center;
}

.muscle-group-btn .muscle-name {
  font-weight: 600;
  color: #374151;
}

/* エクササイズプリセットボタン */
.exercise-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  transition: all 0.2s ease;
  cursor: pointer;
  text-align: center;
  min-height: 80px;
}

.exercise-preset-btn:hover {
  border-color: #10b981;
  background: #f0fdf4;
}

.exercise-preset-btn.selected {
  border-color: #10b981;
  background: #dcfce7;
}

.exercise-preset-btn i {
  font-size: 1.25rem;
  color: #10b981;
  margin-bottom: 4px;
}

.exercise-preset-btn span {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

/* 選択されたエクササイズリスト */
.selected-exercise-item {
  display: flex;
  align-items: center;
  justify-content: between;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  margin-bottom: 8px;
}

.selected-exercise-item .exercise-name {
  font-weight: 500;
  color: #166534;
  flex: 1;
}

.selected-exercise-item .remove-btn {
  color: #dc2626;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.selected-exercise-item .remove-btn:hover {
  background: rgba(220, 38, 38, 0.1);
}

/* ボタンスタイル */
.btn-primary {
  background: #3b82f6;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: #6b7280;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.btn-secondary:hover {
  background: #4b5563;
  transform: translateY(-1px);
}

.btn-success {
  background: #10b981;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

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

.btn-warning {
  background: #f59e0b;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-warning:hover {
  background: #d97706;
}

.btn-danger {
  background: #ef4444;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-danger:hover {
  background: #dc2626;
}

/* モバイル最適化 */
@media (max-width: 768px) {
  .step-connector {
    width: 40px;
    margin: 0 8px;
    margin-top: 20px;
  }

  .step-circle {
    width: 36px;
    height: 36px;
    font-size: 0.875rem;
  }

  .step-label {
    font-size: 0.75rem;
  }

  .preset-btn {
    min-height: 100px;
    padding: 12px 8px;
  }

  .preset-btn i {
    font-size: 1.25rem;
  }

  .preset-btn span {
    font-size: 0.875rem;
  }

  .preset-btn small {
    font-size: 0.625rem;
  }

  .muscle-group-btn {
    min-height: 50px;
    padding: 8px 12px;
  }

  .exercise-preset-btn {
    min-height: 70px;
    padding: 8px 6px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-success {
    padding: 10px 20px;
    font-size: 0.875rem;
    min-height: 44px;
  }
}

/* タッチターゲット最適化 */
.preset-btn,
.muscle-group-btn,
.exercise-preset-btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-warning,
.btn-danger {
  min-height: 44px;
  min-width: 44px;
}

/* アクセシビリティ対応 */
@media (prefers-reduced-motion: reduce) {
  .wizard-step,
  .preset-btn,
  .muscle-group-btn,
  .exercise-preset-btn,
  .step-indicator,
  .step-circle {
    animation: none;
    transition: none;
  }

  .preset-btn:hover,
  .muscle-group-btn:hover,
  .exercise-preset-btn:hover {
    transform: none;
  }
}

/* フォーカス対応 */
.preset-btn:focus,
.muscle-group-btn:focus,
.exercise-preset-btn:focus,
.btn-primary:focus,
.btn-secondary:focus,
.btn-success:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ワークアウト進行中のスタイル */
.workout-active {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.exercise-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.exercise-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.exercise-item.completed {
  background: #f0fdf4;
  border-color: #10b981;
}

.set-input {
  width: 60px;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  text-align: center;
  font-weight: 500;
}

.set-input:focus {
  border-color: #3b82f6;
  outline: none;
}

/* 休憩タイマー */
.rest-timer {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #1f2937;
  color: white;
  padding: 16px;
  border-radius: 12px;
  z-index: 1000;
  min-width: 200px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.rest-timer.active {
  background: #10b981;
}

.rest-timer .timer-display {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 8px;
}

.rest-timer .timer-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.rest-timer button {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  font-size: 0.75rem;
}

.rest-timer button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* エラー通知スタイル */
.error-notification {
  position: fixed;
  z-index: 9999;
  max-width: 400px;
  min-width: 300px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border-left: 4px solid;
  animation: slideInRight 0.3s ease-out;
  font-family: 'Noto Sans JP', sans-serif;
}

.error-notification.top-right {
  top: 20px;
  right: 20px;
}

.error-notification.top-left {
  top: 20px;
  left: 20px;
}

.error-notification.bottom-right {
  bottom: 20px;
  right: 20px;
}

.error-notification.bottom-left {
  bottom: 20px;
  left: 20px;
}

/* 重要度別の色分け */
.error-notification.error {
  border-left-color: #ef4444;
}

.error-notification.warning {
  border-left-color: #f59e0b;
}

.error-notification.info {
  border-left-color: #3b82f6;
}

.error-notification.success {
  border-left-color: #10b981;
}

.error-content {
  padding: 16px;
}

.error-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.error-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.error-text {
  flex: 1;
  min-width: 0;
}

.error-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: #1f2937;
  margin: 0 0 4px 0;
  line-height: 1.4;
}

.error-description {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0;
  line-height: 1.4;
}

.error-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  margin-top: -2px;
}

.error-close:hover {
  color: #6b7280;
  background: #f3f4f6;
}

.error-solutions {
  border-top: 1px solid #f3f4f6;
  padding-top: 12px;
  margin-top: 12px;
}

.error-solutions p {
  font-weight: 500;
  color: #374151;
  margin: 0 0 8px 0;
  font-size: 0.75rem;
}

.error-solutions ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.error-solutions li {
  font-size: 0.75rem;
  color: #4b5563;
  line-height: 1.5;
  margin-bottom: 6px;
}

.error-solutions li:last-child {
  margin-bottom: 0;
}

.error-solutions i {
  font-size: 0.625rem;
}

/* アニメーション */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

.error-notification.fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

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

/* モバイル対応 */
@media (max-width: 768px) {
  .error-notification {
    left: 16px !important;
    right: 16px !important;
    max-width: none;
    min-width: auto;
  }

  .error-notification.top-right,
  .error-notification.top-left {
    top: 16px;
  }

  .error-notification.bottom-right,
  .error-notification.bottom-left {
    bottom: 16px;
  }

  .error-content {
    padding: 12px;
  }

  .error-title {
    font-size: 0.8125rem;
  }

  .error-description {
    font-size: 0.6875rem;
  }

  .error-solutions li {
    font-size: 0.6875rem;
  }
}

/* アクセシビリティ対応 */
@media (prefers-reduced-motion: reduce) {
  .error-notification {
    animation: none;
  }

  .error-notification.fade-out {
    animation: none;
    opacity: 0;
  }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
  .error-notification {
    background: #1f2937;
    color: #f9fafb;
  }

  .error-title {
    color: #f9fafb;
  }

  .error-description {
    color: #d1d5db;
  }

  .error-solutions {
    border-top-color: #374151;
  }

  .error-solutions p {
    color: #e5e7eb;
  }

  .error-solutions li {
    color: #d1d5db;
  }

  .error-close {
    color: #9ca3af;
  }

  .error-close:hover {
    color: #d1d5db;
    background: #374151;
  }
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
  .error-notification {
    border: 2px solid;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  .error-notification.error {
    border-color: #dc2626;
  }

  .error-notification.warning {
    border-color: #d97706;
  }

  .error-notification.info {
    border-color: #2563eb;
  }

  .error-notification.success {
    border-color: #059669;
  }
}

/* フォーカス対応 */
.error-notification:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* 複数エラー表示時のスタック */
.error-notification:nth-of-type(n + 2) {
  margin-top: 8px;
}

/* エラー統計表示（開発者向け） */
.error-stats {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: monospace;
  z-index: 10000;
  display: none;
}

.error-stats.show {
  display: block;
}

/* オフラインモード対応 */
.offline-mode {
  position: relative;
}

.offline-mode::before {
  content: '🔴 オフラインモード';
  position: fixed;
  top: 10px;
  right: 10px;
  background: #ff4444;
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  z-index: 10000;
  animation: pulse 2s infinite;
}

.offline-mode .sync-indicator {
  display: inline-block;
  margin-left: 8px;
  animation: spin 1s linear infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

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

/* 接続状態インジケーター */
.connection-status {
  position: fixed;
  top: 60px;
  right: 10px;
  padding: 6px 10px;
  border-radius: 15px;
  font-size: 11px;
  font-weight: bold;
  z-index: 9999;
  transition: all 0.3s ease;
}

.connection-status.online {
  background: #4caf50;
  color: white;
}

.connection-status.offline {
  background: #f44336;
  color: white;
}

.connection-status.syncing {
  background: #ff9800;
  color: white;
}

/* オフラインキュー表示 */
.offline-queue-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #2196f3;
  color: white;
  padding: 10px 15px;
  border-radius: 25px;
  font-size: 12px;
  font-weight: bold;
  z-index: 9998;
  cursor: pointer;
  transition: all 0.3s ease;
}

.offline-queue-indicator:hover {
  background: #1976d2;
  transform: scale(1.05);
}

.offline-queue-indicator.hidden {
  display: none;
}

/* カレンダーのスタイル */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background-color: #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.calendar-date-cell {
  background-color: white;
  min-height: 100px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
}

.calendar-date-cell:hover {
  background-color: #f9fafb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.calendar-date-cell.today {
  background-color: #dbeafe;
  border-color: #3b82f6;
  font-weight: bold;
}

.calendar-date-cell.other-month {
  background-color: #f9fafb;
  color: #9ca3af;
}

.calendar-date-cell .date-number {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  line-height: 1;
}

.calendar-date-cell .workout-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: auto;
  max-height: 40px;
  overflow: hidden;
}

.workout-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.workout-dot.chest-color {
  background-color: #ef4444;
}
.workout-dot.back-color {
  background-color: #3b82f6;
}
.workout-dot.shoulder-color {
  background-color: #10b981;
}
.workout-dot.arm-color {
  background-color: #f59e0b;
}
.workout-dot.leg-color {
  background-color: #8b5cf6;
}
.workout-dot.core-color {
  background-color: #ec4899;
}

/* 曜日ヘッダーのスタイル */
.calendar-weekday-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  margin-bottom: 1px;
}

.calendar-weekday {
  background-color: #f3f4f6;
  padding: 12px 8px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.calendar-weekday.sunday {
  color: #dc2626;
}

.calendar-weekday.saturday {
  color: #2563eb;
}

/* カレンダーコンテナのスタイル */
#calendar-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.calendar-wrapper {
  min-width: 600px;
  width: 100%;
}

.calendar-dates-container {
  display: contents;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .calendar-date-cell {
    min-height: 80px;
    padding: 6px;
  }

  .calendar-date-cell .date-number {
    font-size: 12px;
  }

  .workout-dot {
    width: 4px;
    height: 4px;
  }

  .calendar-wrapper {
    min-width: 500px;
  }
}

@media (max-width: 480px) {
  .calendar-date-cell {
    min-height: 70px;
    padding: 4px;
  }

  .calendar-date-cell .workout-dots {
    max-height: 30px;
  }

  .calendar-wrapper {
    min-width: 400px;
  }
}
