/* ==============================================
   MAIN.CSS — Ultra Premium Linktree Clone
   "Cloud Sky" aesthetic: Light Glassmorphism, Animated Mesh Gradients
================================================ */

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

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

:root {
  /* Colors (Fallback, overridden by inline PHP in index.php) */
  --primary:      #0ea5e9; /* Sky Blue */
  --accent2:      #38bdf8; /* Lighter Blue */
  --accent3:      #bae6fd; /* Soft Blue/White */
  --bg-deep:      #f0f9ff; /* Ultra light sky background */

  /* Derived Variables for Light Mode */
  --text-main:    #0f172a; /* Dark slate */
  --text-muted:   #475569; /* Medium slate */
  --text-faint:   #94a3b8; /* Light slate */
  
  /* Frosted White Glass */
  --card-bg:      rgba(255, 255, 255, 0.65);
  --card-border:  rgba(255, 255, 255, 1);
  --card-hover:   rgba(255, 255, 255, 0.85);
  
  --font-display: 'Outfit', sans-serif;
  --font-sans:    'Inter', sans-serif;
  
  --spring:       cubic-bezier(0.175, 0.885, 0.32, 1.15);
  --smooth:       cubic-bezier(0.4, 0, 0.2, 1);
}

html { 
  scroll-behavior: smooth; 
  font-size: 16px; 
}

body {
  font-family: var(--font-sans);
  /* Replace flat color with a rich mixed pastel gradient */
  background: linear-gradient(135deg, #e0f2fe 0%, #f3e8ff 50%, #ffe4e6 100%);
  color: var(--text-main);
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── BACKGROUND FX (Living Clouds & Sky) ─── */
.bg-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.3; /* Slightly more visible texture */
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px); /* Larger blur for smoother mixing */
  pointer-events: none;
  z-index: -2;
  opacity: 0.85;
  animation: floatClouds 25s ease-in-out infinite alternate;
}

/* Cloud 1 - Vibrant Sky Blue */
.orb-1 {
  width: 50vw; height: 50vh;
  min-width: 600px; min-height: 600px;
  background: radial-gradient(circle, #0ea5e9, transparent 70%);
  top: -10%; left: -10%;
}

/* Cloud 2 - Warm Sunrise Peach/Orange */
.orb-2 {
  width: 60vw; height: 60vh;
  min-width: 650px; min-height: 650px;
  background: radial-gradient(circle, #fda4af, transparent 70%);
  bottom: -15%; right: -10%;
  animation-delay: -7s;
  animation-duration: 32s;
}

/* Cloud 3 - Soft Violet/Purple */
.orb-3 {
  width: 45vw; height: 45vh;
  min-width: 500px; min-height: 500px;
  background: radial-gradient(circle, #c084fc, transparent 70%);
  top: 40%; left: 10%;
  opacity: 0.7;
  animation-delay: -12s;
  animation-duration: 28s;
}

/* Cloud 4 - Bright Yellow/Gold for Sun touch */
.orb-4 {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: -2;
  width: 40vw; height: 40vh;
  min-width: 450px; min-height: 450px;
  background: radial-gradient(circle, #fde047, transparent 70%);
  top: 10%; right: 10%;
  opacity: 0.6;
  animation: floatClouds 20s ease-in-out infinite alternate-reverse;
}

@keyframes floatClouds {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  33%  { transform: translate(60px, -40px) scale(1.15) rotate(5deg); }
  66%  { transform: translate(-40px, 50px) scale(0.9) rotate(-5deg); }
  100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

/* Lively Canvas Animation */
#particleCanvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.8; /* Make it visible */
}

.grid-overlay { display: none; }

/* ─── MAIN CONTAINER ─── */
.container {
  position: relative;
  z-index: 10;
  max-width: 640px;
  margin: 0 auto;
  padding: 80px 24px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
}

/* =========================================
   PROFILE SECTION
========================================= */
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: slideUpFade 1s var(--smooth) both;
}

/* Avatar Premium Look */
.avatar-wrapper {
  position: relative;
  width: 124px;
  height: 124px;
  margin-bottom: 8px;
  border-radius: 50%;
  padding: 5px;
  background: linear-gradient(135deg, #fff, var(--accent3));
  box-shadow: 0 10px 40px rgba(14, 165, 233, 0.25);
  transition: transform 0.5s var(--spring), box-shadow 0.5s var(--smooth);
  cursor: pointer;
}

.avatar-wrapper::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--primary), transparent 30%, #fbcfe8, transparent 70%, var(--primary));
  z-index: -1;
  animation: spin 5s linear infinite;
  opacity: 0.6;
  filter: blur(14px);
}

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

.avatar-wrapper:hover {
  transform: scale(1.08) translateY(-6px);
  box-shadow: 0 20px 50px rgba(14, 165, 233, 0.4);
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  background-color: #fff;
}

.status-dot {
  position: absolute;
  bottom: 8px; right: 8px;
  width: 18px; height: 18px;
  background: #10b981;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 10px rgba(16,185,129,0.3);
}

/* Text */
.name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.username {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #0f172a 30%, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.verified-badge {
  color: #3b82f6; /* Blue check for light mode */
  display: flex;
  align-items: center;
}
.verified-badge svg { width: 24px; height: 24px; filter: drop-shadow(0 2px 4px rgba(59,130,246,0.3)); }

.handle {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.location-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 99px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
.location-tag svg { width: 14px; height: 14px; }

.bio {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  max-width: 420px;
  margin-top: 4px;
}

/* Social Row (Magnetic) */
.social-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}
.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  text-decoration: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  transition: all 0.3s var(--spring);
  position: relative;
  overflow: hidden;
}
.social-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}
.social-icon svg { 
  width: 22px; height: 22px; 
  transition: transform 0.3s var(--spring);
}
.social-icon:hover {
  transform: translateY(-5px) scale(1.1);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 10px 25px rgba(14, 165, 233, 0.3);
}
.social-icon:hover::before { opacity: 1; }
.social-icon:hover svg { transform: scale(1.1); }

