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

/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* LIGHT PREMIUM (Default) */
  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg3: #f1f5f9;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-h: rgba(255, 255, 255, 1);
  --border: rgba(99, 102, 241, 0.15);
  --border-h: rgba(99, 102, 241, 0.3);
  --text: #0f172a;
  --text2: #475569;
  --text3: #64748b;
  --accent: #6366f1;
  --accent2: #38bdf8;
  --grad: linear-gradient(135deg, #4f46e5, #8b5cf6, #38bdf8);
  --grad2: linear-gradient(135deg, #667eea, #764ba2);
  --danger: #ef4444;
  --success: #10b981;
  --warn: #f59e0b;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-full: 9999px;
  --shadow: 0 10px 30px rgba(99, 102, 241, 0.1);
  --tr: all .3s cubic-bezier(.4,0,.2,1);
  --tr-f: all .15s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  /* DARK LUXURY */
  --bg: #070913;
  --bg2: #0d1123;
  --bg3: #14182e;
  --surface: rgba(20, 24, 46, 0.6);
  --surface-h: rgba(30, 36, 66, 0.8);
  --border: rgba(255, 255, 255, 0.08);
  --border-h: rgba(255, 255, 255, 0.15);
  --text: #ffffff;
  --text2: #94a3b8;
  --text3: #64748b;
  --shadow: 0 10px 30px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: var(--tr-f); }
a:hover { color: var(--accent2); }

img { max-width: 100%; display: block; }

/* ========== UTILITY ========== */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.text-center { text-align: center; }
.gradient-text { background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hidden { display: none !important; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 28px; border: none; border-radius: var(--r-full); cursor: pointer;
  font-family: inherit; font-size: .95rem; font-weight: 600;
  transition: var(--tr); text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 4px 20px rgba(124,92,252,.3); }
.btn-primary:hover { box-shadow: 0 6px 30px rgba(124,92,252,.45); transform: translateY(-2px); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-h); border-color: var(--border-h); }
.btn-danger { background: rgba(255,71,87,.12); color: var(--danger); border: 1px solid rgba(255,71,87,.2); }
.btn-danger:hover { background: rgba(255,71,87,.2); }
.btn-sm { padding: 8px 18px; font-size: .85rem; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--r-md); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ========== FORMS ========== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--text2); margin-bottom: 8px; }
.form-input {
  width: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--text); font-family: inherit; font-size: .95rem;
  transition: var(--tr);
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,252,.15); }
.form-input::placeholder { color: var(--text3); }

/* ========== CARDS ========== */
.card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 28px; transition: var(--tr);
}
.card:hover { border-color: var(--border-h); }
.glass {
  background: rgba(255,255,255,.03); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-radius: var(--r-lg);
}

/* ========== TOAST ========== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  padding: 14px 28px; border-radius: var(--r-full); font-size: .9rem; font-weight: 500;
  z-index: 9999; opacity: 0; transition: var(--tr); pointer-events: none;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { border-color: rgba(46,213,115,.3); background: rgba(46,213,115,.1); }
.toast-error { border-color: rgba(255,71,87,.3); background: rgba(255,71,87,.1); }

/* ========== LOADER ========== */
.loader { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loader { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

/* ========== NAV ========== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 16px 0; transition: var(--tr);
}
.nav.scrolled { background: rgba(8,8,13,.85); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.nav-logo { font-size: 1.4rem; font-weight: 800; }
.nav-links { display: flex; gap: 12px; align-items: center; }

/* ========== LANDING — HERO ========== */
.hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 120px 20px 80px; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(124,92,252,.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(0,212,170,.06) 0%, transparent 50%);
  animation: heroGlow 8s ease-in-out infinite alternate;
}
@keyframes heroGlow { to { transform: translate(5%, 3%) scale(1.05); } }
.hero-content { position: relative; z-index: 1; max-width: 700px; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 800; line-height: 1.15; margin-bottom: 20px; }
.hero p { font-size: 1.15rem; color: var(--text2); margin-bottom: 36px; max-width: 520px; margin-inline: auto; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ========== LANDING — FEATURES ========== */
.features { padding: 100px 0; }
.features h2 { font-size: 2rem; font-weight: 700; margin-bottom: 12px; }
.features .subtitle { color: var(--text2); margin-bottom: 52px; font-size: 1.05rem; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.feature-card { padding: 32px; border-radius: var(--r-xl); background: var(--bg2); border: 1px solid var(--border); transition: var(--tr); }
.feature-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 8px 32px rgba(124,92,252,.1); }
.feature-icon { width: 48px; height: 48px; border-radius: var(--r-md); background: var(--grad); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 18px; }
.feature-card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.feature-card p { color: var(--text2); font-size: .92rem; }

/* ========== LANDING — CTA ========== */
.cta-section { padding: 100px 0; text-align: center; }
.cta-box {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 64px 40px; position: relative; overflow: hidden;
}
.cta-box::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--grad);
}
.cta-box h2 { font-size: 2rem; margin-bottom: 14px; }
.cta-box p { color: var(--text2); margin-bottom: 32px; }

