/* ============================================================
   Biolink Pro — Public Profile Stylesheet
   Mobile-First · Dark/Light Mode · Glassmorphism · Animations
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Custom Properties (Design Tokens) ─────────────────── */
:root {
  --font: 'Inter', system-ui, -apple-system, sans-serif;

  /* Light mode tokens */
  --bg-from: #f0f4ff;
  --bg-to:   #e8d5f5;
  --surface: rgba(255,255,255,0.7);
  --surface-hover: rgba(255,255,255,0.9);
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: rgba(0,0,0,0.08);
  --shadow: 0 8px 32px rgba(0,0,0,0.1);
  --shadow-hover: 0 16px 48px rgba(0,0,0,0.18);
  --btn-bg: #7c3aed;
  --btn-text: #ffffff;
  --btn-radius: 14px;
  --badge-bg: rgba(124,58,237,0.12);
  --badge-text: #7c3aed;
  --card-radius: 20px;
  --glass: blur(16px) saturate(180%);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-from: #0f0c29;
  --bg-to:   #302b63;
  --surface: rgba(255,255,255,0.06);
  --surface-hover: rgba(255,255,255,0.12);
  --text-primary: #f0f0ff;
  --text-secondary: #a5b4fc;
  --text-muted: #6b7280;
  --border: rgba(255,255,255,0.08);
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-hover: 0 16px 48px rgba(0,0,0,0.6);
  --badge-bg: rgba(124,58,237,0.2);
  --badge-text: #c4b5fd;
}

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-to) 100%);
  background-attachment: fixed;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

/* ── Background Animated Blobs ──────────────────────────────── */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: blobFloat 12s ease-in-out infinite alternate;
}
.bg-blob-1 { width: 500px; height: 500px; background: #7c3aed; top: -150px; left: -100px; animation-delay: 0s; }
.bg-blob-2 { width: 400px; height: 400px; background: #06b6d4; top: 40%; right: -100px; animation-delay: -4s; }
.bg-blob-3 { width: 350px; height: 350px; background: #f59e0b; bottom: -100px; left: 20%; animation-delay: -8s; }

@keyframes blobFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.08); }
}

/* ── Layout Container ────────────────────────────────────────── */
.profile-wrap {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  min-height: 100vh;
}

/* ── Theme Toggle ────────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: 50px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}
.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: var(--shadow-hover);
}

/* ── Profile Header ──────────────────────────────────────────── */
.profile-header {
  text-align: center;
  padding: 40px 0 28px;
  animation: fadeInDown 0.6s ease both;
}

.avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}

.avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(124,58,237,0.5);
  box-shadow: 0 0 0 6px rgba(124,58,237,0.15), var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 8px rgba(124,58,237,0.25), var(--shadow-hover);
}

.avatar-placeholder {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: white;
  border: 3px solid rgba(124,58,237,0.5);
  box-shadow: 0 0 0 6px rgba(124,58,237,0.15), var(--shadow);
  transition: transform var(--transition);
}
.avatar-placeholder:hover { transform: scale(1.05); }

.verified-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: #10b981;
  color: white;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 2px solid var(--bg-from);
  box-shadow: var(--shadow);
}

.profile-name {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.profile-bio {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 360px;
  margin: 0 auto 16px;
  line-height: 1.6;
}

/* ── Social Badges ───────────────────────────────────────────── */
.social-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.social-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--badge-bg);
  color: var(--badge-text);
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
  border: 1px solid var(--border);
}
.social-badge:hover {
  background: var(--btn-bg);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124,58,237,0.4);
}
.social-badge i { font-size: 14px; }

/* ── Links List ──────────────────────────────────────────────── */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

/* ── Link Card ───────────────────────────────────────────────── */
.link-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  text-decoration: none;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  animation: fadeInUp 0.5s ease both;
}

.link-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124,58,237,0.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}
.link-card:hover::before { opacity: 1; }

.link-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-hover);
  border-color: rgba(124,58,237,0.3);
}
.link-card:active { transform: scale(0.98); }

