/**
 * MAFAD Login – Medical Luxury Edition
 * Posizione: motusanimi-fad-v2/assets/css/mafad-login.css
 *
 * Scopato su body.tml-action-login per isolamento totale.
 * Font: DM Serif Display + DM Sans (Google Fonts)
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:opsz,wght@9..40,300;400;500;600;700&display=swap');

/* ─── VARIABILI ─────────────────────────────────────────── */
body.tml-action-login {
  --teal:     #1d9b93;
  --teal-d:   #137970;
  --teal-l:   #2ec4bb;
  --teal-ll:  #a8e6e3;
  --mag:      #c1146e;
  --mag-d:    #9c0f58;
  --violet:   #7c3aed;
  --violet-d: #6d28d9;
  --white:    #ffffff;
  --cream:    #f6fafa;
  --ink:      #0d1f1e;
  --muted:    #5e7a79;
  --border:   #d0e8e6;
  --serif:    'DM Serif Display', Georgia, serif;
  --sans:     'DM Sans', system-ui, sans-serif;
  font-family: var(--sans);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

/* Nasconde sidebar che alcune configurazioni tema iniettano */
body.tml-action-login .widget-area,
body.tml-action-login aside.sidebar,
body.tml-action-login #secondary { display: none; }

/* ─── LAYOUT ────────────────────────────────────────────── */
body.tml-action-login .mafad-login-page-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 80vh;
}
/* Versione standalone (login.php): fullscreen, zero margin */
body.mafad-login-standalone { margin: 0; padding: 0; }
body.mafad-login-standalone .mafad-login-page-wrap { min-height: 100vh; }

/* ─── BRAND PANEL ───────────────────────────────────────── */
body.tml-action-login .mafad-login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px 56px;
  overflow: hidden;
  background: linear-gradient(160deg, #0a1a19 0%, #0d2422 40%, #101c1b 100%);
  color: var(--white);
}

/* Aurora orb teal */
body.tml-action-login .mafad-login-brand::before {
  content: '';
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 75% 65% at 20% 80%, rgba(29,155,147,.22) 0%, transparent 70%);
  animation: mafad-orb-teal 14s ease-in-out infinite;
}
/* Aurora orb magenta */
body.tml-action-login .mafad-login-brand::after {
  content: '';
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 55% 55% at 88% 12%, rgba(193,20,110,.16) 0%, transparent 65%);
  animation: mafad-orb-mag 18s ease-in-out infinite;
}

/* Decorazioni SVG */
body.tml-action-login .mlb-hexgrid,
body.tml-action-login .mlb-nodes {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
}
body.tml-action-login .mlb-hexgrid {
  opacity: .35;
  animation: mafad-hex-drift 22s ease-in-out infinite;
  transform-origin: center;
}

/* Anelli decorativi */
body.tml-action-login .mlb-ring {
  position: absolute; border-radius: 50%; z-index: 1; pointer-events: none;
  border: 1px solid rgba(255,255,255,.05);
  animation: mafad-ring-breathe 8s ease-in-out infinite;
}
body.tml-action-login .mlb-ring-1 { width: 320px; height: 320px; bottom: -80px; right: -80px; animation-duration: 9s; }
body.tml-action-login .mlb-ring-2 { width: 180px; height: 180px; bottom: -20px; right: -20px; border-color: rgba(29,155,147,.12); animation-duration: 7s; animation-delay: -3s; }
body.tml-action-login .mlb-ring-3 { width: 500px; height: 500px; top: -180px; left: -200px; animation-duration: 12s; animation-delay: -6s; }

/* Sezioni brand sopra le decorazioni + entrance */
body.tml-action-login .mlb-top,
body.tml-action-login .mlb-middle,
body.tml-action-login .mlb-bottom { position: relative; z-index: 2; }
body.tml-action-login .mlb-top    { animation: mafad-enter .7s cubic-bezier(.22,1,.36,1) .1s both; }
body.tml-action-login .mlb-middle { animation: mafad-enter .7s cubic-bezier(.22,1,.36,1) .3s both; }
body.tml-action-login .mlb-bottom { animation: mafad-enter .7s cubic-bezier(.22,1,.36,1) .5s both; }

