/* FitMate Global Styles - Dark Orange Theme */
:root {
  --primary: #FF6B35;
  --primary-dark: #E55A25;
  --primary-light: #FF8C61;
  --bg: #111111;
  --bg2: #1A1A1A;
  --bg3: #252525;
  --card: #1E1E1E;
  --card2: #242424;
  --text: #FFFFFF;
  --text1: #FFFFFF;
  --text2: #B0B8CC;
  --text3: #6B7A99;
  --border: rgba(255, 255, 255, 0.08);
  --success: #4CAF50;
  --danger: #F44336;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Layout Container */
.container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

/* Top Bar */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg2);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.top-bar h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.top-bar .subtitle {
  font-size: 12px;
  color: var(--text3);
}

/* Bottom Tab Nav */
.tab-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px 8px;
  text-decoration: none;
  color: var(--text3);
  font-size: 11px;
  gap: 4px;
  transition: color 0.2s;
}

.tab-item.active, .tab-item:hover {
  color: var(--primary);
}

.tab-item .icon {
  font-size: 22px;
  line-height: 1;
}

/* Content Area with bottom nav */
.content {
  padding: 16px;
  padding-bottom: 80px;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}

.card:active {
  transform: scale(0.99);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 16px;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.btn-primary:hover, .btn-primary:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  border-radius: 12px;
}

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text2);
  border-radius: 12px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Inputs */
.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 6px;
  font-weight: 500;
}

.input {
  width: 100%;
  padding: 13px 16px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}

.input::placeholder {
  color: var(--text3);
}

textarea.input {
  resize: none;
  min-height: 80px;
}

select.input {
  appearance: none;
  -webkit-appearance: none;
}

/* Input with button inside */
.input-row {
  display: flex;
  gap: 10px;
}

.input-row .input {
  flex: 1;
}

.input-row .btn {
  white-space: nowrap;
  padding: 13px 16px;
  font-size: 13px;
}

/* Tags/Chips */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.tag {
  padding: 5px 12px;
  background: rgba(255, 107, 53, 0.15);
  border: 1px solid rgba(255, 107, 53, 0.3);
  border-radius: 20px;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.tag.selected, .tag:active {
  background: var(--primary);
  color: #fff;
}

/* Checkbox Tags */
.checkbox-tags label {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  background: var(--card2);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin: 4px 4px 4px 0;
}

.checkbox-tags input[type="checkbox"] {
  display: none;
}

.checkbox-tags input:checked + span,
.checkbox-tags label:has(input:checked) {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.checkbox-tags label.checked {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: scale(1.05);
}

/* Radio */
.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-group label {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  background: var(--card2);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.radio-group input[type="radio"] {
  display: none;
}

.radio-group label.checked {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Progress Bar */
.progress-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* Avatar */
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg3);
  border: 2px solid var(--border);
}

.avatar-lg {
  width: 80px;
  height: 80px;
}

.avatar-xl {
  width: 100px;
  height: 100px;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: linear-gradient(135deg, var(--primary), var(--bg3));
  color: #fff;
  border-radius: 50%;
}

/* User Card for Discover */
.user-card {
  background: var(--card);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.user-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.user-card-info h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}

.user-card-info .city {
  font-size: 12px;
  color: var(--text2);
}

.user-card-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-like {
  flex: 1;
  background: linear-gradient(135deg, #FF6B35, #FF4444);
  color: #fff;
  border: none;
  padding: 13px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.btn-skip {
  flex: 1;
  background: var(--card2);
  color: var(--text2);
  border: 1.5px solid var(--border);
  padding: 13px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 600;
}

/* Match Score */
.match-score {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 4px;
}

.match-score span {
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
}

/* Post Card */
.post-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}

.post-card:active {
  transform: scale(0.99);
}

.post-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.post-card-body {
  padding: 14px 16px;
}

.post-card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text3);
  flex-wrap: wrap;
  margin-top: 8px;
}

.post-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 80px;
  right: calc(50% - 230px);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(255, 107, 53, 0.5);
  cursor: pointer;
  border: none;
  z-index: 50;
  transition: transform 0.2s, box-shadow 0.2s;
}

.fab:active {
  transform: scale(0.93);
}

