/* style.css */
/* FlexLog アプリケーションデザインシステム */

@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700;900&family=Outfit:wght@300;400;500;600;700;800&display=swap");

:root {
  --bg-main: #0a0a0c;
  --bg-surface: rgba(22, 22, 26, 0.85);
  --bg-surface-hover: rgba(32, 32, 38, 0.9);
  --bg-card: rgba(30, 30, 35, 0.6);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-color-focus: rgba(0, 242, 254, 0.4);

  /* ブランドカラー */
  --primary: #00f2fe;
  --primary-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --secondary-gradient: linear-gradient(135deg, #00ff87 0%, #60efff 100%);
  --danger-gradient: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);

  /* テキストカラー */
  --text-primary: #f5f6fa;
  --text-muted: #a0a5b5;
  --text-dark: #2f3542;

  /* ステータスカラー */
  --color-success: #2ed573;
  --color-warning: #ffa502;
  --color-danger: #ff4757;

  /* アニメーション */
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-fast: all 0.15s ease;
}

/* 全体のリセットと共通設定 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  padding-bottom: 80px; /* フッターやFAB用の余白 */
  overflow-x: hidden;
  background-image:
    radial-gradient(
      circle at 10% 20%,
      rgba(0, 242, 254, 0.05) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 90% 80%,
      rgba(79, 172, 254, 0.05) 0%,
      transparent 40%
    );
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
}

select option {
  background-color: rgba(22, 22, 26, 0.85);
  color: var(--text-primary);
}

/* ヘッダーデザイン */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  font-size: 24px;
  background: var(--primary-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.brand-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.active-date-badge {
  background: rgba(0, 242, 254, 0.1);
  color: var(--primary);
  border: 1px solid rgba(0, 242, 254, 0.2);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* カード共通スタイル (グラスモルフィズム) */
.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  margin-bottom: 24px;
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.card-title i {
  color: var(--primary);
}

/* カレンダーコンポーネント */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.calendar-month-title {
  font-size: 18px;
  font-weight: 700;
}

.btn-nav-cal {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-nav-cal:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary);
}

.calendar-grid-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
}

.calendar-grid-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-day-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
}

.calendar-day-cell:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.calendar-day-cell.other-month {
  opacity: 0.25;
}

.calendar-day-cell.today {
  border: 1px solid var(--primary);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.calendar-day-cell.selected {
  background: var(--primary-gradient);
  color: var(--bg-main);
  font-weight: 700;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.calendar-day-cell.selected .calendar-day-num {
  color: var(--bg-main);
}

.calendar-day-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* 部位別ドット表示 */
.calendar-dots {
  display: flex;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-height: 6px;
  margin-top: 2px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* ログリストセクション */
.logs-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.no-logs-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 30px 10px;
  font-size: 14px;
}

/* 各トレーニングログカード */
.workout-card {
  background: rgba(255, 255, 255, 0.02);
  border-left: 4px solid var(--primary);
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
  transition: var(--transition-smooth);
}

.workout-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.04);
}

.workout-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

.workout-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workout-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.workout-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.category-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  font-size: 10px;
}

.workout-time {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.workout-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-icon.edit-btn:hover {
  color: var(--primary);
}

.btn-icon.delete-btn:hover {
  color: var(--color-danger);
}

/* セットリスト表示 */
.sets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.sets-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.sets-table td {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.sets-table tr:last-child td {
  border-bottom: none;
}

.set-num-cell {
  font-weight: 600;
  color: var(--text-muted);
  width: 20%;
}

.weight-cell {
  font-weight: 700;
  width: 40%;
}

.weight-unit,
.reps-unit {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 2px;
}

.reps-cell {
  font-weight: 700;
  width: 40%;
}

/* フローティング・アクション・ボタン (FAB) */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary-gradient);
  color: var(--bg-main);
  border: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  z-index: 100;
  transition: var(--transition-smooth);
}

.fab:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 8px 25px rgba(0, 242, 254, 0.6);
}

/* モーダル共通スタイル */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-end; /* モバイルでは下からスライドイン */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #141418;
  border-top: 1px solid var(--border-color);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  width: 100%;
  max-width: 600px;
  max-height: 90%;
  padding: 24px;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal.active .modal-content {
  transform: translateY(0);
}

@media (min-width: 600px) {
  .modal {
    align-items: center; /* PCでは中央表示 */
  }
  .modal-content {
    border-radius: 24px;
    border: 1px solid var(--border-color);
    transform: translateY(50px);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

/* フォーム要素 */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  transition: var(--transition-smooth);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

/* 2カラムレイアウト */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 種目選択フォーム内の検索と追加 */
.exercise-select-container {
  display: flex;
  gap: 8px;
}

.btn-secondary-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-secondary-action:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* セットエディタ */
.set-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  margin-bottom: 12px;
}

.set-editor-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.set-row {
  display: grid;
  grid-template-columns: 60px 1fr 1fr 44px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.set-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit input {
  padding-right: 32px;
  text-align: right;
}

.input-unit {
  position: absolute;
  right: 12px;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

/* ボタンデザイン */
.btn-block {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: var(--primary-gradient);
  color: var(--bg-main);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.5);
}

.btn-add-set {
  background: rgba(0, 242, 254, 0.08);
  border: 1px dashed rgba(0, 242, 254, 0.3);
  color: var(--primary);
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 24px;
  transition: var(--transition-fast);
}

.btn-add-set:hover {
  background: rgba(0, 242, 254, 0.15);
}

/* 分析・グラフのUI */
.analysis-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 500px) {
  .analysis-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .analysis-select-group {
    width: 60%;
  }
}

.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--border-color);
}

.no-chart-data {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 14px;
}

/* 通知トースト */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(20, 20, 25, 0.95);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 12px 24px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  backdrop-filter: blur(10px);
}

.toast.active {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-left-color: var(--color-success);
}

.toast.error {
  border-left-color: var(--color-danger);
}

/* 新規種目登録モーダルの専用スタイル */
.category-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

@media (max-width: 400px) {
  .category-selector-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.category-select-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 10px 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: var(--transition-fast);
}

.category-select-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.category-select-btn.selected {
  border-color: currentColor;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px currentColor;
}

/* ==========================================
   ユーザー認証画面 (ログイン / 新規登録)
   ========================================== */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  font-size: 38px;
  margin-bottom: 8px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  display: inline-block;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 12px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.auth-tab:hover {
  color: var(--text-primary);
}

.auth-tab.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.auth-form-panel {
  display: none;
}

.auth-form-panel.active {
  display: block;
  animation: authPanelFadeIn 0.3s ease;
}

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

/* ヘッダーユーザーメニュー */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 13px;
}

.user-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.user-name {
  color: var(--text-primary);
  font-weight: 700;
}

.btn-logout {
  background: rgba(255, 71, 87, 0.08);
  border: 1px solid rgba(255, 71, 87, 0.15);
  color: #ff4757;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-logout:hover {
  background: rgba(255, 71, 87, 0.16);
  border-color: rgba(255, 71, 87, 0.3);
  transform: translateY(-1px);
}

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