/* LinkPage v2 — Clean, Modern, Fast */
:root {
  --bg: #fafafa;
  --text: #1a1a2e;
  --sub: #6b7280;
  --accent: #4f46e5;
  --border: #e5e7eb;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text); line-height: 1.6; background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== TOPBAR ===== */
.topbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-size: 1.3rem; font-weight: 700; color: var(--text); text-decoration: none; }
.logo span { color: var(--accent); }
.btn-sm { background: var(--accent); color: #fff; padding: 8px 18px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 0.85rem; }
.btn-sm:hover { opacity: 0.9; }

/* ===== HERO ===== */
.hero { text-align: center; padding: 80px 24px 60px; max-width: 700px; margin: 0 auto; }
.hero h1 { font-size: 2.8rem; font-weight: 800; line-height: 1.15; letter-spacing: -1px; margin-bottom: 16px; }
.hero p { font-size: 1.15rem; color: var(--sub); margin-bottom: 32px; }
.btn-lg { display: inline-block; background: var(--accent); color: #fff; padding: 14px 36px; border-radius: 10px; font-size: 1.1rem; font-weight: 600; text-decoration: none; transition: .2s; border: none; cursor: pointer; }
.btn-lg:hover { opacity: 0.9; transform: translateY(-1px); }

.hero-preview { margin-top: 40px; }
.phone-mock { width: 260px; background: #1a1a2e; border-radius: 32px; padding: 10px; margin: 0 auto; box-shadow: 0 20px 50px rgba(0,0,0,.15); }
.phone-screen { background: #fff; border-radius: 24px; padding: 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mock-avatar { width: 56px; height: 56px; border-radius: 50%; background: #e5e7eb; }
.mock-name { font-weight: 700; font-size: 0.9rem; }
.mock-bio { font-size: 0.7rem; color: #9ca3af; }
.mock-link { width: 100%; height: 32px; background: #f3f4f6; border-radius: 8px; margin-top: 4px; }

/* ===== BUILDER ===== */
.builder { max-width: 1100px; margin: 0 auto; padding: 60px 24px; }
.builder > h2 { text-align: center; font-size: 2rem; }
.builder-sub { text-align: center; color: var(--sub); margin-bottom: 48px; }
.builder-grid { display: grid; grid-template-columns: 1fr 340px; gap: 48px; align-items: start; }
@media (max-width: 900px) { .builder-grid { grid-template-columns: 1fr; } }

/* Form */
.builder-form h3 { font-size: 1.05rem; margin: 28px 0 10px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.builder-form h3:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.78rem; font-weight: 600; margin-bottom: 4px; color: var(--sub); text-transform: uppercase; letter-spacing: .5px; }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; font-family: inherit; background: #fff; }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.field-hint { font-size: 0.72rem; color: #9ca3af; margin-top: 2px; display: block; }

/* Theme Grid */
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-btn {
  padding: 10px 6px; border: 2px solid var(--border); border-radius: 10px;
  background: #fff; cursor: pointer; text-align: center; transition: all .15s;
}
.theme-btn.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79,70,229,.15); }
.theme-btn:hover { border-color: #d1d5db; }
.theme-swatch { display: block; width: 100%; height: 28px; border-radius: 6px; margin-bottom: 4px; }
.theme-label { font-size: 0.7rem; font-weight: 600; color: var(--sub); }

/* Link Rows */
#linksContainer { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: flex; gap: 6px; align-items: center; }
.link-row input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.88rem; }
.link-row input:focus { outline: none; border-color: var(--accent); }
.del-link { width: 30px; height: 30px; border-radius: 6px; border: none; background: #fef2f2; color: #dc2626; cursor: pointer; font-size: 1.1rem; flex-shrink: 0; }
.del-link:hover { background: #fecaca; }

.btn-add { width: 100%; padding: 10px; border: 2px dashed var(--border); border-radius: 8px; background: transparent; color: var(--accent); font-weight: 600; font-size: 0.88rem; cursor: pointer; margin-top: 4px; }
.btn-add:hover { border-color: var(--accent); background: #f5f3ff; }

.social-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Publish Button */
.btn-publish { width: 100%; padding: 16px; background: var(--accent); color: #fff; border: none; border-radius: 10px; font-size: 1.05rem; font-weight: 700; cursor: pointer; margin-top: 20px; transition: .2s; }
.btn-publish:hover { opacity: 0.9; transform: translateY(-1px); }
#saveMsg { margin-top: 12px; }

/* Preview Panel */
.preview-sticky { position: sticky; top: 72px; }
.preview-label { text-align: center; font-size: 0.7rem; color: #9ca3af; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
.phone-frame { width: 300px; background: #1a1a2e; border-radius: 36px; padding: 12px; margin: 0 auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }

/* LinkPage Preview Card */
.linkpage {
  background: #fff; border-radius: 26px; min-height: 460px; padding: 28px 18px 20px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  transition: background .3s;
}
.lp-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; border: 2px solid rgba(0,0,0,.06); }
.lp-avatar-placeholder { width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, #667eea, #764ba2); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.8rem; font-weight: 700; margin-bottom: 10px; }
.lp-avatar-placeholder.hidden { display: none; }
.lp-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.lp-bio { font-size: 0.78rem; color: var(--sub); margin-bottom: 16px; max-width: 240px; }

.lp-links { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.lp-preview-link { padding: 12px 14px; background: #f3f4f6; border-radius: 10px; font-weight: 600; font-size: 0.82rem; color: var(--text); }

.lp-social { display: flex; gap: 14px; margin-top: 16px; }
.lp-social-icon { font-size: 1.2rem; }
.lp-brand { margin-top: 18px; font-size: 0.65rem; color: #9ca3af; }

/* Theme previews in phone */
.linkpage.theme-dark { background: #1a1a2e; color: #fff; }
.linkpage.theme-dark .lp-preview-link { background: #2d2d44; color: #fff; }
.linkpage.theme-dark .lp-bio { color: #9ca3af; }

.linkpage.theme-gradient { background: linear-gradient(180deg, #667eea 0%, #764ba2 50%, #1a1a2e 100%); color: #fff; }
.linkpage.theme-gradient .lp-preview-link { background: rgba(255,255,255,.15); color: #fff; }
.linkpage.theme-gradient .lp-bio { color: rgba(255,255,255,.7); }

.linkpage.theme-ocean { background: linear-gradient(180deg, #0077b6 0%, #00b4d8 50%, #90e0ef 100%); color: #fff; }
.linkpage.theme-ocean .lp-preview-link { background: rgba(255,255,255,.2); color: #fff; }

.linkpage.theme-sunset { background: linear-gradient(180deg, #f093fb 0%, #f5576c 60%, #fda085 100%); color: #fff; }
.linkpage.theme-sunset .lp-preview-link { background: rgba(255,255,255,.2); color: #fff; }

.linkpage.theme-forest { background: linear-gradient(180deg, #134e4a 0%, #14b8a6 50%, #86efac 100%); color: #fff; }
.linkpage.theme-forest .lp-preview-link { background: rgba(255,255,255,.2); color: #fff; }

.linkpage.theme-midnight { background: linear-gradient(180deg, #0f0c29 0%, #302b63 50%, #24243e 100%); color: #fff; }
.linkpage.theme-midnight .lp-preview-link { background: rgba(255,255,255,.1); color: #fff; }

.linkpage.theme-rose { background: linear-gradient(180deg, #fdf2f8 0%, #fbcfe8 50%, #e8a0bf 100%); color: #1a1a2e; }
.linkpage.theme-rose .lp-preview-link { background: rgba(255,255,255,.7); color: #1a1a2e; }

/* ===== FOOTER ===== */
.footer { text-align: center; padding: 32px; color: var(--sub); font-size: 0.8rem; }
