/* ============================================================
   Postaly — Design System
   ============================================================ */
:root {
  --bg: #0d0f17;
  --bg-soft: #141826;
  --bg-card: #1a1f30;
  --bg-elev: #212740;
  --border: #2a3148;
  --text: #eef1f8;
  --text-dim: #9aa3bd;
  --text-faint: #6b7490;
  --brand: #7c5cff;
  --brand-2: #ff5c9d;
  --brand-grad: linear-gradient(120deg, #7c5cff 0%, #ff5c9d 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 12px 40px rgba(0,0,0,.45);
  --maxw: 1180px;
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.center { text-align: center; }
.grad-text {
  background: var(--brand-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 18px; font-size: 15px; font-weight: 600;
  transition: transform .12s ease, filter .15s ease, background .15s ease;
  color: var(--text); background: var(--bg-elev); border-color: var(--border);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--brand-grad); border: none; color: #fff; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- Top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(13,15,23,.72);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.3px; }
.logo .dot { width: 26px; height: 26px; border-radius: 8px; background: var(--brand-grad); display: grid; place-items: center; font-size: 15px; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { color: var(--text-dim); font-size: 15px; font-weight: 500; }
.nav-links a:hover { color: var(--text); }
.nav-cta { display: flex; gap: 10px; align-items: center; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 80px 0 70px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -200px 0 auto 0; height: 600px;
  background: radial-gradient(closest-side, rgba(124,92,255,.22), transparent 70%);
  filter: blur(10px); z-index: 0;
}
.hero-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; text-align: center; }
.pill {
  display: inline-flex; gap: 8px; align-items: center;
  border: 1px solid var(--border); background: var(--bg-soft);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--text-dim);
  margin-bottom: 22px;
}
.hero h1 { font-size: clamp(34px, 5.4vw, 56px); line-height: 1.05; letter-spacing: -1.5px; font-weight: 800; }
.hero p.sub { font-size: clamp(16px, 2.2vw, 20px); color: var(--text-dim); margin: 20px auto 30px; max-width: 600px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 16px; font-size: 13px; color: var(--text-faint); }

/* ---------- Mock preview ---------- */
.preview {
  margin: 56px auto 0; max-width: 980px; border-radius: 18px;
  border: 1px solid var(--border); background: var(--bg-soft);
  box-shadow: var(--shadow); overflow: hidden;
}
.preview-bar { display: flex; gap: 7px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.preview-bar span { width: 11px; height: 11px; border-radius: 50%; background: #39405c; }
.preview-body { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; min-height: 320px; }
.preview-left { padding: 26px; border-right: 1px solid var(--border); }
.preview-right { padding: 26px; background: var(--bg); }
.preview-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-faint); margin-bottom: 8px; }
.preview-input { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--text-dim); margin-bottom: 14px; }
.preview-post { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; font-size: 14px; }
.preview-post .tag { color: var(--brand); }

/* ---------- Sections ---------- */
section.block { padding: 72px 0; }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 48px; }
.section-head h2 { font-size: clamp(26px, 3.6vw, 38px); letter-spacing: -.8px; font-weight: 800; }
.section-head p { color: var(--text-dim); margin-top: 12px; font-size: 17px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.feature .ico { width: 44px; height: 44px; border-radius: 11px; background: var(--bg-elev); display: grid; place-items: center; font-size: 21px; margin-bottom: 14px; }
.feature h3 { font-size: 18px; margin-bottom: 7px; }
.feature p { color: var(--text-dim); font-size: 14.5px; }

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step { text-align: center; padding: 12px; }
.step .num { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-grad); display: grid; place-items: center; font-weight: 800; margin: 0 auto 14px; }
.step h3 { font-size: 17px; margin-bottom: 6px; }
.step p { color: var(--text-dim); font-size: 14.5px; }

/* ---------- Pricing ---------- */
.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
.price-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px; display: flex; flex-direction: column;
}
.price-card.featured { border-color: var(--brand); background: var(--bg-soft); position: relative; box-shadow: 0 0 0 1px var(--brand), 0 14px 50px rgba(124,92,255,.18); }
.price-card .badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand-grad); color: #fff; font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; }
.price-card h3 { font-size: 19px; }
.price-card .price { font-size: 40px; font-weight: 800; letter-spacing: -1px; margin: 12px 0 2px; }
.price-card .price span { font-size: 15px; font-weight: 500; color: var(--text-faint); }
.price-card ul { list-style: none; margin: 20px 0 24px; display: grid; gap: 11px; }
.price-card li { font-size: 14.5px; color: var(--text-dim); display: flex; gap: 9px; }
.price-card li::before { content: "✓"; color: var(--ok); font-weight: 800; }
.price-card .btn { margin-top: auto; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); padding: 40px 0; color: var(--text-faint); font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; }

