/* Feuille des pages hors session : connexion, inscription, abonnement.
   Copie fidèle du design d'authentification de factures-generator
   (src/app/globals.css) : tokens, base, champs, boutons, bloc « AUTH PAGES ».
   Ces pages ne chargent pas app.css et restent en clair, comme le modèle —
   c'est le seul moyen d'obtenir exactement le même rendu. Les seuls ajouts
   propres à Planner sont regroupés à la fin du fichier. */

/* Reset minimal : l'équivalent de ce que le preflight Tailwind du modèle
   applique aux éléments présents sur ces pages (marges, boutons, liens,
   svg, placeholder, [hidden]). Sans lui, le rendu s'écarte du modèle. */
*,
::before,
::after {
  border-width: 0;
  border-style: solid;
  border-color: #e5e7eb;
}

body,
h1,
p,
ul {
  margin: 0;
}

h1 {
  font-size: inherit;
  font-weight: inherit;
}

button,
input {
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
}

button,
[type="button"],
[type="submit"] {
  -webkit-appearance: button;
  background-color: transparent;
  background-image: none;
  text-transform: none;
}

a {
  color: inherit;
  text-decoration: inherit;
}

svg {
  display: block;
  vertical-align: middle;
}

input::placeholder {
  color: #9ca3af;
  opacity: 1;
}

[hidden] {
  display: none;
}

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e4e7ec;
  --text: #1a1f2e;
  --muted: #6b7280;
  --accent: #0071e3;
  --accent-light: #e8f2fd;
  --danger: #dc2626;
  --success: #059669;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ============================================================
   BASE
   ============================================================ */
* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  /* `clip` rogne le débordement horizontal SANS créer de contexte de
     défilement — contrairement à `hidden`, il ne casse pas position: sticky */
  overflow-x: clip;
}

body {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 24px;
}

.form-group {
  margin-bottom: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text);
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  transition: border 0.15s, box-shadow 0.15s;
}

/* iOS impose une largeur intrinsèque au champ date — on la neutralise pour
   qu'il respecte le width: 100% de son conteneur et ne déborde plus. */
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}

/* La "valeur" interne du champ date ne doit pas pousser la largeur */
input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn,
.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s, transform 0.05s;
}

.btn {
  padding: 9px 16px;
  font-size: 14px;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

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

.btn-primary,
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: #0077ed;
}

.btn-secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-secondary:hover {
  background: var(--accent-light);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  background: #991b1b;
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover {
  background: #047857;
}


/* ============================================================
   UTILITIES (Tailwind can't do everything we need in .invoice)
   ============================================================ */
.text-muted {
  color: var(--muted);
}

/* Disabled buttons */
.btn:disabled,
.btn-sm:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}


/* ============================================================
   AUTH PAGES
   ============================================================ */
/* Barre supérieure de l'écran de connexion. Le padding du body étant annulé
   sur ces écrans, aucune marge négative n'est nécessaire. */
.auth-topbar {
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fbfbfd;
  border-bottom: 1px solid #d2d2d7;
}

.auth-topbar-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #1d1d1f;
}

.auth-topbar-logo {
  font-size: 17px;
  line-height: 1;
}

.auth-topbar-menu {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #1d1d1f;
  line-height: 1;
}

/* Colonne flex pleine page. Le padding du body est annulé ici pour que la
   topbar, le fond et le bandeau aillent bord à bord : sans ça, il resterait
   une bande blanche sur les côtés. */
body:has(.auth-wrapper) {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.auth-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
}

/* Bandeau légal, sur toute la largeur comme la topbar. */
.auth-footer {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  background: #f1f1f4;
  border-top: 1px solid #e0e0e4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  color: #6e6e73;
}

.auth-footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Séparateurs verticaux entre les mentions, comme sur la maquette. Sélecteur
   sur l'enfant et non sur span : depuis que les pages légales existent, ces
   mentions sont des liens. */
.auth-footer-links > * + * {
  border-left: 1px solid #c8c8cd;
  padding-left: 12px;
}

.auth-footer-links a:hover {
  color: #1d1d1f;
  text-decoration: underline;
}

.auth-card {
  background: var(--panel);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.1);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