/* Logo */
body.tml-action-login .mlb-logo-link { display: flex; align-items: center; gap: 14px; text-decoration: none; }
body.tml-action-login .mlb-logo-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal), var(--teal-d));
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(29,155,147,.4);
}
body.tml-action-login .mlb-logo-icon svg { width: 22px; height: 22px; fill: none; stroke: white; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.tml-action-login .mlb-logo-link .custom-logo-link { display: flex; }
body.tml-action-login .mlb-logo-link .custom-logo { max-width: 160px; height: auto; filter: brightness(0) invert(1); }
body.tml-action-login .mlb-logo-text { display: flex; flex-direction: column; line-height: 1; }
body.tml-action-login .mlb-logo-text strong { font-family: var(--serif); font-size: 1.35rem; color: var(--white); letter-spacing: -.2px; }
body.tml-action-login .mlb-logo-text strong span { color: var(--mag); }
body.tml-action-login .mlb-logo-text em { font-style: normal; font-size: .65rem; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--teal-ll); margin-top: 3px; }

/* Headline */
body.tml-action-login .mlb-headline h2 { font-family: var(--serif); font-size: 2.6rem; font-weight: 400; line-height: 1.18; color: var(--white); letter-spacing: -.5px; margin: 0 0 16px; }
body.tml-action-login .mlb-headline h2 em { font-style: italic; color: var(--teal-l); }
body.tml-action-login .mlb-headline p { font-size: .92rem; line-height: 1.75; color: rgba(255,255,255,.55); max-width: 340px; font-weight: 300; margin: 0; }

/* Stats */
body.tml-action-login .mlb-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: rgba(255,255,255,.07); border-radius: 14px; overflow: hidden; margin-top: 32px;
}
body.tml-action-login .mlb-stat { padding: 18px 16px; background: rgba(255,255,255,.04); transition: background .2s; }
body.tml-action-login .mlb-stat:hover { background: rgba(255,255,255,.07); }
body.tml-action-login .mlb-stat-num { font-family: var(--serif); font-size: 1.8rem; color: var(--teal-l); line-height: 1; margin-bottom: 4px; }
body.tml-action-login .mlb-stat-num sup { font-size: 1rem; color: var(--mag); }
body.tml-action-login .mlb-stat-label { font-size: .72rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.4); }

/* Badge AGENAS */
body.tml-action-login .mlb-badge { display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 50px; width: fit-content; }
body.tml-action-login .mlb-badge span { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.65); }
body.tml-action-login .mlb-badge-dot { width: 7px; height: 7px; background: var(--teal-l); border-radius: 50%; flex-shrink: 0; animation: mafad-badge-pulse 2.4s ease-in-out infinite; }

/* ─── FORM PANEL ────────────────────────────────────────── */
body.tml-action-login .mafad-login-form-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px; background: var(--cream); position: relative;
}
body.tml-action-login .mafad-login-form-panel::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 80% 20%, rgba(29,155,147,.06) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(193,20,110,.04) 0%, transparent 50%);
}

/* Card */
body.tml-action-login .mafad-login-card {
  position: relative; z-index: 1; width: 100%; max-width: 408px;
  background: var(--white); border-radius: 24px;
  box-shadow: 0 0 0 1px rgba(29,155,147,.08), 0 4px 6px rgba(0,0,0,.04), 0 20px 60px rgba(13,31,30,.1);
  padding: 48px 44px 40px;
  animation: mafad-card-in .5s cubic-bezier(.22,1,.36,1) both;
}

/* Security pill */
body.tml-action-login .mlc-security-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 8px; background: rgba(29,155,147,.08); border: 1px solid rgba(29,155,147,.15); border-radius: 50px; margin-bottom: 20px; }
body.tml-action-login .mlc-security-pill svg { width: 13px; height: 13px; stroke: var(--teal); fill: none; stroke-width: 2; }
body.tml-action-login .mlc-security-pill span { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--teal-d); }

