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

/* ─── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  --font-display: 'Syne', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;

  --bg:           #f2f4f2;
  --surface:      #ffffff;
  --border:       #dce5dc;
  --border-2:     #c8d4c8;
  --text:         #111a11;
  --text-2:       #4a5e4a;
  --text-3:       #849484;

  --brand:        #2d6a4f;
  --brand-mid:    #40916c;
  --brand-light:  #74c69d;
  --brand-pale:   #d8f3dc;
  --brand-soft:   #e8f5e9;

  --expense:      #c0392b;
  --expense-bg:   #fdecea;

  --hero-bg:      #0d1a0f;   /* vert très sombre pour le hero dark */
  --hero-text:    #e8f5e9;
  --hero-sub:     #8aab8a;

  --shadow:    0 4px 24px rgba(17,26,17,.09), 0 1px 4px rgba(17,26,17,.05);
  --shadow-lg: 0 20px 60px rgba(17,26,17,.14), 0 4px 16px rgba(17,26,17,.08);

  --radius:    16px;
  --radius-sm: 10px;
  --transition: .2s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg:       #0d120d;
  --surface:  #182018;
  --border:   #253225;
  --border-2: #2e3e2e;
  --text:     #e8f0e8;
  --text-2:   #8aab8a;
  --text-3:   #526052;

  --brand:       #52b788;
  --brand-mid:   #74c69d;
  --brand-light: #95d5b2;
  --brand-pale:  #1a3320;
  --brand-soft:  #162316;

  --hero-bg:   #060e06;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.55);
}

/* ─── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:16px; scroll-behavior:smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg); color: var(--text);
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  transition: background var(--transition), color var(--transition);
}
button { cursor:pointer; border:none; background:none; font-family:inherit; }
a { color: var(--brand); text-decoration:none; }
a:hover { text-decoration:underline; }

/* ─── HERO ───────────────────────────────────────────────────────────────── */
.hero {
  background: var(--hero-bg);
  position: relative; overflow: hidden;
  padding: 0 0 56px;
  min-height: 420px;
  display: flex; flex-direction: column;
}

.hero-pattern {
  position: absolute; inset: 0; width:100%; height:100%;
  pointer-events: none; z-index: 0;
}

.hero-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 40px;
  position: relative; z-index: 1;
}

.hero-logo { display: flex; align-items: center; gap: 10px; }

.logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #d8f3dc 0%, #f2f4f2 100%);
  border: 1.5px solid #c8d4c8;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(45,106,79,.2);
  overflow: hidden;
}

.logo-name {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 800; color: var(--hero-text);
  letter-spacing: -.4px;
}
.logo-name span { color: var(--brand-light); }

.hero-theme-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.08); color: var(--hero-text);
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.hero-theme-btn:hover { background: rgba(255,255,255,.14); }

.hero-content {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  padding: 40px 24px 0;
  position: relative; z-index: 1;
  animation: heroIn .6s cubic-bezier(.4,0,.2,1) both;
}

@keyframes heroIn {
  from { opacity:0; transform: translateY(20px); }
  to   { opacity:1; transform: translateY(0); }
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(82,183,136,.15); border: 1px solid rgba(82,183,136,.3);
  color: var(--brand-light);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
  padding: 5px 14px; border-radius: 20px; margin-bottom: 22px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 62px);
  font-weight: 800; line-height: 1.1;
  color: var(--hero-text);
  letter-spacing: -1.5px;
  margin-bottom: 18px;
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--brand-light) 0%, #b7e4c7 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: clamp(14px, 2vw, 17px);
  color: var(--hero-sub); line-height: 1.65;
  max-width: 500px; margin-bottom: 28px;
}

.hero-features {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.feature-pill {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  color: rgba(232,245,233,.7);
  font-size: 12px; font-weight: 500;
  padding: 6px 14px; border-radius: 20px;
}

/* ─── PANEL WRAP ─────────────────────────────────────────────────────────── */
.panel-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 0 20px 60px;
  margin-top: -40px;
  position: relative; z-index: 10;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 440px;
  overflow: hidden;
  animation: panelIn .5s .15s cubic-bezier(.34,1.3,.64,1) both;
}