/* Variante réservée au formulaire de connexion / inscription. `.auth-card`
   seule sert aussi de carte « Chargement… » dans les autres pages : on ne la
   modifie pas, on la surcharge uniquement ici. */
.auth-card--form {
  max-width: 460px;
  padding: 48px 40px;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(15, 23, 42, 0.08);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  font-size: 44px;
  line-height: 1;
  margin-bottom: 16px;
}

/* Titre repris de la maquette : police système (SF Pro sur Apple) et noir
   très sombre, plutôt que le Plus Jakarta Sans et l'accent du reste de l'app. */
.auth-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #1d1d1f;
}

.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* Champs plus hauts et plus arrondis, dans l'esprit de la maquette.
   font-size: 16px évite aussi le zoom automatique d'iOS au focus. */
.auth-card--form .form-group {
  margin-bottom: 16px;
}

.auth-card--form label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.auth-card--form input {
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 16px;
}

.auth-card--form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.16);
}

/* Champ mot de passe + bouton œil : le padding droit de l'input réserve
   la place du bouton pour que le texte ne passe pas dessous. */
.password-field {
  position: relative;
}

.password-field input {
  padding-right: 42px;
}

.auth-card--form .password-field input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  border-radius: 0 6px 6px 0;
}

/* Suit le rayon plus généreux des champs du formulaire d'auth. */
.auth-card--form .password-toggle {
  width: 44px;
  border-radius: 0 12px 12px 0;
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Lien de bascule connexion / inscription, placé sous les champs. */
.auth-inline-link {
  display: inline-block;
  background: none;
  border: none;
  padding: 0;
  margin-top: 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.auth-inline-link:hover {
  text-decoration: underline;
}

.auth-inline-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Bloc explicatif : icône + texte court. */
.auth-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 24px 0;
}

.auth-note svg {
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 1px;
}

.auth-note p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.auth-submit {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
}

/* Mobile : la carte occupe tout l'écran, bord à bord, comme sur la maquette —
   plus de coins arrondis, d'ombre ni de fond gris autour. */
@media (max-width: 480px) {
  .auth-wrapper {
    align-items: flex-start;
    padding: 0;
    background: var(--panel);
  }

  .auth-card--form {
    max-width: none;
    padding: 32px 24px 40px;
    border-radius: 0;
    box-shadow: none;
  }

  /* Comme sur la maquette, le titre reste resserré au centre et se répartit
     sur plusieurs lignes plutôt que de s'étirer sur toute la largeur. */
  .auth-title {
    font-size: 26px;
    max-width: 15ch;
    margin: 0 auto;
  }

  .auth-header {
    margin-bottom: 24px;
  }
}

/* ============================================================
   AJOUTS PLANNER (absents du modèle)
   ============================================================ */
/* Le logo n'est pas un emoji mais le carré bleu de Planner, aux deux
   emplacements et tailles de l'emoji du modèle (17 px en barre, 44 px en
   carte). */
.auth-topbar-logo,
.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}

.auth-topbar-logo {
  width: 20px;
  height: 20px;
  border-radius: 6px;
}

.auth-topbar-logo svg {
  width: 12px;
  height: 12px;
}

.auth-logo {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  margin: 0 auto 16px;
}

.auth-logo svg {
  width: 26px;
  height: 26px;
}

/* Le bandeau d'erreur existe toujours dans la page ; il est masqué tant
   qu'il n'a rien à dire. Deux variantes : confirmation (e-mail de
   réinitialisation parti, abonnement confirmé) et information neutre. */
.auth-error[hidden] {
  display: none;
}

.auth-error.ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.auth-error.info {
  background: #f4f5f7;
  border-color: var(--border);
  color: var(--muted);
}

/* La connexion a deux liens sous les champs (créer un compte, mot de passe
   oublié) là où le modèle n'en a qu'un. */
.auth-inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

a.auth-inline-link {
  text-decoration: none;
}

/* Aide sous un champ (règles du nom d'utilisateur, longueur du mot de
   passe). */
.field-hint {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  margin-top: 6px;
}

/* Abonnement : sous-titre d'état, prix, avantages, bandeau du mode test,
   identité dans la barre, déconnexion sous la carte. */
