/* ═══════════════════════════════════════════
   FEELINK MEMBER PORTAL — Light Mode
   Clean, trustworthy, card-based
═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600;700&display=swap');

/* ── TOKENS ── */
:root {
  --pink:    #FF2D78;
  --pink-light: #fff0f5;
  --pink-mid:   #ffd0e3;
  --black:   #111111;
  --gray-50: #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-400: #a1a1aa;
  --gray-600: #52525b;
  --white:   #ffffff;

  --radius:  12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.14), 0 4px 12px rgba(0,0,0,0.06);

  --font: 'Space Grotesk', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --t:    200ms ease;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--black);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 99px; }

/* ── TOP BAR ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  height: 60px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-logo {
  font-weight: 900;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  color: var(--pink);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-user {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--gray-600);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  text-decoration: none;
  border: none;
}
.btn-primary {
  background: var(--pink);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(255,45,120,0.3);
}
.btn-primary:hover { background: #e0235e; box-shadow: 0 6px 20px rgba(255,45,120,0.4); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(255,45,120,0.3); }
.btn-primary:disabled { background: var(--gray-400); box-shadow: none; transform: none; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
}
.btn-ghost:hover { border-color: var(--gray-400); color: var(--black); background: var(--gray-100); }

.btn-sm  { padding: 8px 16px; font-size: 0.8rem; }
.btn-lg  { padding: 14px 28px; font-size: 0.95rem; }
.btn-xl  { padding: 16px 32px; font-size: 1rem; font-weight: 800; }
.btn-full { width: 100%; }

/* ── VIEWS ── */
.view {
  min-height: calc(100dvh - 60px);
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}
.view-wide {
  max-width: 860px;
}

/* ── STEPPER ── */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 36px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.stepper::-webkit-scrollbar { display: none; }
.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--gray-400);
  transition: all var(--t);
  background: var(--white);
  flex-shrink: 0;
}
.step-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-400);
  white-space: nowrap;
  transition: color var(--t);
}
.step-line {
  height: 2px;
  width: 32px;
  background: var(--gray-200);
  flex-shrink: 0;
  transition: background var(--t);
}
.step-item.active .step-circle {
  border-color: var(--pink);
  background: var(--pink);
  color: var(--white);
}
.step-item.active .step-label { color: var(--pink); }
.step-item.done .step-circle {
  border-color: var(--pink);
  background: var(--pink-light);
  color: var(--pink);
}
.step-item.done + .step-line { background: var(--pink); }
.step-item.done .step-label { color: var(--gray-600); }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-body { padding: 24px; }

/* ── AUTH VIEW ── */
.auth-card {
  max-width: 400px;
  margin: 48px auto 0;
}
.auth-logo {
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: -0.04em;
  color: var(--pink);
  text-align: center;
  margin-bottom: 4px;
}
.auth-tagline {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--gray-400);
  text-transform: uppercase;
  margin-bottom: 32px;
}
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 24px;
}
.tab-btn {
  flex: 1;
  padding: 12px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gray-400);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--t);
}
.tab-btn.active { color: var(--pink); border-bottom-color: var(--pink); }

/* ── FORM FIELDS ── */
.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-600);
}
.field-input {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--black);
  background: var(--white);
  width: 100%;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.field-input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255,45,120,0.12);
}
.field-input::placeholder { color: var(--gray-400); }
.field-textarea {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--black);
  background: var(--white);
  width: 100%;
  outline: none;
  resize: vertical;
  min-height: 100px;
  line-height: 1.7;
  transition: border-color var(--t), box-shadow var(--t);
}
.field-textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255,45,120,0.12);
}
.field-textarea::placeholder { color: var(--gray-400); }
.field-hint {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--gray-400);
  line-height: 1.6;
  margin-top: 4px;
}

.error-banner {
  background: #fff0f0;
  border: 1.5px solid #ffb3b3;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: #c00;
  margin-top: 12px;
  display: none;
}
.error-banner.visible { display: block; }

/* ── CATALOG VIEW ── */
.view-title {
  font-weight: 900;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.view-subtitle {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-bottom: 28px;
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.template-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px 18px;
  text-align: left;
  cursor: pointer;
  transition: all var(--t);
  box-shadow: var(--shadow-sm);
  position: relative;
}
.template-card:hover {
  border-color: var(--pink);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.template-card.selected {
  border-color: var(--pink);
  background: var(--pink-light);
  box-shadow: 0 0 0 3px rgba(255,45,120,0.15), var(--shadow);
}
.tpl-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 12px;
}
.tpl-name {
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 4px;
}
.tpl-desc {
  font-size: 0.78rem;
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 12px;
}
.tpl-price {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1.5px solid;
}
.tpl-price.free { color: #059669; border-color: #059669; background: #ecfdf5; }
.tpl-price.premium { color: var(--pink); border-color: var(--pink); background: var(--pink-light); }

/* ── EDITOR VIEW ── */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 700px) {
  .editor-layout { grid-template-columns: 1fr 1fr; }
}
.editor-section {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.editor-section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.editor-section-body { padding: 20px; }
.section-icon {
  font-size: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-frame {
  background: var(--gray-100);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  position: sticky;
  top: 80px;
  height: 560px;
}
.preview-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius);
}
.preview-label {
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gray-400);
  text-transform: uppercase;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.preview-body {
  height: calc(100% - 40px);
  overflow: hidden;
}
.preview-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.editor-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 50;
}
.editor-tpl-badge {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--gray-600);
}
.editor-actions { display: flex; gap: 10px; }

/* ── PAYMENT VIEW ── */
.payment-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-top: 24px;
}
.payment-template-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--pink-light);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pink);
  margin-bottom: 20px;
}
.payment-amount {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-bottom: 4px;
}
.payment-amount-sub {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-bottom: 28px;
}
.payment-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.875rem;
}
.payment-detail:last-child { border-bottom: none; }
.payment-detail-key { color: var(--gray-600); }
.payment-detail-val { font-weight: 700; }
.payment-note {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--gray-600);
  line-height: 1.7;
  margin: 20px 0;
}

/* ── ORDERS VIEW ── */
.order-item {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  transition: box-shadow var(--t);
}
.order-item:hover { box-shadow: var(--shadow-sm); }
.order-item-left { flex: 1; min-width: 0; }
.order-tpl-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--pink-light);
  color: var(--pink);
  margin-bottom: 6px;
  text-transform: uppercase;
}
.order-label {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-url {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--gray-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-status {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.order-status.published { background: #ecfdf5; color: #059669; }
.order-status.draft { background: var(--gray-100); color: var(--gray-400); }
.order-status.pending { background: #fff7ed; color: #d97706; }

/* ── SUCCESS VIEW ── */
.success-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 40px;
}
.success-emoji {
  font-size: 4rem;
  margin-bottom: 24px;
}
.success-title {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}
.success-sub {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--gray-600);
  margin-bottom: 32px;
}
.link-box {
  width: 100%;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--pink);
  word-break: break-all;
  margin-bottom: 16px;
}
.success-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
}
.toast {
  background: var(--black);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toastIn 200ms ease forwards;
  white-space: nowrap;
}
.toast.toast-error { background: #c00; }
.toast.toast-ok { background: #059669; }
.toast.removing { animation: toastOut 200ms ease forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0); } to { opacity:0; transform:translateY(8px); } }

/* ── LOADING ── */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--gray-400);
  font-family: var(--mono);
  font-size: 0.75rem;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state-title { font-weight: 800; font-size: 1.1rem; margin-bottom: 8px; }
.empty-state-sub { font-family: var(--mono); font-size: 0.75rem; color: var(--gray-400); }