/* ---------- Modal (auth) ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(6,8,14,.7); backdrop-filter: blur(4px); display: none; place-items: center; z-index: 100; padding: 20px; }
.modal-overlay.open { display: grid; }
.modal {
  width: 100%; max-width: 420px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 18px; padding: 30px;
  box-shadow: var(--shadow);
}
.modal h2 { font-size: 23px; letter-spacing: -.4px; }
.modal p.sub { color: var(--text-dim); font-size: 14.5px; margin: 6px 0 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input {
  width: 100%; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; font-size: 15px; color: var(--text);
}
.field input:focus { outline: none; border-color: var(--brand); }
.modal .switch { text-align: center; font-size: 14px; color: var(--text-dim); margin-top: 18px; }
.modal .switch a { color: var(--brand); font-weight: 600; cursor: pointer; }
.modal-msg { font-size: 13.5px; margin-top: 12px; min-height: 18px; }
.modal-msg.err { color: var(--danger); }
.modal-msg.ok { color: var(--ok); }
.modal-close { float: right; font-size: 22px; color: var(--text-faint); background: none; border: none; cursor: pointer; line-height: 1; }

/* ============================================================
   APP (dashboard)
   ============================================================ */
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-soft); border-right: 1px solid var(--border); padding: 20px 16px; display: flex; flex-direction: column; }
.sidebar .logo { margin: 4px 6px 24px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  border-radius: 10px; color: var(--text-dim); font-weight: 500; font-size: 15px;
  cursor: pointer; margin-bottom: 3px;
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active { background: linear-gradient(120deg, rgba(124,92,255,.22), rgba(255,92,157,.22)); color: var(--text); box-shadow: inset 0 0 0 1px rgba(124,92,255,.35); }
.nav-item .ico { font-size: 17px; width: 20px; text-align: center; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 4px; }
.lang-switcher { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 5px 8px; font-size: 13px; cursor: pointer; }
.help-link { font-size: 13px; color: var(--text-dim); cursor: pointer; }
.help-link:hover { color: var(--text); text-decoration: underline; }
/* sélecteur de langue dans la nav de la landing */
.nav .lang-switcher { padding: 7px 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 6px; font-size: 13.5px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-grad); display: grid; place-items: center; font-weight: 700; font-size: 13px; }

.main { padding: 26px 32px 60px; overflow-y: auto; position: relative; }
.main::before {
  content: ""; position: fixed; top: -160px; right: -120px; width: 520px; height: 520px;
  background: radial-gradient(closest-side, rgba(255,92,157,.16), transparent 70%);
  pointer-events: none; z-index: 0;
}
.main::after {
  content: ""; position: fixed; bottom: -200px; left: 180px; width: 520px; height: 520px;
  background: radial-gradient(closest-side, rgba(124,92,255,.14), transparent 70%);
  pointer-events: none; z-index: 0;
}
.main > * { position: relative; z-index: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 12px; }
.page-head h1 {
  font-size: 26px; letter-spacing: -.5px;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.page-head p { color: var(--text-dim); font-size: 14.5px; }

.view { display: none; }
.view.active { display: block; }

/* Generator layout */
.gen-grid { display: grid; grid-template-columns: 420px 1fr; gap: 22px; align-items: start; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card h3 { font-size: 16px; margin-bottom: 16px; }
.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 7px; font-weight: 500; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; font-size: 14.5px; color: var(--text); font-family: inherit;
}
.form-row textarea { resize: vertical; min-height: 78px; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { outline: none; border-color: var(--brand); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text-dim);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; cursor: pointer; user-select: none;
}
.chip.sel { background: var(--brand-grad); color: #fff; border-color: transparent; }

.results { display: grid; gap: 14px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-faint); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.empty-state .big { font-size: 52px; margin-bottom: 14px; filter: drop-shadow(0 6px 18px rgba(124,92,255,.4)); }

.post-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.post-card-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.net-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.net-badge .ico { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; color: #fff; }
.post-card-body { padding: 16px; }
.post-text { font-size: 14.5px; white-space: pre-wrap; line-height: 1.6; }
.post-hashtags { margin-top: 12px; color: var(--brand); font-size: 13.5px; }
.post-actions { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .5px; padding-bottom: 6px; }
.cal-cell { min-height: 104px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 8px; font-size: 13px; }
.cal-cell.out { opacity: .4; }
.cal-cell.today { border-color: var(--brand); }
.cal-cell .daynum { font-size: 12px; color: var(--text-faint); margin-bottom: 5px; }
.cal-event { background: var(--bg-elev); border-left: 3px solid var(--brand); border-radius: 6px; padding: 4px 7px; font-size: 11.5px; margin-bottom: 4px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); padding: 13px 20px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat .n { font-size: 30px; font-weight: 800; letter-spacing: -1px; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat .l { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

.quota-bar { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.quota-fill { height: 100%; background: var(--brand-grad); border-radius: 999px; }

/* Loader */
.spinner { width: 17px; height: 17px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Photo dans le générateur + cartes */
#photoPreview { margin-top: 10px; }
#photoPreview .ph-wrap { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
#photoPreview img { width: 100%; max-height: 220px; object-fit: cover; display: block; }
#photoPreview .ph-remove { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.65); color: #fff; border: none; width: 30px; height: 30px; border-radius: 50%; font-size: 16px; cursor: pointer; line-height: 1; }
.post-photo { width: 100%; max-height: 260px; object-fit: cover; display: block; border-bottom: 1px solid var(--border); }

/* Barre mobile + tiroir */
.mobile-topbar { display: none; }
.hamburger { background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); width: 42px; height: 42px; border-radius: 10px; font-size: 20px; line-height: 1; cursor: pointer; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(6,8,14,.55); z-index: 45; }

/* Responsive */
@media (max-width: 900px) {
  .features, .steps, .pricing { grid-template-columns: 1fr; }
  .preview-body { grid-template-columns: 1fr; }
  .gen-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
  .app-shell { grid-template-columns: 1fr; }

  /* barre du haut visible */
  .mobile-topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    background: rgba(13,15,23,.92); backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 46;
  }
  .mobile-topbar .logo { font-size: 18px; }

  /* sidebar devient un tiroir coulissant */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 250px; z-index: 50;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.sidebar-open .sidebar-overlay { display: block; }

  .main { padding: 18px 16px 60px; }
  .main::before, .main::after { display: none; }
}