@media (max-width: 480px) {
  .fab {
    right: 20px;
  }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg2);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--text3);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  /* 背景：底部径向光晕呼应品牌橙 */
  background:
    radial-gradient(ellipse 80% 50% at 50% 110%, rgba(255,107,53,0.12) 0%, transparent 70%),
    linear-gradient(180deg, #111111 0%, #181818 100%);
}

/* 入场动画 */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-logo {
  font-size: 72px;
  margin-bottom: 12px;
  animation: fadeInUp 0.5s ease both;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.login-title {
  font-size: 36px;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 6px;
  letter-spacing: -1px;
  animation: fadeInUp 0.5s 0.1s ease both;
}

.login-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 36px;
  animation: fadeInUp 0.5s 0.15s ease both;
}

.login-form {
  width: 100%;
  max-width: 360px;
  background: rgba(255,255,255,0.04);
  border-radius: 24px;
  padding: 28px 24px;
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  animation: fadeInUp 0.5s 0.2s ease both;
}

/* Profile Page */
.avatar-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.avatar-upload-btn {
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  padding: 6px 16px;
  border: 1px solid var(--primary);
  border-radius: 20px;
  background: transparent;
  transition: all 0.2s;
}

.avatar-upload-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* Checkin Streak */
.streak-banner {
  background: linear-gradient(135deg, rgba(255,107,53,0.2), rgba(255,107,53,0.05));
  border: 1px solid rgba(255,107,53,0.3);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.streak-number {
  font-size: 40px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.streak-label {
  font-size: 14px;
  color: var(--text2);
  font-weight: 500;
}

/* Match Card */
.match-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(255,107,53,0.3);
  box-shadow: 0 2px 12px rgba(255,107,53,0.1);
}

.match-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.match-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 6px;
}

.match-info-row .label {
  color: var(--text3);
  min-width: 50px;
}

.match-info-row .value {
  color: var(--text);
  font-weight: 500;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(28, 28, 30, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  padding: 11px 20px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  z-index: 9999;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  opacity: 0;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success { border-left: 3px solid var(--primary); }
.toast.error   { border-left: 3px solid #FF3B30; }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text3);
  gap: 10px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}

.empty .emoji {
  font-size: 56px;
  margin-bottom: 12px;
}

.empty p {
  font-size: 15px;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Image Preview */
.img-preview {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  max-height: 200px;
  object-fit: cover;
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  color: var(--text3);
  font-size: 13px;
  transition: all 0.2s;
}

.upload-area:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.upload-area input[type="file"] {
  display: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Checkin record */
.checkin-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.checkin-item:last-child {
  border-bottom: none;
}

.checkin-avatar {
  flex-shrink: 0;
}

.checkin-content h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 3px;
}

.checkin-content p {
  font-size: 13px;
  color: var(--text2);
}

.checkin-content .time {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

/* Post detail */
.post-detail-image {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.join-list {
  margin-top: 16px;
}

.join-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

/* Touch target size - 44px minimum for mobile accessibility */
.action-btn,
.comment-send-btn {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* More (⋮) menu button - replaces the old × delete-btn */
.more-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  flex-shrink: 0;
  padding: 0;
  transition: opacity 0.15s;
}
.more-btn:hover {
  opacity: 1;
}

/* Dropdown card menu */
.card-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  min-width: 80px;
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  color: var(--text);
}

.menu-item-danger {
  color: #ff4d4f !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}

.menu-item-danger::before {
  content: "";
  display: block;
  width: 36px;
  height: 36px;
  background: rgba(255, 77, 79, 0.12) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff4d4f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3Crect x='9' y='2' width='6' height='4' rx='1'/%3E%3C/svg%3E") center/18px no-repeat;
  border-radius: 50%;
  flex-shrink: 0;
}

.menu-item:active {
  background: var(--border);
}

/* Util */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text2); }
.text-faint { color: var(--text3); }
.text-primary { color: var(--primary); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

/* Safe Area */
.tab-bar {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body {
  padding-top: env(safe-area-inset-top, 0px);
}

/* Datetime input dark color-scheme */
input[type="datetime-local"] {
  color-scheme: dark;
}
input[type="date"],
input[type="time"] {
  color-scheme: dark;
}

/* Like Heartbeat Animation */
@keyframes likeHeartbeat {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.45); }
  60%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}
.action-btn.liked svg {
  animation: likeHeartbeat 0.45s cubic-bezier(0.17, 0.89, 0.32, 1.49);
}
