@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap");
@import url("./mage-brand.css");

:root {
  --mage-green: #366c5d;
  --mage-green-dark: #2d584b;
  --mage-mint: #d4ebe4;
  --mage-mint-light: #e8f4ef;
  --mage-ink: #1a1a1a;
  --mage-muted: #5c5c5c;
  --mage-border: #e2e8e4;
  --mage-white: #ffffff;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body.auth-page {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--mage-ink);
  background: linear-gradient(160deg, var(--mage-mint) 0%, var(--mage-mint-light) 50%, #f5f5f0 100%);
  display: flex;
  flex-direction: column;
}

/* Connexion / inscription — fond FBM vert mouvant (app + CRM) */
body.auth-page.auth-page--fbm {
  position: relative;
  overflow-x: hidden;
  background: linear-gradient(135deg, #e8f4ef 0%, #a8d4c4 45%, #4a8b78 100%);
}

body.auth-page.auth-page--fbm .mage-green-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

body.auth-page.auth-page--fbm .auth-top,
body.auth-page.auth-page--fbm .auth-main {
  position: relative;
  z-index: 1;
}

body.auth-page.auth-page--fbm .auth-top a {
  color: #fff;
  text-shadow: 0 1px 2px rgba(26, 46, 40, 0.35);
}

body.auth-page.auth-page--fbm .auth-top .mage-brand-wordmark {
  color: #fff;
  text-shadow: 0 1px 2px rgba(26, 46, 40, 0.35);
}

body.auth-page.auth-page--fbm .auth-card {
  box-shadow: 0 16px 40px rgba(26, 46, 40, 0.22);
}

.auth-top {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-top .site-locale-picker--auth {
  margin-left: auto;
  order: 2;
}

.auth-top > a:not(.mage-brand-link) {
  order: 3;
}

.auth-top a {
  color: var(--mage-green);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.auth-top .mage-brand-link {
  flex: 0 0 auto;
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--mage-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(54, 108, 93, 0.14);
  overflow: hidden;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #eef2f0;
}

.auth-tab {
  padding: 14px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--mage-muted);
}

.auth-tab.active {
  background: var(--mage-white);
  color: var(--mage-ink);
}

.auth-body {
  padding: 28px 28px 32px;
}

.auth-body h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.auth-body .sub {
  margin: 0 0 22px;
  color: var(--mage-muted);
  font-size: 0.9rem;
}

.auth-field {
  margin-bottom: 14px;
}

.auth-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mage-muted);
  margin-bottom: 6px;
}

.auth-field input,
.auth-field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--mage-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
}

.auth-password-wrap {
  position: relative;
}

.auth-password-wrap input {
  padding-right: 46px;
}

.auth-password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--mage-muted);
  cursor: pointer;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
  color: var(--mage-green);
  background: var(--mage-mint-light);
  outline: none;
}

.auth-password-toggle .icon-eye-off {
  display: none;
}

.auth-password-toggle.is-visible .icon-eye {
  display: none;
}

.auth-password-toggle.is-visible .icon-eye-off {
  display: block;
}

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

.role-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.role-opt {
  position: relative;
}

.role-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.role-opt span {
  display: block;
  padding: 12px;
  border: 2px solid var(--mage-border);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.role-opt input:checked + span {
  border-color: var(--mage-green);
  background: var(--mage-mint-light);
  color: var(--mage-green-dark);
}

.auth-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.8rem;
  color: var(--mage-muted);
  margin: 16px 0;
}

.auth-check input {
  margin-top: 3px;
}

.auth-check a {
  color: var(--mage-green);
}

.btn-auth {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--mage-green);
  color: var(--mage-white);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-auth:hover {
  background: var(--mage-green-dark);
}

.btn-auth:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-google,
.btn-apple {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--mage-border);
  border-radius: var(--radius-md);
  background: var(--mage-white);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-apple {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
}

.btn-apple:hover {
  background: #000000;
  border-color: #000000;
}

.btn-apple-icon {
  flex-shrink: 0;
  display: block;
}

.auth-msg {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  display: none;
}

.auth-msg.show {
  display: block;
}

.auth-msg.error {
  background: #fef2f2;
  color: #9f1239;
  border: 1px solid #fecdd3;
}

.auth-msg.ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.auth-footer-link {
  margin-top: 16px;
  text-align: center;
  font-size: 0.85rem;
}

.auth-footer-link a,
.auth-footer-link .btn-ghost {
  color: var(--mage-green);
  font-weight: 600;
  margin-top: 0;
  font-size: inherit;
}

.auth-panel[hidden] {
  display: none !important;
}

.compte-card {
  width: min(520px, 100%);
}

.compte-banner {
  padding: 14px 18px;
  background: #fff8e6;
  border-bottom: 1px solid #f0d78c;
  font-size: 0.88rem;
  color: #6b5a20;
}

.compte-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.btn-outline-auth {
  display: block;
  text-align: center;
  padding: 12px;
  border: 1.5px solid var(--mage-green);
  border-radius: var(--radius-md);
  color: var(--mage-green);
  font-weight: 600;
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--mage-muted);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  margin-top: 12px;
}
