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

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --radius: 12px;
  --shadow: 0 20px 60px rgba(0,0,0,0.12);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  font-family: var(--font);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  background: var(--bg);
}

/* ===== Landing Page ===== */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, #1e293b, #334155);
  color: white;
}

.landing h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.landing p {
  font-size: 1.1rem;
  opacity: 0.85;
  margin-bottom: 2rem;
  max-width: 480px;
}

.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-white {
  background: white;
  color: var(--text);
}
.btn-white:hover { background: #f1f5f9; }

.btn-outline {
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.4);
}
.btn-outline:hover { border-color: white; }

/* ===== Editor Page ===== */
.editor-layout {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.editor-layout h1 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.editor-layout .subtitle {
  color: var(--text-light);
  margin-bottom: 2rem;
}

.form-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-section h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="url"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Logo Upload */
.logo-upload {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px dashed var(--border);
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-preview .placeholder {
  font-size: 2rem;
  color: var(--text-light);
}

.logo-upload-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.logo-upload-controls input[type="file"] {
  display: none;
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  border-radius: 6px;
}

/* Background Selector */
.bg-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.bg-swatch {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.2s, transform 0.1s;
}

.bg-swatch:hover { transform: scale(1.1); }
.bg-swatch.active { border-color: var(--primary); }

.bg-slate    { background: linear-gradient(135deg, #1e293b, #334155); }
.bg-ocean    { background: linear-gradient(135deg, #0c4a6e, #0ea5e9); }
.bg-forest   { background: linear-gradient(135deg, #14532d, #22c55e); }
.bg-sunset   { background: linear-gradient(135deg, #9a3412, #f97316); }
.bg-midnight { background: linear-gradient(135deg, #312e81, #7c3aed); }
.bg-rose     { background: linear-gradient(135deg, #881337, #e11d48); }
.bg-minimal  { background: #f1f5f9; border: 1px solid #cbd5e1; }

/* QR Option */
.qr-option {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.qr-option label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  cursor: pointer;
}

#qrCustomUrl {
  display: none;
}

#qrCustomUrl.visible {
  display: block;
}

/* ===== Result Panel ===== */
.result-panel {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: none;
}

.result-panel.visible { display: block; }

.result-panel h2 {
  color: #065f46;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.url-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.url-display input {
  flex: 1;
  border: none;
  font-size: 0.9rem;
  font-family: monospace;
  background: transparent;
  outline: none;
}

.url-display .btn-copy {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.result-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* ===== Form Actions ===== */
.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

/* ===== Social Links Editor ===== */
.social-link-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.social-select {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: var(--font);
  min-width: 130px;
}

.social-url {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: var(--font);
}

.social-select:focus, .social-url:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.social-remove {
  background: #fee2e2 !important;
  color: #991b1b !important;
  font-size: 1.1rem !important;
  padding: 0.3rem 0.6rem !important;
  line-height: 1;
}

/* ===== Layout Selector ===== */
.layout-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.layout-option {
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
  transition: border-color 0.2s;
  min-width: 100px;
}

.layout-option:hover { border-color: #94a3b8; }
.layout-option.active { border-color: var(--primary); background: #eff6ff; }

.layout-option span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.5rem;
  color: var(--text);
}

.layout-preview {
  width: 80px;
  height: 60px;
  background: #f8fafc;
  border-radius: 6px;
  overflow: hidden;
  margin: 0 auto;
  padding: 0.35rem;
}

.lp-header {
  height: 18px;
  background: #cbd5e1;
  border-radius: 3px 3px 0 0;
  margin: -0.35rem -0.35rem 0.25rem;
}

.lp-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #94a3b8;
  margin: 0 auto 0.2rem;
}

.lp-circle-sm {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.lp-circle-xs {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.lp-lines {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}

.lp-lines div {
  height: 3px;
  background: #cbd5e1;
  border-radius: 2px;
}

.lp-lines div:first-child { width: 40px; }
.lp-lines div:last-child { width: 28px; }

.lp-lines-sm {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lp-lines-sm div {
  height: 3px;
  background: #cbd5e1;
  border-radius: 2px;
  width: 32px;
}

.lp-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.lp-dots {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 0.4rem;
}

.lp-dots div {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

/* ===== Admin Dashboard ===== */
.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.auth-box {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow);
}

.auth-box h2 {
  margin-bottom: 0.5rem;
}

.admin-layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-header h1 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.admin-table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
}

.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f8fafc; }

.card-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-cell-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.view-badge {
  background: #eff6ff;
  color: #2563eb;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.action-btns {
  display: flex;
  gap: 0.25rem;
}

.action-btn {
  padding: 0.35rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.action-btn:hover { background: #f1f5f9; color: var(--text); }
.action-btn-danger:hover { background: #fee2e2; color: #dc2626; }

/* ===== Links Modal ===== */
.links-modal-box {
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.link-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.link-platform {
  flex-shrink: 0;
  width: 130px;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  color: var(--text);
}

.link-url {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text);
}

.link-url:focus, .link-platform:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.link-remove {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  background: #fee2e2;
  color: #991b1b;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.link-remove:hover { background: #fecaca; }

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .landing h1 { font-size: 1.75rem; }
  .editor-layout { padding: 1rem 0.75rem; }
  .form-section { padding: 1rem; }
  .logo-upload { flex-direction: column; text-align: center; }
  .bg-options { justify-content: center; }
  .result-links { flex-direction: column; }
}
