/**
 * Mada branded auth pages — /user/login and /user/password.
 *
 * The form's #prefix / #suffix (set in mada_admin.theme) emit the shell:
 *   .mada-auth-shell > .mada-auth-brand + .mada-auth-panel > .mada-auth-card
 * so this file only has to neutralise the admin chrome and lay the shell out.
 */

body.mada-auth {
  --t: #1C8577;
  --td: #0E5D53;
  --tb: #23A08D;
  --canvas: #F4F2EC;
  --ink: #16232A;
  --muted: #6A7681;
  --line: #E4E0D6;
  --field-border: #CBD5D2;

  margin: 0 !important;
  padding: 0 !important;
  background: var(--canvas) !important;
  font-family: var(--gin-font, "Readex Pro", "Segoe UI", system-ui, sans-serif);
  color: var(--ink);
}

/* Hide every scrap of admin chrome (matched against the real Gin markup). */
body.mada-auth #toolbar-administration,
body.mada-auth .admin-toolbar,
body.mada-auth .gin-secondary-toolbar,
body.mada-auth .gin-primary-toolbar,
body.mada-auth .gin-back-to-site,
body.mada-auth .gin-sidebar,
body.mada-auth > .page-wrapper > header,
body.mada-auth header.region,
body.mada-auth .region-sticky,
body.mada-auth .region-sticky__items,
body.mada-auth [class*="navigation-top-bar"],
body.mada-auth .region-header,
body.mada-auth .content-header,
body.mada-auth .region-breadcrumb,
body.mada-auth .block-page-title-block,
body.mada-auth #block-mada-admin-page-title,
body.mada-auth h1.page-title,
body.mada-auth .tabs-wrapper,
body.mada-auth nav[data-drupal-nav-tabs],
body.mada-auth nav.tabs,
body.mada-auth .tabs,
body.mada-auth .help,
body.mada-auth footer.site-footer {
  display: none !important;
}

/* Collapse the wrapper chain so the shell fills the viewport. */
body.mada-auth .page-wrapper,
body.mada-auth .dialog-off-canvas-main-canvas,
body.mada-auth .layout-container,
body.mada-auth main,
body.mada-auth main.page-content,
body.mada-auth .page-content,
body.mada-auth .layout-content,
body.mada-auth .region-content,
body.mada-auth .region-content > div,
body.mada-auth .block-system-main-block,
body.mada-auth #block-mada-admin-content {
  display: contents !important;
}

/* The submit button must always be visible inside the card, whatever Gin's
 * sticky-form-actions leaves behind. */
body.mada-auth #edit-actions,
body.mada-auth .form-actions,
body.mada-auth .gin-sticky-form-actions {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  clip: auto !important;
  clip-path: none !important;
  box-shadow: none !important;
  background: none !important;
  padding: 0 !important;
  border: 0 !important;
  margin: 8px 0 0 !important;
  width: auto !important;
  pointer-events: auto !important;
}