@keyframes panelIn {
  from { opacity:0; transform: translateY(30px) scale(.97); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.tab {
  flex: 1; padding: 16px;
  font-size: 14px; font-weight: 600; color: var(--text-3);
  transition: all var(--transition);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Form sections */
.form-section { padding: 28px 28px 24px; }
.form-section.hidden { display: none; }

.form-header {
  display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px;
}
.form-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  border: 1px solid var(--brand-pale);
}
.form-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.form-sub   { font-size: 12px; color: var(--text-3); line-height: 1.5; }

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label {
  font-size: 11px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .5px;
}
.label-hint { font-weight: 400; text-transform: none; color: var(--text-3); letter-spacing: 0; }

.input-wrap {
  display: flex; align-items: center;
  background: #f7f9f7; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  overflow: hidden;
}
[data-theme="dark"] .input-wrap { background: #141c14; }
.input-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
}
.input-prefix {
  padding: 0 10px 0 13px; font-size: 13px; font-weight: 500;
  color: var(--brand-mid); background: var(--brand-soft);
  border-right: 1px solid var(--border); white-space: nowrap;
  align-self: stretch; display: flex; align-items: center;
}
.input-wrap input {
  flex: 1; border: none; outline: none; background: none;
  padding: 11px 13px; font-size: 14px; color: var(--text);
  font-family: inherit;
}
.input-wrap input::placeholder { color: var(--text-3); }
.input-toggle-pw {
  padding: 0 12px; font-size: 14px; color: var(--text-3);
  transition: color var(--transition); align-self: stretch;
  display: flex; align-items: center;
}
.input-toggle-pw:hover { color: var(--text); }

/* Slug preview */
.slug-preview {
  font-size: 11px; color: var(--brand); font-weight: 500;
  min-height: 16px; transition: opacity var(--transition);
}
.slug-preview.error { color: var(--expense); }

/* Password strength */
.pw-strength { min-height: 18px; }
.pw-bar-wrap { display: flex; gap: 3px; margin-bottom: 4px; }
.pw-bar { height: 3px; flex: 1; border-radius: 2px; background: var(--border); transition: background .3s; }
.pw-bar.weak   { background: var(--expense); }
.pw-bar.medium { background: #f59e0b; }
.pw-bar.strong { background: var(--brand); }
.pw-label      { font-size: 11px; color: var(--text-3); }

/* Error */
.form-error {
  font-size: 12px; color: var(--expense); font-weight: 500;
  min-height: 18px; margin-bottom: 4px;
  padding: 0 2px; animation: shake .3s;
}
@keyframes shake {
  0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)}
}

/* Submit btn */
.btn-submit {
  width: 100%; padding: 13px 20px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  color: white; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--transition); margin-top: 4px;
  box-shadow: 0 4px 14px rgba(45,106,79,.3);
}
.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(45,106,79,.4);
  background: linear-gradient(135deg, var(--brand-mid) 0%, #52b788 100%);
}
.btn-submit:active { transform: translateY(0); }
.btn-submit.loading { opacity:.7; pointer-events:none; }
.btn-arrow { font-size: 18px; transition: transform var(--transition); }
.btn-submit:hover .btn-arrow { transform: translateX(3px); }

.form-footer { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 16px; }

/* ─── RECENTLY VISITED ───────────────────────────────────────────────────── */
.recent-wrap { width: 100%; max-width: 440px; margin-top: 20px; }
.recent-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); margin-bottom: 10px; padding: 0 2px; }
.recent-list { display: flex; flex-direction: column; gap: 6px; }
.recent-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 16px;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; color: var(--text);
}
.recent-item:hover { border-color: var(--brand-light); box-shadow: 0 2px 10px rgba(45,106,79,.12); }
.recent-item:hover { text-decoration: none; }
.recent-item-icon { font-size: 20px; width: 34px; height: 34px; background: var(--brand-soft); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.recent-item-info { flex: 1; min-width: 0; }
.recent-item-name { font-size: 14px; font-weight: 600; color: var(--text); }
.recent-item-url  { font-size: 11px; color: var(--text-3); }
.recent-item-go   { font-size: 18px; color: var(--text-3); transition: transform var(--transition); }
.recent-item:hover .recent-item-go { transform: translateX(3px); color: var(--brand); }

/* ─── FOOTER ─────────────────────────────────────────────────────────────── */
.landing-footer {
  width: 100%; text-align: center;
  font-family: var(--font-body); font-size: 11px; font-weight: 400;
  color: var(--hero-sub); letter-spacing: .04em;
  padding: 28px 16px 20px;
  opacity: .65;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero-nav { padding: 20px 20px; }
  .hero-content { padding: 30px 20px 0; }
  .panel-wrap { padding: 0 12px 40px; margin-top: -28px; }
  .form-section { padding: 20px 20px 18px; }
  .hero-features { gap: 6px; }
  .feature-pill { font-size: 11px; }
}

/* ─── MOBILE VIEWPORT FIX ────────────────────────────────────────────────── */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (max-width: 600px) {
  input {
    font-size: 16px !important;  /* évite le zoom auto iOS */
  }

  /* Safe area pour l'encoche et la barre de navigation */
  .hero-nav {
    padding-top: calc(20px + env(safe-area-inset-top));
  }

  .panel-wrap {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
}
