/* =========================================================
   Idée littéraire — Auth pages (paper + pencil)
   Surcharge de style.css pour signin / signup / forgot /
   reset / change-password. S'aligne sur la landing.
   ========================================================= */

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

:root {
  --paper:        #FBF7F1;
  --paper-2:      #F5EFE6;
  --rule-line:    rgba(159, 119, 170, 0.08);
  --shadow-paper: 0 1px 0 rgba(0,0,0,.03), 0 8px 22px -10px rgba(111, 77, 122, .25);
  --font-hand:    'Caveat', 'Brush Script MT', cursive;

  --brand-mauve:      #9F77AA;
  --brand-mauve-soft: #C5A8CF;
  --brand-mauve-deep: #6F4D7A;
}

/* ---------- Page background ---------- */
html, body { background-color: var(--paper) !important; }
body {
  background-image:
    radial-gradient(1200px 600px at 8% -10%, rgba(159,119,170,.10), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(99,102,241,.05), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 35px, var(--rule-line) 35px 36px) !important;
  -webkit-font-smoothing: antialiased;
}
.main-content { background: transparent; }

/* ---------- Lang switcher (réutilise lp-lang depuis landing.css) ---------- */
/* ---------- Vertically center the whole stack (lang row + card) ---------- */
.main-content {
  min-height: 100vh;
  display: flex; flex-direction: column;
  justify-content: center;
  padding: 1.5rem 0;
  position: relative;
}
.auth-shell {
  min-height: 0 !important;
  padding: 0 .75rem !important;
}
@media (min-width: 640px) {
  .auth-shell { padding: 0 1rem !important; }
}

.auth-top-logo {
  display: inline-flex; align-items: flex-end; justify-content: center;
  flex: 0 0 auto;
  text-decoration: none !important;
}
.auth-top-logo img { height: 42px; display: block; }
@media (max-width: 640px) {
  .auth-top-logo img { height: 32px; }
}
@media (max-width: 380px) {
  .auth-top-logo img { height: 26px; }
}

.auth-lang-row {
  display: grid;
  grid-template-areas:
    "home  ."
    "logo  lang";
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 1rem; row-gap: .35rem;
  max-width: 32rem; width: calc(100% - 2rem);
  margin: 0 auto 2.25rem;
  box-sizing: border-box;
}
.auth-lang-row .auth-home-link  { grid-area: home; justify-self: start; }
.auth-lang-row .auth-top-logo   { grid-area: logo; justify-self: start; }
.auth-lang-row .auth-lang-pills { grid-area: lang; justify-self: end; align-self: end; }
@media (max-width: 640px) {
  .auth-lang-row { width: calc(100% - 1.5rem); margin-bottom: 1.75rem; }
}

/* Solo (logo only) row used on authenticated minimalNav pages (change-password) */
.auth-lang-row-solo {
  grid-template-areas: "logo";
  grid-template-columns: 1fr;
  justify-items: center;
}
.auth-lang-row-solo .auth-top-logo { grid-area: logo; justify-self: center; }
.auth-home-link {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .8rem; border-radius: 9999px;
  font-size: .85rem; font-weight: 600;
  color: var(--gray-700);
  text-decoration: none !important;
  transition: color .15s ease, background .15s ease;
}
.auth-home-link svg { stroke-width: 2.4; }
.auth-home-link:hover {
  color: var(--brand-mauve-deep);
  background: rgba(159,119,170,.12);
}
.auth-lang-pills {
  display: inline-flex; gap: .15rem; padding: .25rem;
  background: #fff; border: 1px dashed rgba(111,77,122,.25);
  border-radius: 9999px;
}
.auth-lang-pills a {
  display: inline-block; padding: .2rem .65rem;
  font-size: .78rem; font-weight: 600; text-transform: uppercase;
  color: var(--gray-500); border-radius: 9999px;
  text-decoration: none !important;
  transition: color .15s ease, background .15s ease;
}
.auth-lang-pills a:hover {
  color: var(--brand-mauve-deep); background: rgba(159,119,170,.12);
  text-decoration: none !important;
}
.auth-lang-pills a.is-active, .auth-lang-pills a.is-active:hover {
  background: var(--brand-mauve); color: #fff;
}

