/* Profile Card Visual Enhancements */

/* Enhanced card hover effects */
.card.card-talent,
.card.card-troupe,
.card.card-organization {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.card.card-talent:hover,
.card.card-troupe:hover,
.card.card-organization:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Profile page header enhancement */
[data-route="talent-profile"] .card:first-child,
[data-route="troupe-profile"] .card:first-child,
[data-route="organization-profile"] .card:first-child {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Contribution badge styling */
.contribution-badge {
  animation: badgeFadeIn 0.4s ease-out;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

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

/* Skill tags enhancement */
.card .text-xs[class*="text-white/40"],
.card .text-xs[class*="text-white/60"] {
  letter-spacing: 0.02em;
}

/* Avatar glow effect on profile pages */
[data-route="talent-profile"] .rounded-full,
[data-route="troupe-profile"] .rounded-full,
[data-route="organization-profile"] .rounded-full {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* Card border accent */
.card.card-talent {
  border-left: 3px solid rgba(52, 211, 153, 0.5);
}

.card.card-troupe {
  border-left: 3px solid rgba(59, 130, 246, 0.5);
}

.card.card-organization {
  border-left: 3px solid rgba(168, 85, 247, 0.5);
}

/* Section headings in profile */
[data-route="talent-profile"] h2,
[data-route="troupe-profile"] h2,
[data-route="organization-profile"] h2 {
  position: relative;
  padding-left: 12px;
}

[data-route="talent-profile"] h2::before,
[data-route="troupe-profile"] h2::before,
[data-route="organization-profile"] h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 70%;
  border-radius: 2px;
  background: linear-gradient(180deg, #6366f1, #a855f7);
}

/* Portfolio / video link styling */
.card a[href*="youtube"],
.card a[href*="vimeo"],
.card a[href*="bilibili"] {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.08);
  transition: background 0.2s;
}

.card a[href*="youtube"]:hover,
.card a[href*="vimeo"]:hover,
.card a[href*="bilibili"]:hover {
  background: rgba(99, 102, 241, 0.15);
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  .card.card-talent,
  .card.card-troupe {
    max-width: 85vw;
  }
  
  .contribution-badge {
    font-size: 11px !important;
    padding: 3px 10px !important;
  }
}

/* ========================================
   Profile Page UI Enhancements — v2
   響應式改進 / 動畫效果 / 深色模式 / 作品集美化
   ======================================== */

/* ── 1. 響應式改進 ─────────────────────────── */

/* 手機端名片頁：頭像和名字居中 */
@media (max-width: 640px) {
  [data-route="talent-profile"] .card:first-child,
  [data-route="troupe-profile"] .card:first-child,
  [data-route="organization-profile"] .card:first-child {
    text-align: center;
  }

  [data-route="talent-profile"] .card:first-child .rounded-full,
  [data-route="troupe-profile"] .card:first-child .rounded-full,
  [data-route="organization-profile"] .card:first-child .rounded-full {
    margin: 0 auto;
  }

  [data-route="talent-profile"] .card:first-child h1,
  [data-route="talent-profile"] .card:first-child h2,
  [data-route="troupe-profile"] .card:first-child h1,
  [data-route="troupe-profile"] .card:first-child h2,
  [data-route="organization-profile"] .card:first-child h1,
  [data-route="organization-profile"] .card:first-child h2 {
    text-align: center;
  }

  /* 技能標籤在小屏幕上自動換行 */
  [data-route="talent-profile"] .flex.flex-wrap,
  [data-route="troupe-profile"] .flex.flex-wrap,
  [data-route="organization-profile"] .flex.flex-wrap {
    justify-content: center;
  }

  [data-route="talent-profile"] .skill-tag,
  [data-route="troupe-profile"] .skill-tag,
  [data-route="organization-profile"] .skill-tag {
    white-space: normal;
    word-break: break-word;
  }

  /* 影片/作品卡片在手機端全寬 */
  [data-route="talent-profile"] .card a[href*="youtube"],
  [data-route="talent-profile"] .card a[href*="vimeo"],
  [data-route="talent-profile"] .card a[href*="bilibili"],
  [data-route="troupe-profile"] .card a[href*="youtube"],
  [data-route="troupe-profile"] .card a[href*="vimeo"],
  [data-route="troupe-profile"] .card a[href*="bilibili"],
  [data-route="organization-profile"] .card a[href*="youtube"],
  [data-route="organization-profile"] .card a[href*="vimeo"],
  [data-route="organization-profile"] .card a[href*="bilibili"] {
    display: block;
    width: 100%;
  }

  /* 作品集卡片全寬 */
  [data-route="talent-profile"] .grid,
  [data-route="troupe-profile"] .grid,
  [data-route="organization-profile"] .grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── 2. 動畫效果 ───────────────────────────── */

/* 頁面載入時卡片淡入效果 (fade in + slide up) */
@keyframes profileCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

[data-route="talent-profile"] .card,
[data-route="troupe-profile"] .card,
[data-route="organization-profile"] .card {
  animation: profileCardFadeIn 0.5s ease-out both;
}

/* 逐張卡片延遲載入 */
[data-route="talent-profile"] .card:nth-child(1),
[data-route="troupe-profile"] .card:nth-child(1),
[data-route="organization-profile"] .card:nth-child(1) { animation-delay: 0.05s; }
[data-route="talent-profile"] .card:nth-child(2),
[data-route="troupe-profile"] .card:nth-child(2),
[data-route="organization-profile"] .card:nth-child(2) { animation-delay: 0.15s; }
[data-route="talent-profile"] .card:nth-child(3),
[data-route="troupe-profile"] .card:nth-child(3),
[data-route="organization-profile"] .card:nth-child(3) { animation-delay: 0.25s; }
[data-route="talent-profile"] .card:nth-child(4),
[data-route="troupe-profile"] .card:nth-child(4),
[data-route="organization-profile"] .card:nth-child(4) { animation-delay: 0.35s; }
[data-route="talent-profile"] .card:nth-child(n+5),
[data-route="troupe-profile"] .card:nth-child(n+5),
[data-route="organization-profile"] .card:nth-child(n+5) { animation-delay: 0.45s; }

/* 等級徽章脈動效果 */
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
}

.contribution-badge {
  animation: badgeFadeIn 0.4s ease-out, badgePulse 2.5s ease-in-out infinite;
}

.contribution-badge:hover {
  animation-play-state: paused;
  transform: scale(1.05);
  transition: transform 0.2s ease;
}

/* 技能標籤 hover 微彈效果 */
[data-route="talent-profile"] .skill-tag,
[data-route="troupe-profile"] .skill-tag,
[data-route="organization-profile"] .skill-tag,
[data-route="talent-profile"] .cat-tag,
[data-route="troupe-profile"] .cat-tag,
[data-route="organization-profile"] .cat-tag {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s, border-color 0.2s;
}

[data-route="talent-profile"] .skill-tag:hover,
[data-route="troupe-profile"] .skill-tag:hover,
[data-route="organization-profile"] .skill-tag:hover,
[data-route="talent-profile"] .cat-tag:hover,
[data-route="troupe-profile"] .cat-tag:hover,
[data-route="organization-profile"] .cat-tag:hover {
  transform: scale(1.08);
}

/* ── 3. 深色模式適配 ────────────────────────── */

/* 如果頁面有深色模式（body 或 html 帶 dark class） */
html.dark [data-route="talent-profile"] .card,
html.dark [data-route="troupe-profile"] .card,
html.dark [data-route="organization-profile"] .card,
body.dark [data-route="talent-profile"] .card,
body.dark [data-route="troupe-profile"] .card,
body.dark [data-route="organization-profile"] .card {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
}

html.dark [data-route="talent-profile"] .card:hover,
html.dark [data-route="troupe-profile"] .card:hover,
html.dark [data-route="organization-profile"] .card:hover,
body.dark [data-route="talent-profile"] .card:hover,
body.dark [data-route="troupe-profile"] .card:hover,
body.dark [data-route="organization-profile"] .card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

html.dark [data-route="talent-profile"] h1,
html.dark [data-route="talent-profile"] h2,
html.dark [data-route="troupe-profile"] h1,
html.dark [data-route="troupe-profile"] h2,
html.dark [data-route="organization-profile"] h1,
html.dark [data-route="organization-profile"] h2,
body.dark [data-route="talent-profile"] h1,
body.dark [data-route="talent-profile"] h2,
body.dark [data-route="troupe-profile"] h1,
body.dark [data-route="troupe-profile"] h2,
body.dark [data-route="organization-profile"] h1,
body.dark [data-route="organization-profile"] h2 {
  color: #f1f5f9;
}

html.dark [data-route="talent-profile"] .skill-tag,
html.dark [data-route="troupe-profile"] .skill-tag,
html.dark [data-route="organization-profile"] .skill-tag,
body.dark [data-route="talent-profile"] .skill-tag,
body.dark [data-route="troupe-profile"] .skill-tag,
body.dark [data-route="organization-profile"] .skill-tag {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.12);
}

html.dark .contribution-badge,
body.dark .contribution-badge {
  background: rgba(30, 41, 59, 0.9) !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

html.dark [data-route="talent-profile"] .card a[href*="youtube"],
html.dark [data-route="talent-profile"] .card a[href*="vimeo"],
html.dark [data-route="talent-profile"] .card a[href*="bilibili"],
html.dark [data-route="troupe-profile"] .card a[href*="youtube"],
html.dark [data-route="troupe-profile"] .card a[href*="vimeo"],
html.dark [data-route="troupe-profile"] .card a[href*="bilibili"],
html.dark [data-route="organization-profile"] .card a[href*="youtube"],
html.dark [data-route="organization-profile"] .card a[href*="vimeo"],
html.dark [data-route="organization-profile"] .card a[href*="bilibili"],
body.dark [data-route="talent-profile"] .card a[href*="youtube"],
body.dark [data-route="talent-profile"] .card a[href*="vimeo"],
body.dark [data-route="talent-profile"] .card a[href*="bilibili"],
body.dark [data-route="troupe-profile"] .card a[href*="youtube"],
body.dark [data-route="troupe-profile"] .card a[href*="vimeo"],
body.dark [data-route="troupe-profile"] .card a[href*="bilibili"],
body.dark [data-route="organization-profile"] .card a[href*="youtube"],
body.dark [data-route="organization-profile"] .card a[href*="vimeo"],
body.dark [data-route="organization-profile"] .card a[href*="bilibili"] {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

/* ── 4. 作品集區域美化 ─────────────────────── */

/* 作品卡片 hover 放大效果 */
[data-route="talent-profile"] .card img,
[data-route="troupe-profile"] .card img,
[data-route="organization-profile"] .card img {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-route="talent-profile"] .card:hover img,
[data-route="troupe-profile"] .card:hover img,
[data-route="organization-profile"] .card:hover img {
  transform: scale(1.03);
}

/* 作品描述區域：漸變遮罩 + 截斷 */
.uq-portfolio-desc {
  position: relative;
  max-height: 4.5em;
  overflow: hidden;
  line-height: 1.5em;
}

.uq-portfolio-desc::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2em;
  background: linear-gradient(transparent, rgba(10, 22, 40, 0.95));
  pointer-events: none;
}

.uq-portfolio-desc.expanded {
  max-height: none;
}

.uq-portfolio-desc.expanded::after {
  display: none;
}

/* 「查看更多」按鈕 */
.uq-read-more-btn {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  font-size: 12px;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.uq-read-more-btn:hover {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
}

/* ── 5. 社交分享浮動按鈕樣式 ───────────────── */

#uq-social-share-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
}

.uq-share-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.uq-share-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.55);
}

.uq-share-menu {
  position: absolute;
  bottom: 62px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 12px;
  min-width: 160px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: shareMenuIn 0.25s ease-out;
}

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

.uq-share-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.uq-share-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.uq-share-item svg {
  flex-shrink: 0;
}

/* 手機端分享按鈕位置調整 */
@media (max-width: 640px) {
  #uq-social-share-panel {
    bottom: 16px;
    right: 16px;
  }

  .uq-share-fab {
    width: 46px;
    height: 46px;
  }

  .uq-share-menu {
    bottom: 56px;
    right: -8px;
    min-width: 150px;
  }
}
