/* ===== LinkBio app styles ===== */
:root {
  --ink: #17161d;
  --bg: #f5f4fa;
  --card: #ffffff;
  --primary: #5b3df5;
  --primary-d: #4625d6;
  --accent: #ff5c8a;
  --muted: #6f6e7c;
  --border: #e8e6f1;
  --ok: #1f9d6b;
  --err: #d83a52;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23,22,29,.04), 0 8px 30px rgba(23,22,29,.06);
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.app {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; letter-spacing: -.02em; }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 20px 64px; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px; max-width: 1080px; margin: 0 auto;
}
.brand {
  font-family: var(--display); font-weight: 700; font-size: 1.3rem;
  color: var(--ink); display: inline-flex; align-items: center; gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--primary); transform: rotate(12deg); display: inline-block; }
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topnav a { color: var(--muted); font-weight: 500; padding: 7px 11px; border-radius: 9px; }
.topnav a:hover { color: var(--ink); background: rgba(91,61,245,.06); text-decoration: none; }
.topnav a.active { color: var(--primary); background: rgba(91,61,245,.1); }
.ghost-link { border: 1px solid var(--border); }
.inline-form { display: inline; margin: 0; }
.btn-text { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 7px 11px; }
.btn-text:hover { color: var(--err); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--body); font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-radius: 11px; padding: 11px 18px;
  font-size: .95rem; transition: transform .06s ease, box-shadow .2s, background .2s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(91,61,245,.28); }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 7px 13px; font-size: .85rem; border-radius: 9px; }
.btn-lg { padding: 14px 26px; font-size: 1.02rem; }
.btn-block { width: 100%; }

/* ---- Hero ---- */
.hero {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center;
  padding: 30px 0 56px;
}
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--primary); background: rgba(91,61,245,.08);
  padding: 5px 11px; border-radius: 999px; margin-bottom: 18px;
}
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); margin: 0 0 16px; }
.hero .hl { color: var(--primary); }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 38ch; margin: 0 0 26px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-url { margin-top: 22px; color: var(--muted); font-family: var(--display); }
.hero-url .cursor { color: var(--ink); border-right: 2px solid var(--accent); padding-right: 2px; animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { border-color: transparent; } }