/* ========== FOOTER ========== */
.footer { padding: 40px 0; border-top: 1px solid var(--border); text-align: center; color: var(--text3); font-size: .85rem; }

/* ========== AUTH PAGE ========== */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px;
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 40px 32px;
}
.auth-card h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 8px; }
.auth-card .auth-sub { color: var(--text2); margin-bottom: 32px; font-size: .95rem; }
.auth-card .auth-footer { margin-top: 24px; text-align: center; font-size: .9rem; color: var(--text2); }
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin-bottom: 28px; }
.otp-input {
  width: 52px; height: 60px; text-align: center; font-size: 1.5rem; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text); font-family: inherit; transition: var(--tr);
}
.otp-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,252,.15); }

/* ========== DASHBOARD ========== */
.dash { min-height: 100vh; }
.dash-nav {
  position: sticky; top: 0; z-index: 50; background: rgba(8,8,13,.9); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border); padding: 14px 0;
}
.dash-nav-inner { display: flex; align-items: center; justify-content: space-between; }
.dash-nav-user { display: flex; align-items: center; gap: 12px; }
.dash-nav-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem;
}
.dash-main { padding: 32px 0 80px; }
.dash-header { margin-bottom: 32px; }
.dash-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.dash-header p { color: var(--text2); font-size: .92rem; }

/* Profile Section */
.profile-section { margin-bottom: 40px; }
.profile-card {
  display: flex; gap: 24px; align-items: flex-start; padding: 28px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-xl);
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%; background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700;
  flex-shrink: 0;
}
.profile-info { flex: 1; }
.profile-info h2 { font-size: 1.2rem; margin-bottom: 4px; }
.profile-info .username { color: var(--accent); font-size: .9rem; }
.profile-info .bio-text { color: var(--text2); font-size: .9rem; margin-top: 4px; }
.profile-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* Link Actions Bar */
.links-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.links-header h2 { font-size: 1.15rem; }