body.mada-auth #edit-submit,
body.mada-auth .mada-auth-submit,
body.mada-auth .form-actions .button {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Hide any duplicate sticky bar Gin may still inject outside the form. */
body.mada-auth .gin-sticky-form-actions--wrapper,
body.mada-auth [data-drupal-selector="gin-sticky-form-actions"] {
  display: none !important;
}

/* ---- Language switch ---- */
.mada-lang {
  position: absolute;
  inset-block-start: 22px;
  inset-inline-end: 24px;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(22, 35, 42, 0.05);
  font-size: 0.76rem;
}

.mada-lang__opt {
  padding: 4px 11px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
}

.mada-lang__opt.is-active {
  background: #fff;
  color: var(--td);
  box-shadow: 0 1px 3px rgba(15, 42, 49, 0.12);
}

/* Messages float above the split. */
body.mada-auth .region-highlighted,
body.mada-auth .messages__wrapper {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 1001;
  margin: 0;
  padding: 14px clamp(16px, 4vw, 48px);
  display: block !important;
}

/* ---- Shell -----------------------------------------------------
 * Pinned to the viewport so no admin wrapper can constrain or
 * offset it — the collapse rules above are just tidy-up.
 */
.mada-auth-shell {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow-y: auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  direction: rtl;
  background: var(--canvas);
}

/* ---- Brand side ---------------------------------------------- */
.mada-auth-brand {
  position: relative;
  overflow: hidden;
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    radial-gradient(130% 120% at 100% 0%, rgba(255, 255, 255, 0.16), transparent 55%),
    radial-gradient(120% 140% at 0% 100%, rgba(0, 0, 0, 0.22), transparent 55%),
    linear-gradient(155deg, var(--tb), var(--td));
}

.mada-auth-brand::after {
  content: "";
  position: absolute;
  inset-block-start: -80px;
  inset-inline-start: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  border: 40px solid rgba(255, 255, 255, 0.06);
}

.mada-auth-brand__top {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.mada-auth-brand__logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 1.35rem;
  font-weight: 700;
}

.mada-auth-brand__name {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.mada-auth-brand__name span {
  display: block;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  opacity: 0.75;
}

.mada-auth-brand__body { position: relative; }

.mada-auth-brand__body h2 {
  margin: 0 0 22px;
  font-size: 2rem;
  font-weight: 650;
  line-height: 1.25;
  max-width: 12ch;
}

.mada-auth-brand__points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.mada-auth-brand__points li {
  position: relative;
  padding-inline-start: 26px;
  font-size: 0.92rem;
  opacity: 0.92;
}

.mada-auth-brand__points li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 6px;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.85);
}

.mada-auth-brand__foot {
  position: relative;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* ---- Form side --------------------------------------------- */
.mada-auth-panel {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.mada-auth-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding-block-start: 34px;
}

.mada-auth-card__title {
  margin: 0 0 6px;
  font-size: 1.6rem;
  font-weight: 650;
}

.mada-auth-card__lead {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

body.mada-auth form {
  display: grid;
  gap: 16px;
}

body.mada-auth .form-item {
  margin: 0;
}

body.mada-auth .form-item label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--ink);
}

body.mada-auth input.form-text,
body.mada-auth input.form-email,
body.mada-auth input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--field-border);
  border-radius: 11px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

body.mada-auth input.form-text:focus,
body.mada-auth input.form-email:focus,
body.mada-auth input[type="password"]:focus {
  outline: none;
  border-color: var(--t);
  box-shadow: 0 0 0 3px rgba(28, 133, 119, 0.16);
}

body.mada-auth .description,
body.mada-auth .form-item__description {
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--muted);
}

body.mada-auth .form-actions {
  margin: 6px 0 0;
}

body.mada-auth .form-actions .button,
body.mada-auth input.button--primary,
body.mada-auth .button--primary {
  width: 100%;
  padding: 12px 18px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--t);
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  transition: background-color 0.13s ease, transform 0.05s ease;
}

body.mada-auth .form-actions .button:hover,
body.mada-auth .button--primary:hover {
  background: var(--td);
}

body.mada-auth .form-actions .button:active {
  transform: translateY(1px);
}

.mada-auth-card__aux {
  margin-top: 20px;
  text-align: center;
  font-size: 0.85rem;
}

.mada-auth-card__aux a {
  color: var(--td);
  font-weight: 550;
  text-decoration: none;
}

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

/* ---- Responsive ---------------------------------------- */
@media (max-width: 880px) {
  .mada-auth-shell {
    grid-template-columns: 1fr;
  }
  .mada-auth-brand {
    padding: 28px;
    flex-direction: row;
    align-items: center;
    gap: 18px;
  }
  .mada-auth-brand__body,
  .mada-auth-brand__foot {
    display: none;
  }
  .mada-auth-panel {
    padding: 32px 20px 48px;
  }
}
