/* ================================================
   SportHub — Profile & User Styles
   Profile, Achievements, Badges, User Cards
   ================================================ */

/* ─── Universal User Capsule Tags ─── */
.user-capsule {
  display: inline-block;
  padding: .25rem .65rem;
  border-radius: var(--radius-full);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.4;
}
.user-capsule:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}
/* Role-based capsule colors */
.uc-user { background: var(--bg-elevated); color: var(--text-secondary); border-color: var(--border); }
.uc-coach { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.uc-captain { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.uc-venue_owner { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
.uc-admin { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.uc-super_admin { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
/* Dark theme adjustments */
[data-theme="dark"] .uc-user { background: var(--bg-elevated); color: var(--text-secondary); border-color: var(--border); }
[data-theme="dark"] .uc-coach { background: rgba(251,191,36,.20); color: #fcd34d; border-color: rgba(251,191,36,.4); }
[data-theme="dark"] .uc-captain { background: rgba(139,92,246,.20); color: #c4b5fd; border-color: rgba(139,92,246,.4); }
[data-theme="dark"] .uc-venue_owner { background: rgba(217,119,6,.20); color: #fbbf24; border-color: rgba(217,119,6,.4); }
[data-theme="dark"] .uc-admin { background: rgba(59,130,246,.20); color: #93bbfc; border-color: rgba(59,130,246,.4); }
[data-theme="dark"] .uc-super_admin { background: rgba(239,68,68,.20); color: #fca5a5; border-color: rgba(239,68,68,.4); }
/* Capsule inside leaderboard / admin - smaller variant */
.lb-name .user-capsule, .admin-user-name .user-capsule { font-size: .75rem; padding: .15rem .5rem; }
.td-member-name .user-capsule { font-size: .75rem; padding: .15rem .5rem; }
.td-card-value .user-capsule { font-size: .75rem; padding: .15rem .45rem; }
.tc-info-row .user-capsule { font-size: .72rem; padding: .12rem .4rem; }

/* ─── Profile ─── */
.profile-header { text-align: center; padding: 1.5rem 1rem .5rem; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #0d9488); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.5rem; font-weight: 800; margin: 0 auto .6rem; border: 3px solid var(--bg-card); box-shadow: 0 0 0 3px var(--accent); }
.profile-avatar.small { width: 40px; height: 40px; font-size: .9rem; margin: 0; box-shadow: none; border: none; }
.profile-title { font-weight: 700; font-size: 1rem; margin-bottom: .4rem; line-height: 1.5; }
/* Title Tags (稱號樣式) */
.title-tag { display: inline-block; font-size: .72em; font-weight: 700; padding: .12em .4em; border-radius: .3rem; vertical-align: baseline; letter-spacing: .3px; }
.title-gold { background: linear-gradient(135deg, #fbbf24, #d4a017); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.15); }
.title-normal { background: linear-gradient(135deg, #a8a29e, #78716c); color: #fff; }
.title-dot { color: var(--text-muted); margin: 0 .15em; font-weight: 400; font-size: .85em; }
[data-theme="dark"] .title-gold { background: linear-gradient(135deg, #f59e0b, #b45309); }
[data-theme="dark"] .title-normal { background: linear-gradient(135deg, #78716c, #57534e); }
.profile-level { display: flex; align-items: center; gap: .5rem; justify-content: center; font-size: .78rem; color: var(--text-secondary); }
.exp-bar { flex: 1; max-width: 140px; height: 8px; background: var(--bg-elevated); border-radius: 4px; overflow: hidden; }
.exp-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #6ee7b7); border-radius: 4px; transition: width .5s ease; }
.exp-text { font-size: .7rem; color: var(--text-muted); }

/* ─── Profile Stats ─── */
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; padding: .5rem .5rem 0; margin-bottom: .25rem; }
.stat-item { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .5rem .3rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.stat-num { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--accent); }
.stat-label { font-size: .65rem; color: var(--text-muted); font-weight: 500; }

/* ─── Quick Grid ─── */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; padding: .5rem; margin-bottom: .5rem; }
.quick-item { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .65rem .3rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); font-size: .73rem; font-weight: 500; color: var(--text-secondary); transition: all var(--transition); }
.quick-item span { font-size: 1.3rem; }
.quick-item:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.quick-item.disabled { opacity: 0.4; cursor: not-allowed; background: var(--bg-elevated); pointer-events: none; }
.quick-item.disabled span { filter: grayscale(100%); }

/* ─── Social Grid ─── */
.social-grid { display: flex; justify-content: center; gap: .65rem; padding: 0 .5rem .5rem; margin-bottom: .5rem; }
.social-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
  flex-shrink: 0;
}
.social-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
a.social-btn { text-decoration: none; }
.social-btn.active { border-style: solid; border-color: currentColor; }
.social-btn.active[data-platform="fb"] { color: #1877F2; background: rgba(24,119,242,.08); }
.social-btn.active[data-platform="ig"] { color: #E4405F; background: rgba(228,64,95,.08); }
.social-btn.active[data-platform="threads"] { color: #000000; background: rgba(0,0,0,.06); }
.social-btn.active[data-platform="yt"] { color: #FF0000; background: rgba(255,0,0,.08); }
.social-btn.active[data-platform="twitter"] { color: #000000; background: rgba(0,0,0,.06); }
[data-theme="dark"] .social-btn.active[data-platform="threads"] { color: #ffffff; background: rgba(255,255,255,.1); }
[data-theme="dark"] .social-btn.active[data-platform="twitter"] { color: #ffffff; background: rgba(255,255,255,.1); }
.social-copy-btn {
  width: 22px; height: 22px; border: none; border-radius: 50%;
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0; transition: all .15s;
}
.social-copy-btn:hover { color: var(--accent); background: var(--bg-elevated); }

/* Social Link Modal URL prefix */
.social-url-row { display: flex; align-items: center; gap: 0; }
.social-url-prefix {
  font-size: .75rem; color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  padding: .55rem .5rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.social-url-row input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  flex: 1;
  min-width: 0;
}

/* ─── QR Code Page ─── */
.center-content { display: flex; flex-direction: column; align-items: center; padding: 2rem 1rem; }
.qr-placeholder { text-align: center; }
.qr-box { width: 180px; height: 180px; background: #fff; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: #333; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; margin: 0 auto 1rem; border: 3px solid var(--accent); }
.uid-text { font-family: monospace; color: var(--text-secondary); font-size: .85rem; margin-bottom: .3rem; }
.qr-hint { font-size: .78rem; color: var(--text-muted); }

/* ─── (Paper Doll removed) ─── */

/* ─── Achievement Card Grid (合併成就+徽章) ─── */
.ach-section-title { font-size: .78rem; font-weight: 700; color: var(--text-secondary); padding: .5rem .5rem .25rem; }
.ach-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; padding: 0 .5rem .5rem; }
.ach-card { background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius); padding: .6rem; display: flex; gap: .5rem; align-items: flex-start; transition: all var(--transition); }
.ach-card:hover { box-shadow: var(--shadow); }
.ach-card-badge { width: 50px; height: 50px; flex-shrink: 0; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: var(--bg-elevated); overflow: hidden; position: relative; border: 2px dashed var(--border); }
.ach-card-badge img { width: 100%; height: 100%; object-fit: cover; }
.ach-badge-gray { filter: grayscale(100%); opacity: .5; }
.ach-card-done-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); color: #fff; font-size: .6rem; font-weight: 700; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }
.ach-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.ach-card-top { display: flex; align-items: center; gap: .3rem; }
.ach-card-name { font-size: .8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-card-desc { font-size: .7rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-card-progress { display: flex; align-items: center; gap: .4rem; }
.ach-card-num { font-size: .68rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.ach-card-completed-date { font-size: .65rem; color: var(--success); font-weight: 600; }
.ach-card-done { border-style: solid; }

/* ─── Badge Showcase (top of achievements page) ─── */
.ach-badge-showcase { display: flex; gap: .6rem; padding: 0 .5rem .3rem; flex-wrap: wrap; justify-content: center; }
.ach-showcase-item { display: flex; flex-direction: column; align-items: center; gap: .25rem; width: 60px; }
.ach-showcase-img { width: 50px; height: 50px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ach-showcase-img img { width: 100%; height: 100%; object-fit: cover; }
.ach-showcase-img span { font-size: 1.3rem; }
.ach-showcase-name { font-size: .62rem; font-weight: 600; text-align: center; color: var(--text-secondary); line-height: 1.2; word-break: break-all; }

/* ─── Achievement Divider ─── */
.ach-divider { height: 1px; background: var(--border); margin: .4rem .5rem; }

/* ─── Shared Achievement Elements ─── */
.ach-cat-chip { flex-shrink: 0; font-size: .62rem; font-weight: 700; color: #fff; width: 1.5rem; height: 1.5rem; border-radius: .35rem; display: flex; align-items: center; justify-content: center; }
.ach-cat-gold { background: #d4a017; }
.ach-cat-silver { background: #9ca3af; }
.ach-cat-bronze { background: #b87333; }
.ach-bar-mini { flex: 1; min-width: 40px; max-width: 100px; height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.ach-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #3b82f6, #60a5fa); transition: width .4s ease; }
.ach-cat-tag { font-size: .65rem; font-weight: 700; color: #fff; padding: .12rem .4rem; border-radius: var(--radius-full); flex-shrink: 0; }
.ach-progress-bar-wrap { width: 100%; height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.ach-progress-bar { height: 100%; border-radius: 3px; transition: width .4s ease; }

/* ─── Badge Placeholder (admin) ─── */
.badge-img-placeholder { width: 56px; height: 56px; margin: 0 auto .4rem; border: 2px dashed var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: var(--bg-elevated); overflow: hidden; }
.badge-img-placeholder img { width: 100%; height: 100%; object-fit: cover; }
.badge-img-placeholder.small { width: 36px; height: 36px; margin: 0; }

/* ─── Achievement Mini Tag ─── */
.ach-mini { display: inline-block; padding: .2rem .55rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-full); font-size: .72rem; font-weight: 500; color: var(--text-secondary); }

/* ─── Title Config ─── */
.title-config { padding: .5rem; }
.title-preview { text-align: center; font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; padding: 1rem; margin-bottom: 1rem; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); color: var(--accent); }
.title-row { margin-bottom: .75rem; }
.title-row label { display: block; font-size: .78rem; color: var(--text-muted); margin-bottom: .3rem; font-weight: 600; }

/* ─── User Card Full ─── */
.user-card-full { padding: .5rem; }
.uc-header { text-align: center; padding: 1.5rem 0 1rem; }
/* .uc-doll-frame removed */
.uc-badge-list { display: flex; gap: .6rem; flex-wrap: wrap; }
.uc-badge-item { display: flex; flex-direction: column; align-items: center; gap: .25rem; width: 60px; }
.uc-badge-item .badge-img-placeholder { width: 44px; height: 44px; margin: 0; border: none; background: none; }
.uc-badge-name { font-size: .65rem; font-weight: 600; text-align: center; color: var(--text-secondary); line-height: 1.2; }

/* ─── User Card: Avatar centered ─── */
.uc-avatar-circle {
  width: 90px; height: 90px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #0d9488);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.8rem; font-weight: 800;
  border: 3px solid var(--bg-card); box-shadow: 0 0 0 3px var(--accent);
  flex-shrink: 0; overflow: hidden;
}
.uc-avatar-circle img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.uc-role-tag { display: inline-block; font-size: .7rem; padding: .15rem .5rem; border-radius: var(--radius-full); font-weight: 600; }
.uc-team-link {
  color: var(--accent); cursor: pointer; text-decoration: underline;
}
.profile-edit-input {
  flex: 1; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--text-primary); font-size: .82rem;
  max-width: 180px;
}

/* ─── LINE Notify Card ─── */
.line-notify-status { font-size:.68rem; padding:.15rem .5rem; border-radius:var(--radius-full); font-weight:600; }
.line-notify-status.bound { background:rgba(6,199,85,.15); color:#06C755; }
.line-notify-status.unbound { background:var(--bg-elevated); color:var(--text-muted); }
.line-notify-empty { text-align:center; padding:1.2rem 0 .8rem; color:var(--text-muted); font-size:.82rem; line-height:1.7; }
.line-notify-row { display:flex; justify-content:space-between; align-items:center; padding:.4rem 0; font-size:.82rem; }
.line-notify-sub { font-size:.68rem; color:var(--text-muted); font-weight:400; display:block; }
/* Bind/unbind state transition animation */
#line-notify-bound.fadeIn, #line-notify-unbound.fadeIn { animation: fadeIn .35s ease; }
/* Login button loading state */
.line-login-btn.loading { opacity:.6; pointer-events:none; position:relative; }
.line-login-btn.loading::after { content:''; width:14px; height:14px; border:2px solid #fff; border-top-color:transparent; border-radius:50%; animation:spin .6s linear infinite; display:inline-block; vertical-align:middle; margin-left:.4rem; }
@keyframes spin { to { transform:rotate(360deg); } }

/* Dark theme */
[data-theme="dark"] .line-notify-status.bound { background:rgba(6,199,85,.2); color:#4ade80; }
[data-theme="dark"] .line-notify-status.unbound { background:rgba(255,255,255,.08); color:var(--text-muted); }
[data-theme="dark"] .ach-card-completed-date { color: #4ade80; }

/* ─── Favorite Heart Button ─── */
.fav-heart {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; padding: .15rem;
  vertical-align: middle; transition: transform .2s;
}
.fav-heart:hover { transform: scale(1.2); }
.fav-heart.active svg { filter: drop-shadow(0 1px 3px rgba(239,68,68,.3)); }
/* ─── Favorites List Items (compact one-row) ─── */
.fav-item {
  display: flex; align-items: center; gap: .4rem;
  padding: .4rem .2rem; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.fav-item:last-child { border-bottom: none; }
.fav-item:hover { background: var(--accent-bg); }
.fav-item-name { flex: 1; min-width: 0; font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: var(--text-primary); }
.fav-item-name:hover { color: var(--accent); }
.fav-item-date { font-size: .7rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.fav-remove-btn {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border: none; border-radius: 50%;
  background: transparent; color: var(--text-muted); cursor: pointer;
  flex-shrink: 0; transition: all .15s; padding: 0;
}
.fav-remove-btn:hover { background: rgba(239,68,68,.12); color: var(--danger); }
.fav-count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 .35rem; border-radius: 10px; background: var(--accent-bg); color: var(--accent); font-size: .7rem; font-weight: 700; }

/* ─── Profile Collapse Toggle (收折) ─── */
.profile-collapse-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.profile-collapse-arrow {
  font-size: .7rem;
  transition: transform .25s;
  color: var(--text-muted);
}
.profile-collapse-toggle.open .profile-collapse-arrow {
  transform: rotate(90deg);
}
.profile-collapse-content {
  padding-top: .4rem;
}