/* Link Items */
.link-list { display: flex; flex-direction: column; gap: 12px; }
.link-item {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-lg);
  transition: var(--tr); cursor: default;
}
.link-item:hover { border-color: var(--border-h); }
.link-item.dragging { opacity: .5; border-color: var(--accent); }
.link-item.is-header { background: var(--bg3); border-left: 4px solid var(--accent); }
.link-item.is-header .link-body h3 { font-size: 1.05rem; color: var(--accent); font-weight: 700; }
.link-item.is-header .link-body p, .link-item.is-header .link-thumb { display: none; }
.link-drag {
  cursor: grab; color: var(--text3); font-size: 1.1rem; user-select: none; padding: 4px;
  display: flex; align-items: center;
}
.link-drag:active { cursor: grabbing; }
.link-thumb {
  width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--surface);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
  overflow: hidden; flex-shrink: 0;
}
.link-thumb img { width: 100%; height: 100%; object-fit: cover; }
.link-body { flex: 1; min-width: 0; }
.link-body h3 { font-size: .95rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-body p { font-size: .8rem; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Empty State */
.empty-state {
  text-align: center; padding: 64px 20px; color: var(--text3);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { color: var(--text2); margin-bottom: 8px; }
.empty-state p { font-size: .9rem; margin-bottom: 24px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; visibility: hidden; transition: var(--tr);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-xl);
  width: 100%; max-width: 500px; max-height: 85vh; overflow-y: auto; padding: 32px;
  transform: translateY(20px) scale(.97); transition: var(--tr);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-header h2 { font-size: 1.2rem; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 1.3rem; cursor: pointer; padding: 4px; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 28px; }

/* Social Media Section */
.social-section { margin-top: 40px; }
.social-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.social-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: .9rem; transition: var(--tr);
}
.social-item:hover { border-color: var(--border-h); }
.social-item .social-icon { font-size: 1.1rem; }
.social-item .social-url { color: var(--text2); max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ========== PUBLIC BIO PAGE ========== */
.bio-page {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: 48px 20px 64px;
}
.bio-header { text-align: center; margin-bottom: 36px; }
.bio-avatar {
  width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 16px;
  background: var(--grad); display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; box-shadow: 0 0 30px rgba(124,92,252,.25);
}
.bio-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.bio-header h1 { font-size: 1.4rem; font-weight: 700; }
.bio-header p { color: var(--text2); font-size: .92rem; margin-top: 6px; }
.bio-links { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 14px; }
.bio-link {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  transition: var(--tr); cursor: pointer; text-decoration: none; color: var(--text);
}
.bio-link:hover { background: var(--surface-h); border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(124,92,252,.12); color: var(--text); }
.bio-link-thumb {
  width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--bg3);
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.bio-link-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bio-link-title { flex: 1; font-weight: 600; font-size: .95rem; }
.bio-link-arrow { color: var(--text3); transition: var(--tr); }
.bio-link:hover .bio-link-arrow { color: var(--accent); transform: translateX(4px); }
.bio-section-title {
  width: 100%; text-align: center; font-size: 1.15rem; font-weight: 700;
  margin: 24px 0 8px; color: var(--text); letter-spacing: 0.5px;
}
.bio-social { display: flex; gap: 14px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.bio-social a {
  width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: var(--text2);
  transition: var(--tr);
}
.bio-social a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.bio-footer { margin-top: auto; padding-top: 48px; text-align: center; font-size: .8rem; color: var(--text3); }

/* ========== SCROLL ANIMATIONS ========== */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ========== FILE UPLOAD ========== */
.file-upload {
  border: 2px dashed var(--border); border-radius: var(--r-md); padding: 24px;
  text-align: center; cursor: pointer; transition: var(--tr);
}
.file-upload:hover { border-color: var(--accent); background: rgba(124,92,252,.04); }
.file-upload input { display: none; }
.file-upload p { color: var(--text3); font-size: .85rem; }
.file-preview { margin-top: 12px; }
.file-preview img { width: 60px; height: 60px; border-radius: var(--r-sm); object-fit: cover; margin: 0 auto; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
  .profile-card { flex-direction: column; align-items: center; text-align: center; }
  .profile-actions { justify-content: center; }
  .link-item { flex-wrap: wrap; }
  .nav-links .btn span { display: none; }
  .modal { padding: 24px; margin: 12px; }
  .cta-box { padding: 40px 24px; }
}

@media (max-width: 480px) {
  .hero-cta { flex-direction: column; align-items: center; }
  .auth-card .btn, .hero-cta .btn { width: 100%; }
  .otp-input { width: 44px; height: 52px; font-size: 1.2rem; }
  .auth-card { padding: 28px 20px; }
  .link-actions { width: 100%; justify-content: flex-end; }
}
