/* ═══════════════════════════════════════════════════════════
   IB PORTAL DASHBOARD — CHANGE PASSWORD (inline form)
   Loaded after portal.css / portal-responsive.css.

   The form lives inside #ibp-app as a normal .ibp-card, so every
   selector here is scoped to #ibp-app and inherits the dashboard's
   design tokens. Field, meter, toggle, message, and button visuals
   are unchanged from the earlier dialog — only the chrome (backdrop,
   fixed positioning, close button) is gone.
   ═══════════════════════════════════════════════════════════ */

#ibp-app .ibp-pwd-form,
#ibp-app .ibp-pwd-form *,
#ibp-app .ibp-pwd-form *::before,
#ibp-app .ibp-pwd-form *::after {
  box-sizing: border-box;
}

/* Body padding matches .ibp-stack, the plugin's standard card body. */
#ibp-app .ibp-pwd-form {
  padding: 20px;
}

#ibp-app .ibp-pwd-intro {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ibp-mid);
}


/* ── Fields ─────────────────────────────────────────────── */

#ibp-app .ibp-pwd-field {
  margin-bottom: 16px;
}

#ibp-app .ibp-pwd-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

#ibp-app .ibp-pwd-field input[type="password"],
#ibp-app .ibp-pwd-field input[type="text"] {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  margin: 0;
  font-family: inherit;
  font-size: 14px;
  color: var(--ibp-text);
  background: #f8fafc;
  border: 1px solid var(--ibp-border);
  border-radius: 10px;
  box-shadow: none;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

#ibp-app .ibp-pwd-field input:focus {
  background: #fff;
  border-color: var(--ibp-blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

#ibp-app .ibp-pwd-field input:focus-visible {
  outline: 2px solid var(--ibp-blue);
  outline-offset: 2px;
}

#ibp-app .ibp-pwd-field.has-error input {
  border-color: var(--ibp-red);
  background: #fef2f2;
}

#ibp-app .ibp-pwd-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--ibp-muted);
}


/* ── Strength meter — four steps, advisory only ─────────── */

#ibp-app .ibp-pwd-meter {
  height: 4px;
  margin-top: 8px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

#ibp-app .ibp-pwd-meter__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--ibp-red);
  transition: width .2s ease, background-color .2s ease;
}

#ibp-app .ibp-pwd-meter__fill.is-1 { width: 25%;  background: var(--ibp-red); }
#ibp-app .ibp-pwd-meter__fill.is-2 { width: 50%;  background: var(--ibp-amber); }
#ibp-app .ibp-pwd-meter__fill.is-3 { width: 75%;  background: var(--ibp-blue); }
#ibp-app .ibp-pwd-meter__fill.is-4 { width: 100%; background: var(--ibp-green); }


/* ── Show passwords ─────────────────────────────────────── */

#ibp-app .ibp-pwd-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  color: var(--ibp-mid);
  cursor: pointer;
  user-select: none;
}

#ibp-app .ibp-pwd-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ibp-blue);
  cursor: pointer;
}

#ibp-app .ibp-pwd-toggle input:focus-visible {
  outline: 2px solid var(--ibp-blue);
  outline-offset: 2px;
}


/* ── Result message ─────────────────────────────────────── */

#ibp-app .ibp-pwd-msg {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  line-height: 1.45;
}

#ibp-app .ibp-pwd-msg[hidden] {
  display: none !important;
}

#ibp-app .ibp-pwd-msg.is-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

#ibp-app .ibp-pwd-msg.is-success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}


/* ── Actions ────────────────────────────────────────────── */

#ibp-app .ibp-pwd-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Padding, font, and radius are pinned because a theme styling every
   <button> would otherwise win — .ibp-pwd-btn carries no !important
   of its own and these buttons sit in page flow, not in a dialog. */
#ibp-app button.ibp-pwd-btn {
  height: 42px;
  min-height: 0 !important;
  width: auto !important;
  padding: 0 18px !important;
  margin: 0 !important;
  font: inherit !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

#ibp-app button.ibp-pwd-btn[disabled] {
  opacity: .6;
  cursor: not-allowed;
}

#ibp-app button.ibp-pwd-btn:focus-visible {
  outline: 2px solid var(--ibp-blue);
  outline-offset: 2px;
}

#ibp-app button.ibp-pwd-btn--ghost {
  background: #fff !important;
  border-color: var(--ibp-border) !important;
  color: var(--ibp-mid) !important;
}

#ibp-app button.ibp-pwd-btn--ghost:hover:not([disabled]) {
  background: #f8fafc !important;
  color: var(--ibp-text) !important;
}

#ibp-app button.ibp-pwd-btn--primary {
  background: var(--ibp-blue) !important;
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .22) !important;
}

#ibp-app button.ibp-pwd-btn--primary:hover:not([disabled]) {
  background: var(--ibp-blue-dk) !important;
}


/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 480px) {

  #ibp-app .ibp-pwd-form {
    padding: 16px;
  }

  #ibp-app .ibp-pwd-actions {
    gap: 8px;
  }

  /* Full-width buttons read better than two small ones on a phone. */
  #ibp-app button.ibp-pwd-btn {
    flex: 1 1 0;
  }
}


/* ── Accessibility ──────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {

  #ibp-app .ibp-pwd-meter__fill,
  #ibp-app button.ibp-pwd-btn,
  #ibp-app .ibp-pwd-field input {
    transition: none;
  }
}