/* phone mock */
.hero-phone { display: flex; justify-content: center; }
.phone {
  width: 270px; height: 540px; border-radius: 38px; background: #111018;
  padding: 12px; box-shadow: 0 30px 60px rgba(23,22,29,.22); position: relative;
}
.phone::before {
  content: ""; position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  width: 80px; height: 6px; border-radius: 99px; background: #2a2935;
}
.phone-screen {
  height: 100%; border-radius: 28px; padding: 40px 18px 18px;
  background: linear-gradient(160deg, #2b1a6b, #5b3df5 60%, #ff5c8a);
  color: #fff; text-align: center; overflow: hidden;
}
.pp-avatar { width: 72px; height: 72px; border-radius: 50%; margin: 6px auto 12px; background: rgba(255,255,255,.25); border: 2px solid rgba(255,255,255,.6); }
.pp-name { font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.pp-bio { font-size: .82rem; opacity: .85; margin: 4px 0 18px; }
.pp-btn {
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  border-radius: 12px; padding: 11px; margin-bottom: 10px; font-size: .9rem; font-weight: 500;
  backdrop-filter: blur(4px);
}

/* ---- Features ---- */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin: 24px 0; }
.feature { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.feat-ico { font-size: 1.7rem; margin-bottom: 10px; }
.feature h3 { font-size: 1.05rem; margin: 0 0 6px; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }

/* ---- CTA band ---- */
.cta-band {
  margin-top: 48px; text-align: center; padding: 48px 24px;
  background: linear-gradient(120deg, #2b1a6b, #5b3df5); color: #fff; border-radius: 22px;
}
.cta-band h2 { color: #fff; font-size: 1.8rem; margin: 0 0 20px; }
.cta-band .btn-primary { background: #fff; color: var(--primary); box-shadow: none; }
.cta-band .btn-primary:hover { background: #f1eefe; }

/* ---- Auth ---- */
.auth-wrap { display: flex; justify-content: center; padding: 26px 0; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 34px 30px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.7rem; margin: 0 0 4px; }
.auth-sub { color: var(--muted); margin: 0 0 22px; }
.auth-alt { text-align: center; color: var(--muted); margin: 18px 0 0; }

/* ---- Forms ---- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: .9rem; }
.field small { color: var(--muted); font-size: .8rem; }
input, textarea, select {
  font-family: var(--body); font-size: .95rem; color: var(--ink);
  background: #fbfaff; border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 13px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,61,245,.14); background: #fff;
}
textarea { resize: vertical; }
.input-prefix { display: flex; align-items: center; background: #fbfaff; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.input-prefix:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,61,245,.14); }
.input-prefix em { padding: 0 4px 0 13px; color: var(--muted); font-style: normal; }
.input-prefix input { border: 0; background: transparent; box-shadow: none !important; padding-left: 2px; }

/* ---- Alerts ---- */
.alert { padding: 11px 15px; border-radius: 11px; font-size: .92rem; margin-bottom: 18px; }
.alert-error { background: #fdecef; color: var(--err); border: 1px solid #f7c9d2; }
.alert-ok { background: #e8f7f0; color: var(--ok); border: 1px solid #bfe9d6; }

/* ---- Dashboard ---- */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.dash-head h1 { font-size: 1.7rem; margin: 0 0 4px; }
.dash-link { color: var(--muted); margin: 0; font-size: .92rem; }
.dash-link a { font-weight: 600; }
.btn-copy { background: rgba(91,61,245,.08); color: var(--primary); border: 0; border-radius: 7px; padding: 3px 9px; font: inherit; font-size: .82rem; cursor: pointer; margin-left: 6px; }
.btn-copy:hover { background: rgba(91,61,245,.16); }

.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel-title { font-size: 1.1rem; margin: 0 0 16px; }

/* add link */
.add-link { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.add-link-row { display: flex; gap: 10px; }
.add-link-row input { flex: 1; }
.add-link-row select { max-width: 160px; }

/* link list */
.link-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.link-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  background: #fbfaff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
.link-item.dragging { opacity: .5; }
.link-item.drag-over { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,61,245,.14); }
.link-item.is-off { opacity: .55; }
.drag { cursor: grab; color: var(--muted); letter-spacing: -2px; user-select: none; }
.link-main { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-width: 0; }
.link-titles { min-width: 0; }
.link-titles strong { display: block; }
.link-url { color: var(--muted); font-size: .82rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.link-meta { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.link-actions { display: flex; align-items: center; gap: 6px; }
.btn-icon { background: none; border: 0; cursor: pointer; font-size: 1rem; padding: 5px; border-radius: 7px; }
.btn-icon:hover { background: rgba(23,22,29,.06); }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cfcddc; border-radius: 99px; transition: .2s; cursor: pointer; }
.slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* inline edit form */
.edit-form { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--border); }
.edit-actions { display: flex; gap: 8px; }

/* empty */
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }

/* appearance */
.appearance .theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-opt { cursor: pointer; text-align: center; }
.theme-opt input { display: none; }
.theme-opt .swatch { display: block; height: 42px; border-radius: 10px; border: 2px solid var(--border); margin-bottom: 4px; }
.theme-opt small { color: var(--muted); text-transform: capitalize; font-size: .78rem; }
.theme-opt input:checked + .swatch { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(91,61,245,.18); }
.theme-midnight .swatch { background: linear-gradient(160deg,#1b1340,#5b3df5); }
.theme-sunset .swatch { background: linear-gradient(160deg,#ff7e5f,#feb47b); }
.theme-ocean .swatch { background: linear-gradient(160deg,#2193b0,#6dd5ed); }
.theme-forest .swatch { background: linear-gradient(160deg,#134e3a,#43a047); }
.theme-mono .swatch { background: linear-gradient(160deg,#f4f4f4,#d9d9d9); }
.theme-bubblegum .swatch { background: linear-gradient(160deg,#ff9a9e,#fad0c4); }

.btnstyle-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.btnstyle-opt { cursor: pointer; }
.btnstyle-opt input { display: none; }
.bs-demo { display: block; text-align: center; padding: 9px; background: var(--primary); color: #fff; font-size: .82rem; text-transform: capitalize; border: 2px solid transparent; }
.btnstyle-opt input:checked + .bs-demo { outline: 2px solid var(--ink); outline-offset: 2px; }
.bs-rounded { border-radius: 12px; }
.bs-pill { border-radius: 99px; }
.bs-sharp { border-radius: 0; }
.bs-outline { background: #fff; color: var(--primary); border-color: var(--primary); border-radius: 12px; }

/* ---- Analytics ---- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.stat-num { display: block; font-family: var(--display); font-weight: 700; font-size: 2rem; color: var(--ink); }
.stat-lbl { color: var(--muted); font-size: .88rem; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding: 10px 0; }
.chart-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; }
.bar { width: 45%; border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-view { background: var(--primary); }
.bar-click { background: var(--accent); }
.chart-legend { display: flex; gap: 18px; color: var(--muted); font-size: .85rem; margin-top: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.dot-view { background: var(--primary); }
.dot-click { background: var(--accent); }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th, .data-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 600; font-size: .82rem; }
.data-table .num { text-align: right; }
.muted { color: var(--muted); }
.data-table td.muted { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.danger .panel-title { color: var(--ink); }

/* centered message (404/500) */
.centered-msg { text-align: center; padding: 80px 20px; }
.centered-msg h1 { font-size: 3rem; margin: 0 0 8px; }
.centered-msg p { color: var(--muted); margin: 0 0 22px; }

/* footer */
.appfoot { text-align: center; color: var(--muted); font-size: .85rem; padding: 30px 20px 40px; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-phone { order: -1; }
  .features { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .features { grid-template-columns: 1fr; }
  .add-link-row { flex-direction: column; }
  .add-link-row select { max-width: none; }
  .topnav { gap: 2px; }
  .topnav a { padding: 6px 8px; font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