body.tml-action-login .mlc-title { font-family: var(--serif); font-size: 2rem; font-weight: 400; color: var(--ink); letter-spacing: -.4px; margin: 0 0 4px; line-height: 1.2; }
body.tml-action-login .mlc-subtitle { font-size: .9rem; color: var(--muted); font-weight: 300; margin: 0 0 20px; }
body.tml-action-login .mlc-divider { display: block; width: 32px; height: 2px; background: linear-gradient(90deg, var(--teal), var(--mag)); border-radius: 2px; margin-bottom: 28px; }

/* ─── TML FORM ──────────────────────────────────────────── */
body.tml-action-login .tml { font-family: var(--sans); font-size: 1rem; }
body.tml-action-login .tml .tml-field-wrap { margin-bottom: 18px; }
body.tml-action-login .tml .tml-label { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); margin: 0 0 8px; }
body.tml-action-login .tml .tml-field {
  width: 100%; box-sizing: border-box; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: 12px;
  font-family: var(--sans); font-size: .95rem; color: var(--ink);
  background: #fafefe; outline: none; appearance: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
body.tml-action-login .tml .tml-field:focus { border-color: var(--teal); background: var(--white); box-shadow: 0 0 0 4px rgba(29,155,147,.1); }
body.tml-action-login .tml .tml-field::placeholder { color: #a0b8b7; font-weight: 300; font-size: .9rem; }

/* Remember me */
body.tml-action-login .tml .tml-rememberme-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 0; }
body.tml-action-login .tml .tml-checkbox { width: 15px; height: 15px; accent-color: var(--teal); cursor: pointer; margin: 0; flex-shrink: 0; }
body.tml-action-login .tml .tml-checkbox + .tml-label { font-size: .85rem; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); cursor: pointer; margin: 0; }

/* Meta row (remember + forgot) */
body.tml-action-login .mafad-meta-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 8px; }
body.tml-action-login .mafad-forgot-link { font-size: .83rem; color: var(--teal); text-decoration: none; font-weight: 500; transition: color .2s; }
body.tml-action-login .mafad-forgot-link:hover { color: var(--mag); }

/* ─── RECAPTCHA ─────────────────────────────────────────── */
body.tml-action-login .mafad-captcha-notice {
  display: flex; align-items: center; gap: 8px;
  font-size: .73rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--mag); margin-bottom: 10px;
}
body.tml-action-login .mafad-captcha-notice::before {
  content: ''; display: inline-block; width: 3px; height: 14px;
  background: var(--mag); border-radius: 2px; flex-shrink: 0;
}
body.tml-action-login .mafad-captcha-box-wrap {
  padding: 12px 14px; background: #fafefe;
  border: 1.5px solid var(--border); border-radius: 12px;
  margin-bottom: 20px; overflow: hidden;
}
/* Nasconde testo rosso iniettato da plugin captcha */
body.tml-action-login .mafad-login-card [style*="color:red"],
body.tml-action-login .mafad-login-card [style*="color: red"],
body.tml-action-login .mafad-login-card font[color="red"] { display: none !important; }

/* ─── SUBMIT BUTTON ─────────────────────────────────────── */
/* Selettori unificati: copre tutti i casi emessi da TML v7 e WP */
body.tml-action-login button.tml-button,
body.tml-action-login button[type="submit"],
body.tml-action-login .tml-submit-wrap button,
body.tml-action-login .tml-submit-wrap input,
body.tml-action-login .tml .tml-submit,
body.tml-action-login .tml input[type="submit"],
body.tml-action-login .mafad-login-card input[type="submit"],
body.tml-action-login .button-primary {
  display: block !important;
  width: 100% !important;
  padding: 14px 24px !important;
  margin: 0 !important;
  background: linear-gradient(135deg, var(--teal-l) 0%, var(--teal) 50%, var(--teal-d) 100%) !important;
  color: var(--white) !important;
  border: none !important;
  border-radius: 12px !important;
  font-family: var(--sans) !important;
  font-size: .95rem !important;
  font-weight: 700 !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
  cursor: pointer !important;
  box-shadow: 0 4px 20px rgba(29,155,147,.38) !important;
  height: auto !important;
  line-height: 1.4 !important;
  text-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  outline: none !important;
  position: relative !important;
  overflow: hidden !important;
  transition: transform .2s, box-shadow .2s !important;
}

