/* ============================================
   FOLIO Design System
   Based on Pinterest-inspired tokens
   Font: Inter (substitute for Pin Sans)
   ============================================ */

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

/* --- CSS Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* --- Tokens: Colors --- */
:root {
  --primary: #FF4B1F;
  --primary-hover: #E0431A;
  --primary-pressed: #C93B14;
  --on-primary: #ffffff;

  --ink: #0B0B0B;
  --ink-soft: #211922;
  --body: #33332e;
  --charcoal: #262622;
  --mute: #62625b;
  --ash: #91918c;
  --stone: #c8c8c1;

  --canvas: #ffffff;
  --surface-soft: #fbfbf9;
  --surface-card: #f6f6f3;
  --surface-elevated: #ffffff;
  --surface-dark: #0B0B0B;

  --secondary-bg: #e5e5e0;
  --secondary-pressed: #c8c8c1;
  --on-secondary: #000000;

  --hairline: #dadad3;
  --hairline-soft: #e5e5e0;

  --success: #103c25;
  --success-pale: #c7f0da;
  --error: #9e0a0a;
  --error-deep: #cc001f;
  --focus-ring: #435ee5;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* --- Tokens: Typography --- */
body {
  font-family: 'Inter', -apple-system, system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--body);
  background: var(--canvas);
}

.display-xl {
  font-size: clamp(36px, 5vw, 70px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -1.2px;
  color: var(--ink);
}

.display-lg {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.8px;
  color: var(--ink);
}

.heading-xl {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.heading-lg {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

.heading-md {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.body-md { font-size: 16px; font-weight: 400; line-height: 1.4; }
.body-strong { font-size: 16px; font-weight: 600; line-height: 1.4; }
.body-sm { font-size: 14px; font-weight: 400; line-height: 1.4; }
.body-sm-strong { font-size: 14px; font-weight: 700; line-height: 1.4; }
.caption-md { font-size: 12px; font-weight: 500; line-height: 1.5; }
.caption-sm { font-size: 12px; font-weight: 400; line-height: 1.4; }

/* --- Tokens: Spacing --- */
.sp-xxs { gap: 4px; }
.sp-xs { gap: 6px; }
.sp-sm { gap: 8px; }
.sp-md { gap: 12px; }
.sp-lg { gap: 16px; }
.sp-xl { gap: 24px; }
.sp-xxl { gap: 32px; }
.sp-section { gap: 64px; }

.p-xxs { padding: 4px; }
.p-xs { padding: 6px; }
.p-sm { padding: 8px; }
.p-md { padding: 12px; }
.p-lg { padding: 16px; }
.p-xl { padding: 24px; }
.p-xxl { padding: 32px; }

/* --- Tokens: Radius --- */
.r-none { border-radius: 0; }
.r-sm { border-radius: 8px; }
.r-md { border-radius: 16px; }
.r-lg { border-radius: 32px; }
.r-full { border-radius: 9999px; }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 64px 0;
}

@media (max-width: 768px) {
  .section { padding: 48px 0; }
  .container { padding: 0 16px; }
}

@media (max-width: 480px) {
  .section { padding: 32px 0; }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  padding: 10px 20px;
  height: 44px;
  border-radius: 16px;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-pressed); }

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--on-secondary);
  padding: 10px 20px;
  height: 44px;
  border-radius: 16px;
}
.btn-secondary:hover { background: var(--secondary-pressed); }

.btn-tertiary {
  background: transparent;
  color: var(--ink);
  padding: 10px 20px;
  height: 44px;
  border-radius: 16px;
}
.btn-tertiary:hover { background: var(--surface-card); }

.btn-lg {
  height: 52px;
  padding: 12px 28px;
  font-size: 16px;
  border-radius: 16px;
}

.btn-sm {
  height: 36px;
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 16px;
}

.btn-full { width: 100%; }

.btn-disabled, .btn:disabled {
  background: var(--surface-card);
  color: var(--ash);
  cursor: not-allowed;
  transform: none;
}

/* --- Inputs --- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.input, input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="url"], input[type="number"], textarea, select {
  width: 100%;
  padding: 11px 15px;
  height: 44px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--ash);
  border-radius: 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  height: auto;
  min-height: 120px;
  resize: vertical;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2362625b'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.input:focus, input:focus, textarea:focus, select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--focus-ring);
}

.input::placeholder, input::placeholder, textarea::placeholder {
  color: var(--ash);
}

.input-error { border-color: var(--error); }
.error-text { font-size: 12px; color: var(--error); margin-top: 4px; }

/* --- Cards --- */
.card {
  background: var(--surface-card);
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
}

.card-body {
  padding: 24px;
}

.card-lg {
  border-radius: 32px;
}

/* --- Nav --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--canvas);
  height: 64px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  border-bottom-color: var(--hairline);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.nav-logo svg { height: 36px; width: auto; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  list-style: none;
}

.nav-links a {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 16px;
  transition: background 0.15s;
}

.nav-links a:hover { background: var(--surface-card); }

.nav-toggle { display: none; }
.nav-burger {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--hairline); color: var(--ink); background: var(--canvas);
}

body { overflow-x: clip; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  .nav-inner { position: relative; }
  .nav-toggle:checked ~ .nav-links {
    display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    position: absolute; top: 60px; right: 12px; z-index: 200;
    min-width: 220px; padding: 12px;
    background: var(--canvas); border: 1px solid var(--hairline);
    border-radius: 16px; box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  }
  .nav-toggle:checked ~ .nav-links a { padding: 12px 14px; }
}

/* --- Hero --- */
.hero {
  padding: 80px 0 64px;
  text-align: center;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--mute);
  margin-top: 16px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.hero-cta {
  margin-top: 32px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .hero { padding: 48px 0 32px; }
}