.link-card.has-custom-bg {
  background: var(--card-custom-bg, var(--surface));
  color: #ffffff;
  border-color: transparent;
}
.link-card.has-custom-bg .link-subtitle { color: rgba(255,255,255,0.75); }

/* Ripple effect */
.link-card .ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple-anim 0.6s linear;
  background: rgba(255,255,255,0.25);
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

.link-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(124,58,237,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--btn-bg);
  flex-shrink: 0;
  transition: all var(--transition);
}
.link-card:hover .link-icon-wrap {
  background: var(--btn-bg);
  color: white;
  transform: rotate(-5deg) scale(1.1);
}
.link-card.has-custom-bg .link-icon-wrap {
  background: rgba(255,255,255,0.2);
  color: white;
}

.link-text { flex: 1; min-width: 0; }
.link-title {
  font-size: 0.97rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-arrow {
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition);
}
.link-card:hover .link-arrow {
  transform: translateX(4px);
  color: var(--btn-bg);
}

/* ── Embed Cards ──────────────────────────────────────────────── */
.embed-card {
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.5s ease both;
}

.embed-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.embed-label i { color: var(--btn-bg); }

.embed-frame {
  width: 100%;
  border: none;
  display: block;
  background: #000;
}
.embed-youtube { height: 220px; }
.embed-spotify { height: 380px; border-radius: 0; }
.embed-iframe  { height: 300px; }

/* ── QR Code Section ─────────────────────────────────────────── */
.qr-section {
  text-align: center;
  padding: 28px 20px;
  background: var(--btn-bg) !important;
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  box-shadow: var(--shadow);
  animation: fadeInUp 0.5s ease both;
  margin-top: 4px;
}

.qr-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--btn-text) !important;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.qr-img {
  width: 160px;
  height: 160px;
  border-radius: var(--btn-radius);
  box-shadow: var(--shadow);
  border: 3px solid rgba(255,255,255,0.3);
  transition: transform var(--transition);
  cursor: pointer;
}
.qr-img:hover { transform: scale(1.06); }

.qr-url {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 10px;
  word-break: break-all;
}

/* ── Footer ──────────────────────────────────────────────────── */
.profile-footer {
  text-align: center;
  padding: 30px 0 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  animation: fadeIn 1s ease both;
}
.profile-footer a { color: var(--badge-text); text-decoration: none; }

/* ── Stats Strip ─────────────────────────────────────────────── */
.stats-strip {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px 20px;
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: 50px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  animation: fadeInDown 0.6s ease 0.2s both;
}
.stat-item { text-align: center; }
.stat-value { font-size: 1.1rem; font-weight: 800; color: var(--btn-bg); }
.stat-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Staggered link animations */
.links-list .link-card:nth-child(1)  { animation-delay: 0.05s; }
.links-list .link-card:nth-child(2)  { animation-delay: 0.10s; }
.links-list .link-card:nth-child(3)  { animation-delay: 0.15s; }
.links-list .link-card:nth-child(4)  { animation-delay: 0.20s; }
.links-list .link-card:nth-child(5)  { animation-delay: 0.25s; }
.links-list .link-card:nth-child(6)  { animation-delay: 0.30s; }
.links-list .link-card:nth-child(7)  { animation-delay: 0.35s; }
.links-list .link-card:nth-child(8)  { animation-delay: 0.40s; }
.links-list .link-card:nth-child(9)  { animation-delay: 0.45s; }
.links-list .link-card:nth-child(10) { animation-delay: 0.50s; }
.links-list .embed-card:nth-child(4) { animation-delay: 0.20s; }
.links-list .embed-card:nth-child(5) { animation-delay: 0.25s; }

/* ── Toast Notification ──────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(30,30,50,0.95);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .profile-wrap { padding: 24px 14px 60px; }
  .profile-name { font-size: 1.4rem; }
  .avatar, .avatar-placeholder { width: 88px; height: 88px; }
  .stats-strip { gap: 16px; padding: 12px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