/* Shimmer: solo su <button>, gli <input> non supportano ::before */
body.tml-action-login button.tml-button::before,
body.tml-action-login .tml-submit-wrap button::before,
body.tml-action-login .tml .tml-submit::before {
  content: '' !important;
  position: absolute !important; top: 0 !important; left: -100% !important;
  width: 100% !important; height: 100% !important;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent) !important;
  transition: left .5s !important;
  pointer-events: none !important;
}

/* Hover */
body.tml-action-login button.tml-button:hover,
body.tml-action-login button[type="submit"]:hover,
body.tml-action-login .tml-submit-wrap button:hover,
body.tml-action-login .tml .tml-submit:hover,
body.tml-action-login .tml input[type="submit"]:hover,
body.tml-action-login .mafad-login-card input[type="submit"]:hover,
body.tml-action-login .button-primary:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 28px rgba(29,155,147,.5) !important;
}
body.tml-action-login button.tml-button:hover::before,
body.tml-action-login .tml-submit-wrap button:hover::before,
body.tml-action-login .tml .tml-submit:hover::before { left: 100% !important; }

/* Active */
body.tml-action-login button.tml-button:active,
body.tml-action-login .tml-submit-wrap button:active,
body.tml-action-login .tml .tml-submit:active { transform: translateY(0) !important; }

/* ─── ERRORI E MESSAGGI ─────────────────────────────────── */
body.tml-action-login .tml .tml-alerts { margin-bottom: 16px; }
body.tml-action-login .tml .tml-errors,
body.tml-action-login .tml .tml-messages { list-style: none; margin: 0; padding: 0; }
body.tml-action-login .tml .tml-error {
  background: #fff0f4; border: 1px solid rgba(193,20,110,.2); border-left: 3px solid var(--mag) !important;
  border-radius: 10px; padding: 10px 14px; font-size: .88rem; color: var(--mag-d); margin-bottom: 8px;
}
body.tml-action-login .tml .tml-message {
  background: #f0faf9; border: 1px solid rgba(29,155,147,.2); border-left: 3px solid var(--teal) !important;
  border-radius: 10px; padding: 10px 14px; font-size: .88rem; color: var(--teal-d); margin-bottom: 8px;
}

/* ─── LINKS (password dimenticata / registrati) ─────────── */
body.tml-action-login .tml .tml-links {
  list-style: none; margin: 20px 0 0; padding: 16px 0 0;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; text-align: center;
}
body.tml-action-login .tml .tml-links li { margin: 0; padding: 0; list-style: none; }
body.tml-action-login .tml .tml-links li a { font-size: .87rem; color: var(--teal); text-decoration: none; font-weight: 500; transition: color .2s; }
body.tml-action-login .tml .tml-links li a:hover { color: var(--mag); }

/* Registrati: violetto */
body.tml-action-login .tml .tml-register-link a { color: var(--violet) !important; font-weight: 700 !important; }
body.tml-action-login .tml .tml-register-link a:hover { color: var(--violet-d) !important; }

/* Label "Non hai ancora un account?" (iniettata via JS) */
body.tml-action-login p.mafad-register-label { margin: 0 0 4px; text-align: center; font-size: .82rem; color: rgba(0,0,0,.45); line-height: 1.4; }