.auth-subtitle {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}

.auth-topbar-who {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: #6e6e73;
}

.price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 4px 0 4px;
}

.price b {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1d1d1f;
}

.price span {
  color: var(--muted);
  font-size: 14px;
}

ul.features {
  margin: 10px 0 20px;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.7;
}

.test-banner {
  background: #fdf4dc;
  color: #8a6400;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.auth-submit + .auth-submit {
  margin-top: 10px;
}

.auth-logout {
  text-align: center;
  margin-top: 20px;
}

/* ============================================================
   PAGES LÉGALES
   ============================================================ */
/* Mentions légales, confidentialité, conditions générales. Le reset en tête de
   fichier remet h1, p et ul à plat : tout le rendu du texte long tient donc
   dans ce bloc, une fois pour les trois pages plutôt qu'en <style> recopié
   trois fois. */
.legal-wrapper {
  align-items: flex-start;
  padding: 32px 24px 56px;
}

.legal-page {
  max-width: 760px;
  padding: 44px 48px;
  border-radius: 16px;
  margin: 0 auto;
}

.legal-page h1 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #1d1d1f;
}

/* Date de mise à jour, juste sous le titre. */
.legal-updated {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.legal-page h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #1d1d1f;
  margin: 32px 0 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Le premier titre suit la date : ni filet ni grand écart au-dessus. */
.legal-page h2:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 28px;
}

.legal-page h3 {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 20px 0 6px;
}

.legal-page p,
.legal-page li {
  font-size: 14.5px;
  line-height: 1.65;
  color: #3a3a3e;
}

.legal-page p + p {
  margin-top: 12px;
}

/* Un paragraphe qui reprend après une liste ou un tableau : sans cette règle
   il vient se coller au dernier point. */
.legal-page ul + p,
.legal-page .legal-scroll + p,
.legal-page .legal-callout + p {
  margin-top: 14px;
}

.legal-page ul {
  margin: 10px 0 0;
  padding-left: 20px;
  list-style: disc;
}

.legal-page li + li {
  margin-top: 7px;
}

.legal-page a {
  color: var(--accent);
}

.legal-page a:hover {
  text-decoration: underline;
}

.legal-page code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: #f2f3f5;
  border-radius: 4px;
  padding: 1px 5px;
  word-break: break-word;
}

.legal-page strong {
  font-weight: 600;
  color: #1d1d1f;
}

/* Tableau des traitements (page Confidentialité). Enveloppé dans
   .legal-scroll : sur mobile il défile seul, la page ne part pas de travers. */
.legal-scroll {
  overflow-x: auto;
  margin-top: 14px;
}

.legal-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: 13.5px;
}

.legal-table th,
.legal-table td {
  border: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
  color: #3a3a3e;
}

.legal-table th {
  background: #f7f8fa;
  font-weight: 600;
  color: #1d1d1f;
}

/* Encadré d'avertissement : sert aux points que le client doit avoir lus (mot
   de passe Facebook lisible par le serveur, risque de restriction Meta). */
.legal-callout {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #fdf4dc;
  border: 1px solid #f0e0b0;
}

.legal-callout p,
.legal-callout li {
  color: #6b5200;
}

/* Champs que l'éditeur doit renseigner avant la mise en ligne. Volontairement
   voyants : une mention légale incomplète doit sauter aux yeux. */
.legal-todo {
  background: #ffe8e8;
  color: #a11b1b;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 13px;
  font-weight: 600;
}

.legal-back {
  display: inline-block;
  margin-top: 36px;
  font-size: 14px;
  color: var(--accent);
}

.legal-back:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .legal-wrapper {
    padding: 0;
  }

  .legal-page {
    padding: 28px 20px 36px;
    border-radius: 0;
    box-shadow: none;
  }

  .legal-page h1 {
    font-size: 23px;
  }
}

/* Case d'acceptation des conditions, page d'inscription. */
.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 4px 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  cursor: pointer;
}

.auth-consent input {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  accent-color: var(--accent);
  cursor: pointer;
}

.auth-consent a {
  color: var(--accent);
}

.auth-consent a:hover {
  text-decoration: underline;
}