/* --- Pricing --- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 800px;
  margin: 0 auto;
}

.pricing-card {
  background: var(--canvas);
  border: 2px solid var(--hairline);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: 0 4px 24px rgba(255, 75, 31, 0.12);
}

.pricing-card .badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  white-space: nowrap;
}

.pricing-card .price {
  font-size: 36px;
  font-weight: 800;
  color: var(--ink);
  margin: 16px 0 4px;
}

.pricing-card .price-period {
  font-size: 14px;
  color: var(--mute);
  margin-bottom: 24px;
}

.pricing-card .features {
  list-style: none;
  text-align: left;
  margin-bottom: 24px;
}

.pricing-card .features li {
  padding: 8px 0;
  font-size: 14px;
  color: var(--body);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pricing-card .features li::before {
  content: "✓";
  color: var(--primary);
  font-weight: 700;
  flex-shrink: 0;
}

/* --- Steps --- */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
  max-width: 960px;
  margin: 0 auto;
}

.step {
  text-align: center;
  padding: 24px;
}

.step-number {
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.step-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.step-desc {
  font-size: 14px;
  color: var(--mute);
  line-height: 1.5;
}

/* --- Footer --- */
.footer {
  background: var(--surface-card);
  border-top: 1px solid var(--hairline);
  padding: 32px 0;
  margin-top: 64px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 8px;
  gap: 12px 24px;
  list-style: none;
  min-width: 0;
}

.footer-links a {
  font-size: 14px;
  color: var(--mute);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.footer-links a:hover { color: var(--ink); }

.footer-brand {
  font-size: 12px;
  color: var(--ash);
}

@media (max-width: 480px) {
  .footer-inner { flex-direction: column; text-align: center; }
}

/* --- Form Wizard --- */
.wizard {
  max-width: 640px;
  margin: 0 auto;
}

.wizard-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}

.wizard-dot {
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background: var(--hairline);
  transition: background 0.2s;
}

.wizard-dot.active { background: var(--primary); }
.wizard-dot.done { background: var(--success); }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  gap: 12px;
}

/* --- Upload --- */
.upload-zone {
  border: 2px dashed var(--hairline);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(255, 75, 31, 0.04);
}

.upload-zone .upload-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.upload-zone .upload-text {
  font-size: 14px;
  color: var(--mute);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.gallery-item {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--surface-card);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item .remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item .desc-input {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 8px;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  font-size: 12px;
  outline: none;
}

/* --- Plan Selector --- */
.plan-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.plan-option {
  border: 2px solid var(--hairline);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}

.plan-option:hover { border-color: var(--ash); }

.plan-option.selected {
  border-color: var(--primary);
  background: rgba(255, 75, 31, 0.04);
}

.plan-option input[type="radio"] { display: none; }

.plan-option .plan-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.plan-option .plan-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.plan-option .plan-period {
  font-size: 13px;
  color: var(--mute);
  margin-top: 4px;
}

@media (max-width: 480px) {
  .plan-selector { grid-template-columns: 1fr; }
}

/* --- Admin --- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  background: var(--surface-dark);
  color: var(--on-primary);
  padding: 24px 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar .sidebar-logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
}

.admin-sidebar .sidebar-logo svg { height: 28px; }

.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.admin-sidebar nav a:hover {
  color: white;
  background: rgba(255,255,255,0.08);
}

.admin-sidebar nav a.active {
  color: white;
  background: rgba(255,255,255,0.12);
}

.admin-main {
  flex: 1;
  padding: 32px;
  overflow-x: hidden;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

#burgerBtn { display: none; }
#menuOverlay { display: none; }

@media (max-width: 768px) {
  #burgerBtn {
    display: flex; align-items: center; justify-content: center;
    position: fixed; top: 12px; left: 12px; z-index: 60;
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--surface-dark); color: #fff;
    border: none; cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  }
  .admin-sidebar {
    position: fixed; left: 0; top: 0; z-index: 70;
    width: 260px; transform: translateX(-105%);
    transition: transform 0.25s ease;
    border-radius: 0;
  }
  .admin-sidebar.open { transform: none; box-shadow: 8px 0 32px rgba(0,0,0,0.35); }
  #menuOverlay.show {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(0,0,0,0.45);
  }
  .admin-main { padding: 16px; padding-top: 68px; }
}

/* --- Table --- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--mute);
  background: var(--surface-card);
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline-soft);
  color: var(--body);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-soft); }

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pending { background: #fef3cd; color: #856404; }
.badge-paid { background: var(--success-pale); color: var(--success); }
.badge-expired { background: #f8d7da; color: var(--error); }
.badge-cancelled { background: var(--secondary-bg); color: var(--mute); }
.badge-draft { background: var(--secondary-bg); color: var(--mute); }
.badge-public { background: var(--success-pale); color: var(--success); }
.badge-suspended { background: #f8d7da; color: var(--error); }

/* --- Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--canvas);
  border-radius: 32px;
  padding: 32px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: var(--surface-card);
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-dark);
  color: var(--on-primary);
  padding: 12px 20px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--error); }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--mute);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

/* --- Code Editor --- */
.code-editor {
  width: 100%;
  min-height: 300px;
  padding: 16px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.5;
  background: var(--surface-dark);
  color: #e0e0e0;
  border: none;
  border-radius: 16px;
  resize: vertical;
  outline: none;
  tab-size: 2;
}

/* --- Utils --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 16px; }
.gap-xl { gap: 24px; }
.text-center { text-align: center; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 12px; }
.mt-lg { margin-top: 16px; }
.mt-xl { margin-top: 24px; }
.mt-section { margin-top: 64px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 12px; }
.mb-lg { margin-bottom: 16px; }
.mb-xl { margin-bottom: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