/* ─── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 920px) {
  body.tml-action-login .mafad-login-page-wrap { grid-template-columns: 1fr; }

  /* Brand: grid 2 colonne — [logo / badge] sx | motto dx */
  body.tml-action-login .mafad-login-brand {
    padding: 20px 24px 18px; min-height: unset;
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
    column-gap: 20px; align-items: start;
  }
  body.tml-action-login .mlb-top    { grid-column: 1; grid-row: 1; }
  body.tml-action-login .mlb-bottom { grid-column: 1; grid-row: 2; margin-top: 8px; }
  body.tml-action-login .mlb-middle { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; grid-column: 2; grid-row: 1 / 3; text-align: right; }
  body.tml-action-login .mlb-headline h2 { font-size: 1.55rem; margin-bottom: 0; line-height: 1.2; }
  body.tml-action-login .mlb-headline p  { display: none; }
  body.tml-action-login .mlb-stats       { display: none; }
  body.tml-action-login .mlb-bottom .mlb-badge      { padding: 6px 12px; gap: 7px; }
  body.tml-action-login .mlb-bottom .mlb-badge span { font-size: .62rem; letter-spacing: .06em; }
  body.tml-action-login .mlb-bottom .mlb-badge-dot  { width: 5px; height: 5px; }
  body.tml-action-login .mlb-ring-3 { display: none; }
  body.tml-action-login .mlb-canvas { opacity: .12; }
}
@media (max-width: 520px) {
  body.tml-action-login .mafad-login-brand      { padding: 18px 20px 16px; column-gap: 16px; }
  body.tml-action-login .mafad-login-form-panel { padding: 24px 16px; }
  body.tml-action-login .mafad-login-card       { padding: 32px 22px 28px; border-radius: 18px; }
  body.tml-action-login .mlc-title              { font-size: 1.7rem; }
  body.tml-action-login .mlb-headline h2        { font-size: 1.25rem; }
}

/* ─── KEYFRAMES ─────────────────────────────────────────── */
@keyframes mafad-orb-teal {
  0%   { transform: translate(0,0)     scale(1);    opacity: .22; }
  30%  { transform: translate(8%,-12%) scale(1.12); opacity: .28; }
  60%  { transform: translate(-6%,8%)  scale(.92);  opacity: .18; }
  100% { transform: translate(0,0)     scale(1);    opacity: .22; }
}
@keyframes mafad-orb-mag {
  0%   { transform: translate(0,0)     scale(1);    opacity: .14; }
  40%  { transform: translate(-10%,9%) scale(1.15); opacity: .20; }
  70%  { transform: translate(7%,-7%)  scale(.88);  opacity: .10; }
  100% { transform: translate(0,0)     scale(1);    opacity: .14; }
}
@keyframes mafad-hex-drift {
  0%,100% { transform: translate(0,0); }
  50%     { transform: translate(-18px,-12px); }
}
@keyframes mafad-ring-breathe {
  0%,100% { transform: scale(1);    opacity: 1; }
  50%     { transform: scale(1.06); opacity: .6; }
}
@keyframes mafad-enter {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes mafad-card-in {
  from { opacity: 0; transform: translateY(20px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes mafad-badge-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(46,196,187,.5); }
  50%     { box-shadow: 0 0 0 6px rgba(46,196,187,0); }
}

/* ─── LOADING OVERLAY ───────────────────────────────────── */
.mafad-login-loading {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(13,36,34,.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
.mafad-login-loading.is-visible { opacity: 1; pointer-events: all; }
.mafad-login-loading__box { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.mafad-login-loading__spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 3px solid rgba(46,196,187,.15);
  border-top-color: var(--teal-l, #2ec4bb);
  border-right-color: var(--mag, #c1146e);
  animation: mafad-spin .9s cubic-bezier(.6,.2,.4,.8) infinite;
}
@keyframes mafad-spin { to { transform: rotate(360deg); } }
.mafad-login-loading__msg {
  font-family: var(--sans, 'DM Sans', sans-serif);
  font-size: .85rem; font-weight: 500; letter-spacing: .06em;
  color: rgba(255,255,255,.7); margin: 0;
  animation: mafad-pulse-text 1.6s ease-in-out infinite;
}
@keyframes mafad-pulse-text {
  0%,100% { opacity: .7; }
  50%     { opacity: 1; }
}