/* ---------- Card / shell ---------- */
.auth-card-modern {
  background: #fff !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-paper) !important;
  border: 0 !important;
  overflow: hidden;
  /* notebook ruled-paper margin */
  background-image:
    linear-gradient(#fff, #fff),
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(159,119,170,.10) 30px 31px) !important;
  position: relative;
}
.auth-card-modern::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 38px;
  background: radial-gradient(circle at 50% 16px, rgba(159,119,170,.18) 4px, transparent 5px) repeat-y;
  background-size: 100% 32px;
  border-right: 1px solid rgba(220,38,38,.18);
  pointer-events: none;
  z-index: 1;
}

/* ---------- Hero (top of card) ---------- */
.auth-hero {
  background: transparent !important;
  color: var(--gray-900) !important;
  padding: 1.5rem 1.5rem 0 3.25rem !important;
  text-align: left !important;
}
@media (min-width: 640px) {
  .auth-hero { padding: 1.75rem 2rem 0 3.5rem !important; }
}
.auth-hero-inner { text-align: left; }
.auth-hero-title {
  font-size: 1.55rem !important; font-weight: 800 !important;
  letter-spacing: -0.01em; line-height: 1.15;
  margin: 0 0 .85rem !important;
  color: var(--gray-900) !important;
}
@media (min-width: 640px) { .auth-hero-title { font-size: 1.75rem !important; } }
.auth-hero-sub {
  color: var(--gray-700) !important; max-width: none !important;
  font-size: .98rem !important; line-height: 1.55 !important;
  margin: 0 !important;
}

/* ---------- Replace plain decorations with pencil sparkles ---------- */
.auth-deco { animation: none !important; border: 0 !important; background: transparent !important; }
.auth-deco-1, .auth-deco-2, .auth-deco-3, .auth-deco-4, .auth-deco-5, .auth-deco-6 {
  border-radius: 0 !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
  transform: none !important;
}
.auth-deco-1 { top: .8rem !important; right: 1rem !important; left: auto !important; width: 24px !important; height: 24px !important; background-image: url("/assets/img/pencil/mauve/spark.svg") !important; transform: rotate(-12deg) !important; }
.auth-deco-2 { top: 2.2rem !important; right: 2.5rem !important; width: 18px !important; height: 18px !important; background-image: url("/assets/img/pencil/mauve/star.svg") !important; transform: rotate(15deg) !important; opacity: .8; }
.auth-deco-3 { display: none !important; }
.auth-deco-4 { display: none !important; }
.auth-deco-5 { display: none !important; }
.auth-deco-6 { display: none !important; }

