/* Membership Pro auth.css
   Improved styles for modal auth, password meter, social buttons,
   header icon injection, responsive behavior and accessibility.
   Place in assets/css/auth.css
*/

/* ---------- Base modal & layout ---------- */
.mp-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}
.mp-modal[aria-hidden="false"] { display: flex; }

.mp-modal-card {
  width: 920px;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  display: flex;
  overflow: hidden;
  position: relative;
  align-items: stretch;
}

/* Left panel (illustration / branding) */
.mp-modal-left {
  flex: 1;
  padding: 36px;
  background: linear-gradient(180deg,#f7fbff,#fff);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  min-width: 260px;
}
.mp-modal-left h2 { margin: 0; font-size: 22px; color: #0b3b66; line-height: 1.15; }
.mp-modal-left .mp-branding { color: #556; font-size: 14px; }
.mp-modal-left .mp-illustration { width: 100%; max-width: 260px; opacity: 0.95; display:block; }

/* Right panel (forms) */
.mp-modal-right {
  width: 420px;
  padding: 24px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Tabs */
.mp-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.mp-tab {
  flex: 1;
  padding: 10px 12px;
  background: #f2f6fb;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  font-weight: 500;
  color: #234;
}
.mp-tab.active {
  background: #fff;
  border-color: #e1eefb;
  box-shadow: 0 2px 6px rgba(30,136,229,0.08);
  color: #0b66c2;
  font-weight: 600;
}

/* Forms */
.mp-form { display: none; gap: 10px; }
.mp-form label { display: block; font-size: 13px; color: #334; margin-bottom: 8px; }
.mp-form input[type="text"],
.mp-form input[type="email"],
.mp-form input[type="password"],
.mp-form input[type="number"],
.mp-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d6dfe9;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  background: #fff;
  color: #1f2937;
}
.mp-form textarea { min-height: 80px; resize: vertical; }

/* Buttons */
.mp-btn { display: inline-block; padding: 10px 14px; border-radius: 8px; border: 0; cursor: pointer; font-weight: 600; text-align: center; }
.mp-btn-primary { background: #1E88E5; color: #fff; }
.mp-btn-secondary { background: #f2f4f7; color: #0b3b66; }
.mp-btn-social { width: 100%; margin-top: 8px; background: #fff; border: 1px solid #e6eefb; color: #334; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; }

/* Social buttons inline variant */
.mp-socials { display: flex; gap: 8px; margin-top: 12px; }
.mp-socials .mp-btn-social { flex: 1; padding: 10px; }

/* Error and notes */
.mp-form-note { margin-top: 10px; font-size: 13px; color: #c00; }
.mp-error { color: #c00; margin-top: 8px; display: block; }

/* Password meter (visual bar) */
.mp-pass-meter { width: 100%; height: 8px; margin-top: 8px; background: #eee; border-radius: 6px; overflow: hidden; }
.mp-pass-meter .mp-pass-bar { display: block; height: 100%; width: 0%; transition: width 220ms ease, background-color 220ms ease; border-radius: 6px; }
.mp-pass-weak { background: #f87171 !important; }   /* red */
.mp-pass-medium { background: #f59e0b !important; } /* amber */
.mp-pass-strong { background: #10b981 !important; } /* green */

/* Success panel */
.mp-panel-success { padding: 12px; background: #f6ffef; border-radius: 8px; border: 1px solid #e6f7df; color: #166534; }

/* Profile wrapper and icon button */
.mp-profile-wrapper { display: inline-block; }
.mp-icon-btn { background: transparent; border: 0; cursor: pointer; padding: 6px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.mp-icon-btn img, .mp-icon-btn svg { display: block; max-width: 100%; height: auto; }

/* Remember me checkbox inline layout */
.mp-remember { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0; }
.mp-remember input[type="checkbox"] {
  margin: 0;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #cfd8e3;
  border-radius: 4px;
  background: #fff;
  position: relative;
}
.mp-remember input[type="checkbox"]:checked { background: #1E88E5; border-color: #1E88E5; }
.mp-remember input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.mp-remember label { margin: 0; cursor: pointer; font-size: 14px; color: #334; }

/* ---------- Header icon positioning (no theme edits required) ---------- */
/* Common nav selectors: ensure relative positioning (JS also enforces) */
#nav-main, .main-navigation, .site-navigation, nav[role="navigation"], nav {
  position: relative;
}

/* Wrapper appended directly to nav (not inside UL) */
.mp-profile-absolute-wrapper {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  padding: 0 8px;
  z-index: 9999;
  pointer-events: auto;
  background: transparent;
}

/* Ensure inner button scales to nav height; JS will set explicit px height */
.mp-profile-absolute-wrapper .mp-icon-btn img,
.mp-profile-absolute-wrapper .mp-icon-btn svg {
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
  transition: none !important;
}

/* UL padding fallback class (JS will set dynamic value) */
.mp-menu-padding-adjust { padding-right: 80px !important; }

/* Injected icon <li> fallback */
li.mp-profile-absolute {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 8px;
  z-index: 9999;
  background: transparent;
}
li.mp-profile-absolute .mp-icon-btn img,
li.mp-profile-absolute .mp-icon-btn svg {
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
  transition: none !important;
}

/* Mobile adjustments */
@media (max-width: 720px) {
  .mp-modal-card { flex-direction: column; width: 100%; }
  .mp-modal-left { display: none; }
  .mp-modal-right { width: 100%; }

  .mp-profile-absolute-wrapper,
  li.mp-profile-absolute {
    position: static !important;
    transform: none !important;
    padding: 6px;
    height: auto;
  }

  .mp-profile-absolute-wrapper .mp-icon-btn img,
  .mp-profile-absolute-wrapper .mp-icon-btn svg,
  li.mp-profile-absolute .mp-icon-btn img,
  li.mp-profile-absolute .mp-icon-btn svg {
    height: auto;
    max-height: 64px;
    min-height: 28px;
    width: auto;
    display: block;
  }

  .mp-menu-padding-adjust { padding-right: 0 !important; }
}

/* Desktop explicit behavior */
@media (min-width: 721px) {
  .mp-profile-absolute-wrapper,
  li.mp-profile-absolute {
    top: 50%;
    transform: translateY(-50%);
    right: 8px;
    height: 100%;
    align-items: center;
  }
  .mp-profile-absolute-wrapper .mp-icon-btn img,
  .mp-profile-absolute-wrapper .mp-icon-btn svg,
  li.mp-profile-absolute .mp-icon-btn img,
  li.mp-profile-absolute .mp-icon-btn svg {
    height: 100%;
    width: auto;
  }
}

/* ---------- Close button style ---------- */
.mp-modal-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: 0;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 12000;
  color: #333;
  padding: 4px;
  border-radius: 6px;
}
.mp-modal-close:hover { background: rgba(0,0,0,0.06); color: #000; }

/* ---------- Social buttons small adjustments ---------- */
.mp-socials .mp-btn-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

/* ---------- Accessibility and focus ---------- */
.mp-btn:focus, .mp-icon-btn:focus, .mp-modal-close:focus, .mp-tab:focus, .mp-form input:focus {
  outline: 3px solid rgba(30,136,229,0.18);
  outline-offset: 2px;
}

/* ---------- Illustration sizing ---------- */
.mp-illustration { max-height: 220px; width: auto; display: block; margin: 0 auto 16px; }
@media (max-width: 600px) { .mp-illustration { max-height: 140px; } }

/* ---------- Password meter fallback classes (for compatibility) ---------- */
.mp-pass-meter { width: 100%; height: 6px; margin-top: 6px; background: #eee; border-radius: 4px; overflow: hidden; display: block; }
.mp-pass-meter .bar { height: 6px; display: block; }

/* ---------- Minor utilities ---------- */
.hidden { display: none !important; }
.center { text-align: center; }

/* ---------- Prevent layout jitter on mobile for injected icons ---------- */
.mp-profile-absolute img, .mp-profile-absolute svg,
.mp-profile-absolute-wrapper img, .mp-profile-absolute-wrapper svg {
  transition: none !important;
}