/* =========================================
   LINKS SECTION (Spotlight Cards)
========================================= */
.links-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.link-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border-radius: 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  text-decoration: none;
  color: var(--text-main);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.04), inset 0 0 0 1px rgba(255,255,255,0.5);
  overflow: hidden;
  transition: transform 0.3s var(--spring), box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  
  --i: 0;
  animation: slideUpFade 0.6s var(--smooth) calc(0.2s + var(--i)*0.08s) both;
}

.link-card[data-delay="0"] { --i: 0; }
.link-card[data-delay="1"] { --i: 1; }
.link-card[data-delay="2"] { --i: 2; }
.link-card[data-delay="3"] { --i: 3; }
.link-card[data-delay="4"] { --i: 4; }
.link-card[data-delay="5"] { --i: 5; }
.link-card[data-delay="6"] { --i: 6; }
.link-card[data-delay="7"] { --i: 7; }

/* Spotlight effect applied via JS to this pseudo-element */
.link-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  /* Light mode spotlight is a soft white/blue glow */
  background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(255,255,255,0.8), transparent 40%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 1;
}

/* Shimmer / Sweep effect across the card on hover */
.link-card::after {
  content: "";
  position: absolute;
  top: 0; left: -150%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-20deg);
  transition: all 0.7s ease;
  z-index: 1;
  pointer-events: none;
}
.link-card:hover::after {
  left: 150%;
}

.link-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 20px 40px rgba(14,165,233,0.15), inset 0 0 0 2px #fff;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.95); /* Brighter glass on hover */
}
.link-card:hover::before { opacity: 1; }
.link-card:active { transform: scale(0.98); }

/* Icon wrap inside card */
.link-icon-wrap {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  transition: transform 0.4s var(--spring);
  position: relative;
  z-index: 2;
}
.link-icon-wrap svg {
  width: 26px; height: 26px;
  color: #fff;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.link-card:hover .link-icon-wrap {
  transform: scale(1.15) rotate(8deg);
}

/* Link Text */
.link-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  z-index: 2;
}
.link-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}
.link-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Link Meta */
.link-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 2;
}
.link-clicks {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(14,165,233,0.1);
  padding: 4px 10px;
  border-radius: 99px;
  backdrop-filter: blur(4px);
}
.link-arrow {
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--card-border);
  transition: all 0.3s var(--spring);
}
.link-arrow svg { width: 18px; height: 18px; }
.link-card:hover .link-arrow {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  transform: translateX(4px) scale(1.1);
  box-shadow: 0 8px 20px rgba(14,165,233,0.3);
}

/* Clean up old shine elements */
.link-shine, .link-glow { display: none; }
.section-label { display: none; }

/* =========================================
   STATS ROW (Sleek Glass Look)
========================================= */
.stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 28px 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.04), inset 0 0 0 1px rgba(255,255,255,0.5);
  animation: slideUpFade 0.8s var(--smooth) 0.8s both;
}
.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.3s var(--spring);
}
.stat-item:hover { transform: translateY(-4px); }
.stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.stat-divider {
  width: 1px;
  height: 50px;
  background: rgba(0,0,0,0.08);
}

/* =========================================
   FOOTER
========================================= */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  animation: slideUpFade 1s var(--smooth) 1s both;
  font-weight: 600;
}
.heart {
  display: inline-block;
  color: #f43f5e;
  animation: heartBeat 2s infinite;
}
@keyframes heartBeat {
  0%,100% { transform: scale(1); }
  10%,30% { transform: scale(1.15); }
  20%     { transform: scale(1); }
}
.footer-admin-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s;
}
.footer-admin-link:hover { color: #0284c7; }

/* =========================================
   ANIMATIONS
========================================= */
@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(40px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================================
   RESPONSIVE
========================================= */
@media (max-width: 500px) {
  .container { padding: 40px 16px 40px; gap: 32px; }
  .avatar-wrapper { width: 100px; height: 100px; }
  .username { font-size: 1.8rem; }
  .bio { font-size: 0.95rem; }
  .link-card { padding: 14px 16px; gap: 14px; }
  .link-icon-wrap { width: 48px; height: 48px; border-radius: 12px; }
  .link-icon-wrap svg { width: 22px; height: 22px; }
  .link-title { font-size: 1.05rem; }
  .stat-num { font-size: 1.6rem; }
  .stats-row { padding: 20px 16px; }
}