/* ---------- Tabs ---------- */
.auth-tabs {
  justify-content: flex-start !important; margin-top: 0 !important;
  background: var(--paper-2); padding: .25rem; border-radius: 9999px;
  display: inline-flex !important; gap: 0 !important;
}
.auth-tab {
  background: transparent !important; color: var(--gray-700) !important;
  padding: .5rem 1.1rem !important; font-weight: 600 !important;
  border-radius: 9999px !important; box-shadow: none !important;
  text-decoration: none !important;
}
.auth-tab:hover {
  background: rgba(159,119,170,.12) !important;
  color: var(--brand-mauve-deep) !important;
  text-decoration: none !important;
}
.auth-tab.active {
  background: var(--brand-mauve-deep) !important; color: #fff !important;
  box-shadow: none !important;
}
.auth-tab.active:hover { color: #fff !important; text-decoration: none !important; }

/* ---------- Body / form ---------- */
.auth-body { padding: 1.25rem 1.5rem 1.5rem 3.25rem !important; }
@media (min-width: 640px) { .auth-body { padding: 1.4rem 2rem 1.75rem 3.5rem !important; } }

.auth-label {
  font-weight: 600 !important; font-size: .88rem !important;
  color: var(--gray-700) !important;
}
.auth-form { gap: .85rem !important; }
@media (min-width: 640px) { .auth-form { gap: 1rem !important; } }
.auth-field { gap: .35rem !important; }

.auth-input {
  background: var(--paper) !important;
  border: 1px solid rgba(111,77,122,.18) !important;
  border-radius: 10px !important;
  padding: .7rem .9rem !important; font-size: .95rem !important;
  color: var(--gray-900) !important;
  transition: border-color .15s, box-shadow .15s, background .15s !important;
}
@media (min-width: 640px) { .auth-input { padding: .8rem 1rem !important; font-size: 1rem !important; } }
.auth-input::placeholder { color: var(--gray-400) !important; }
.auth-input:focus {
  background: #fff !important;
  border-color: var(--brand-mauve) !important;
  box-shadow: 0 0 0 3px rgba(159,119,170,.18) !important;
}

/* ---------- Submit (mauve-deep) ---------- */
.auth-submit {
  background: var(--brand-mauve-deep) !important;
  color: #fff !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  padding: .8rem 1.5rem !important;
  font-size: .98rem !important;
  box-shadow: none !important;
  letter-spacing: .03em;
  transition: transform .15s ease, background .15s ease !important;
}
@media (min-width: 640px) { .auth-submit { padding: .9rem 1.5rem !important; font-size: 1rem !important; } }
.auth-submit:hover:not(:disabled) {
  background: #5a3d65 !important;
  transform: translateY(-1px);
  box-shadow: none !important;
}

/* ---------- Links / secondary ---------- */
.auth-secondary-link, .auth-forgot-link {
  color: var(--brand-mauve-deep) !important;
  font-weight: 500 !important;
  text-decoration: none !important;
}
.auth-secondary-link:hover, .auth-forgot-link:hover {
  color: var(--brand-mauve) !important;
  text-decoration: none !important;
}

/* ---------- Strength indicator ---------- */
.auth-strength-card {
  background: var(--paper) !important;
  border: 1px dashed rgba(111,77,122,.25);
  border-radius: 10px !important;
}

/* ---------- Alerts ---------- */
.alert {
  border-radius: 10px !important;
  padding: .85rem 1rem !important;
  font-size: .95rem !important;
}
.alert-error {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  border: 1px dashed rgba(220,38,38,.4) !important;
}
.alert-success {
  background: #f0fdf4 !important;
  color: #15803d !important;
  border: 1px dashed rgba(34,197,94,.4) !important;
}

/* ---------- Pencil rule above the form (decorative) ---------- */
.auth-body::before {
  content: ""; display: block; height: 10px; width: 100%;
  margin: 0 0 1.1rem;
  background-image: url("/assets/img/pencil/mauve/divider-rule.svg");
  background-repeat: no-repeat; background-size: 100% 100%;
  opacity: .8;
}

/* ---------- Responsive tweaks ---------- */

/* Tablet (≤ 768px) */
@media (max-width: 768px) {
  .auth-card-wide { max-width: 28rem; }
  .auth-lang-row { max-width: 28rem; }
}

/* Mobile (≤ 640px) */
@media (max-width: 640px) {
  body {
    background-image: repeating-linear-gradient(0deg, transparent 0 32px, var(--rule-line) 32px 33px) !important;
  }
  .main-content { padding: 1rem 0; min-height: 100dvh; }
  .auth-lang-row {
    max-width: none; padding: 0 1rem; gap: .5rem;
  }
  .auth-home-link { padding: .35rem .65rem; font-size: .8rem; }
  .auth-home-link svg { width: 14px; height: 14px; }
  .auth-lang-pills a { padding: .2rem .55rem; font-size: .72rem; }
  .auth-shell { padding: 0 .75rem !important; }
  .auth-card-modern::before { width: 26px; }
  .auth-hero {
    padding: 1.25rem 1.25rem 0 2.25rem !important;
  }
  .auth-body {
    padding: 1.1rem 1.25rem 1.4rem 2.25rem !important;
  }
  .auth-hero-logo { height: 1.4rem !important; margin-bottom: .55rem !important; }
  .auth-hero-title { font-size: 1.4rem !important; margin-bottom: .65rem !important; }
  .auth-tab { padding: .4rem .85rem !important; font-size: .88rem !important; }
  .auth-deco-1 { top: .55rem !important; right: .8rem !important; width: 20px !important; height: 20px !important; }
  .auth-deco-2 { display: none !important; }
}

/* Very small phones (≤ 380px) */
@media (max-width: 380px) {
  .auth-card-modern::before { width: 22px; }
  .auth-hero { padding-left: 1.85rem !important; padding-right: 1rem !important; }
  .auth-body { padding-left: 1.85rem !important; padding-right: 1rem !important; }
  .auth-hero-title { font-size: 1.25rem !important; }
  .auth-home-link span { display: none; }
  .auth-home-link { padding: .35rem .5rem; }
  .auth-input { font-size: .9rem !important; padding: .65rem .75rem !important; }
  .auth-submit { font-size: .92rem !important; }
}

/* Landscape mobile / very short viewports — disable vertical centering so user can scroll */
@media (max-height: 620px) {
  .main-content { justify-content: flex-start; padding-top: 1rem; padding-bottom: 1rem; }
}
