/**
 * @file
 * Theme styling for user module.
 */

/* Visual styling for the Password strength indicator */
.password-strength__meter {
  margin-top: 0.5em;
  background-color: #ebeae4;
}
.password-strength__indicator {
  background-color: #77b259;
  -webkit-transition: width 0.5s ease-out;
  transition: width 0.5s ease-out;
}
.password-strength__indicator.is-weak {
  background-color: #e62600;
}
.password-strength__indicator.is-fair {
  background-color: #e09600;
}
.password-strength__indicator.is-good {
  background-color: #0074bd;
}
.password-strength__indicator.is-strong {
  background-color: #77b259;
}

.password-confirm,
.password-field,
.password-strength,
.password-confirm-match {
  width: 55%;
}

.password-suggestions {
  padding: 0.2em 0.5em;
  margin: 0.7em 0;
  max-width: 34.7em;
  border: 1px solid #b4b4b4;
}
.password-suggestions ul {
  margin-bottom: 0;
}

.confirm-parent,
.password-parent {
  clear: left; /* LTR */
  margin: 0;
  max-width: 33em;
  overflow: hidden;
}
[dir="rtl"] .confirm-parent,
[dir="rtl"] .password-parent {
  clear: right;
}

/* Styling for the status indicator of the passwords match test.  */
.password-confirm .ok {
  color: #325e1c;
  font-weight: bold;
}
.password-confirm .error {
  color: #a51b00;
  font-weight: bold;
}

/* ============================================================
   Settings page — user edit form layout
   ============================================================ */

.path-user {
  background: #edf1f5;
}

body.path-user:has(#user-form) #toolbar-administration,
body.path-user:has(#user-form) header[role="banner"],
body.path-user:has(#user-form) .region-breadcrumb,
body.path-user:has(#user-form) nav[aria-label="breadcrumb"],
body.path-user:has(#user-form) .breadcrumb,
body.path-user:has(#user-form) [aria-label="Open configuration options"],
body.path-user:has(#user-form) [aria-label*="configuration options"],
body.path-user:has(#user-form) aside:not(.sm-user-shell__nav),
body.path-user:has(#user-form) .page-title,
body.path-user:has(#user-form) footer {
  display: none;
}

body.path-user:has(#user-form) .main-content {
  margin: 1rem auto 2rem;
}

.sm-settings-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1050px;
  margin: 0 auto;
}

.sm-settings-card {
  width: 100%;
  background: #f1f3f5;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.25);
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
}

/* ── Banner image ── */
.sm-settings-banner {
  width: 100%;
  height: 12rem;
  position: relative;
  /* overflow:visible so the absolutely-positioned file-input overlay
     is not clipped by the banner boundary */
  overflow: visible;
}

.sm-settings-banner--default {
  background: linear-gradient(135deg, #d5d8dc 0%, #bfc5cc 100%);
  overflow: hidden;
}

/* Clip only the image, not the upload control */
.sm-settings-banner--field .image-preview {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
}

.sm-settings-banner--field img {
  width: 100%;
  height: 12rem;
  object-fit: cover;
  display: block;
}

.sm-settings-banner--field .description,
.sm-settings-banner--field .file-size {
  display: none;
}

.sm-settings-banner--field {
  font-size: 1rem;
}

.sm-settings-banner--field label,
.sm-settings-banner--field .form-item__label,
.sm-settings-banner--field .field__label {
  display: none;
}

.sm-settings-banner--field .js-form-managed-file {
  position: static;
  font-size: 1rem;
}

/* Dark overlay pill in bottom-right of banner */
.sm-settings-banner--field .image-widget-data {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: 0.5rem;
  background: rgba(17, 24, 39, 0.62);
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.25);
  /* Allow the invisible file input to overlay the pill */
  overflow: hidden;
  min-width: 9rem;
  min-height: 2.25rem;
  cursor: pointer;
}

/* Visible label inside the pill */
.sm-settings-banner--field .image-widget-data::before {
  content: "\1F4F7  Change Banner";
  color: #fff;
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9;
}

.sm-settings-banner--field .image-widget-data .file,
.sm-settings-banner--field .image-widget-data .file a {
  display: inline-flex;
  align-items: center;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
}

/* File input inside banner overlay - hidden off-screen, JS calls .click() */
.sm-settings-banner--field .js-form-managed-file .form-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: -9999px;
  top: -9999px;
  font-size: 0;
}

.sm-settings-banner--field .js-form-managed-file .js-form-submit {
  width: auto;
  height: 2rem;
  min-height: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 0.5rem;
  background: #fff;
  color: #111827;
  padding: 0 0.55rem;
  box-shadow: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.sm-settings-banner--field .js-form-managed-file .form-file::file-selector-button {
  border: 0;
  border-right: 1px solid #e5e7eb;
  margin-right: 0.6rem;
  padding: 0.28rem 0.65rem;
  background: #f3f4f6;
  color: #111827;
  font-weight: 600;
  border-radius: 0.35rem;
  cursor: pointer;
}

/* ── Body layout ── */
.sm-settings-body {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1.5rem;
}

@media (max-width: 768px) {
  .sm-settings-body {
    flex-direction: column;
  }
}

.sm-settings-col--profile {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
}

.sm-settings-col--security {
  flex: 1;
  min-width: 320px;
  background: #ffc9c9;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.25);
  min-height: 30rem;
}

@media (max-width: 768px) {
  .sm-settings-col--security {
    min-width: 100%;
  }
}

.sm-security-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.sm-security-header h3 {
  font-size: 2.25rem;
  font-weight: 600;
  color: #212529;
  margin: 0;
}

.sm-security-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem;
}

.sm-security-text {
  color: #212529;
  font-weight: 700;
  max-width: 13rem;
  line-height: 1.25;
}

.sm-switch {
  position: relative;
  display: inline-block;
  width: 3rem;
  height: 1.6rem;
}

.sm-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.sm-switch-slider {
  position: absolute;
  cursor: not-allowed;
  inset: 0;
  background-color: #ced4da;
  border-radius: 999px;
}

.sm-switch-slider::before {
  position: absolute;
  content: "";
  height: 1.1rem;
  width: 1.1rem;
  left: 0.25rem;
  top: 0.25rem;
  background-color: #fff;
  border-radius: 50%;
}

/* ── Avatar / profile picture ── */
.sm-settings-avatar {
  margin-top: -8rem;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 2;
}

/* Camera badge — pure decoration, clicks pass through to the hidden input */
.sm-settings-avatar::after {
  content: "📷";
  position: absolute;
  right: 2.1rem;
  bottom: 0.9rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: #228be6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 4;
}

.sm-settings-avatar .image-preview img,
.sm-settings-avatar img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid #f8f9fa;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
  display: block;
  pointer-events: none;
}

/* Widget-data wraps both the image and the invisible file input overlay */
.sm-settings-avatar .image-widget-data {
  position: static;
  display: block;
  cursor: pointer;
}

.sm-settings-avatar .description,
.sm-settings-avatar .file-size,
.sm-settings-avatar label {
  display: none;
}

/* The outer .image-widget container is the positioning context for the overlay */
.sm-settings-avatar .image-widget.js-form-managed-file {
  position: relative;
  display: block;
}

.sm-settings-avatar .js-form-managed-file {
  position: relative;
  display: block;
}

/* Avatar circle is the click target (JS behaviour calls input.click() on it) */
.sm-settings-avatar .image-preview {
  cursor: pointer;
}

/* File input is hidden off-screen — JS calls .click() on it directly */
.sm-settings-avatar .js-form-managed-file .form-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: -9999px;
  top: -9999px;
  font-size: 0;
}

.sm-settings-avatar .js-form-managed-file .js-form-submit {
  display: none;
}

/* ── Form fields & actions ── */
.sm-settings-fields .form-control,
.sm-settings-col--security .form-control {
  border-radius: 1.5rem;
  padding: 0.5rem 1rem;
}

.sm-settings-fields .form-label,
.sm-settings-fields label,
.sm-settings-col--security .form-label,
.sm-settings-col--security label {
  font-weight: 500;
  color: #212529;
  margin-bottom: 0.25rem;
}

.sm-settings-fields .form-item {
  margin-bottom: 1rem;
}

.sm-settings-actions {
  display: block;
  margin-top: 0.5rem;
  width: 100%;
}

.sm-settings-actions .btn-primary {
  border-radius: 0.75rem;
  padding: 0.65rem 1.5rem;
  font-size: 1rem;
  min-width: 100%;
}

.sm-settings-actions .button,
.sm-settings-actions input[type="submit"] {
  border-radius: 0.75rem;
  padding: 0.75rem 1.5rem;
  display: block;
  min-width: 100%;
  flex: 1 1 auto;
  background: linear-gradient(90deg, #228be6 0%, #1c7ed6 100%);
  border: none;
  color: #fff;
  font-weight: 600;
  width: 100% !important;
}

.sm-settings-wrapper .description,
.sm-settings-wrapper .form-item__description,
.sm-settings-wrapper .form-item__error-message {
  font-size: 0.8rem;
  color: #495057;
}

.sm-settings-fields .description,
.sm-settings-fields .form-item__description {
  display: none;
}

/* ============================================================
   Page-level layout (user me / dashboard pages)
   ============================================================ */

.page-user-me,
body.path-user:has(#user-form) {
  background: #dfe3e8;
}

.page-user-me #toolbar-administration,
.page-user-me header[role="banner"],
.page-user-me .region-breadcrumb,
.page-user-me nav[aria-label="breadcrumb"],
.page-user-me .breadcrumb,
.page-user-me [aria-label="Open configuration options"],
.page-user-me [aria-label*="configuration options"],
.page-user-me aside:not(.sm-user-shell__nav),
.page-user-me .page-title,
.page-user-me footer {
  display: none;
}

.page-user-me .main-content,
body.path-user:has(#user-form) .main-content {
  max-width: 100%;
  flex: 1 1 auto;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* ── Shell grid ── */
.sm-user-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 2rem);
}

.sm-user-shell__nav {
  background: #f8f9fa;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  padding: 1rem 1rem 2rem;
}

.sm-user-shell__content {
  padding: 1rem;
}

.sm-user-shell__inner {
  max-width: 1040px;
  margin: 0 auto;
}

/* ── Left navigation ── */
.sm-left-nav {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 1.25rem;
}

.sm-left-nav__toggle-input,
.sm-left-nav__toggle,
.sm-left-nav__quick {
  display: none;
}

.sm-left-nav__panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 auto;
}

.sm-left-nav__brand {
  padding: 0.5rem 0.25rem;
}

.sm-left-nav__logo {
  font-size: 2.1rem;
  color: #111827;
  font-weight: 700;
  text-decoration: none;
}

.sm-left-nav__menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sm-left-nav__link,
.sm-left-nav__profile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.75rem;
  text-decoration: none;
  color: #228be6;
  font-weight: 600;
}

.sm-left-nav__link:hover,
.sm-left-nav__profile:hover,
.sm-left-nav__link.is-active,
.sm-left-nav__profile.is-active {
  background: rgba(34, 139, 230, 0.12);
}

.sm-left-nav__icon {
  width: 1.1rem;
  display: inline-flex;
  justify-content: center;
}

.sm-left-nav__footer {
  margin-top: auto;
  padding-top: 1rem;
}

.sm-left-nav__avatar {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: #e9ecef;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Generic page cards ── */
.sm-page-card {
  background: #f1f3f5;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.sm-page-title {
  margin: 0 0 0.75rem;
  font-size: 2rem;
  color: #212529;
}

.sm-page-lead {
  margin: 0 0 1.25rem;
  color: #495057;
}

.sm-page-actions {
  display: flex;
  gap: 0.75rem;
}

.sm-help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.sm-help-item {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.12);
}

.sm-help-item h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

/* ── Responsive ── */
@media (max-width: 992px) {
  .sm-user-shell {
    grid-template-columns: 1fr;
  }

  .sm-user-shell__nav {
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 0.75rem 1rem;
  }

  .sm-left-nav {
    height: auto;
    gap: 0.75rem;
  }

  .sm-left-nav__logo {
    font-size: 1.5rem;
  }

  .sm-left-nav__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    padding: 0.55rem 0.8rem;
    border-radius: 0.65rem;
    background: #e9ecef;
    color: #111827;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
  }

  .sm-left-nav__toggle-icon {
    font-size: 1rem;
    line-height: 1;
  }

  .sm-left-nav__panel {
    display: none;
    padding-top: 0.35rem;
  }

  .sm-left-nav__toggle-input:checked + .sm-left-nav__toggle + .sm-left-nav__panel {
    display: flex;
  }

  .sm-left-nav__menu {
    gap: 0.35rem;
  }

  .sm-left-nav__footer {
    margin-top: 0;
  }

  .sm-left-nav__quick {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding-top: 0.5rem;
  }

  .sm-left-nav__quick-link {
    width: 2.05rem;
    height: 2.05rem;
    border-radius: 999px;
    text-decoration: none;
    color: #228be6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    background: transparent;
  }

  .sm-left-nav__quick-link.is-active {
    background: rgba(34, 139, 230, 0.12);
  }
}

/* Login page style */
.page-user-login main .region-content,
.page-user-password main .region-content {
  max-width: 400px;
  background: white;
  padding: 15px 25px;
  margin: 0 auto;
  border-radius: 5px;
}

/* User account page */
body.path-user .field--label-inline .field__label {
  width: 100px;
}

body.path-user .field--label-inline .field__item {
  padding: 0.25rem 1rem;
  border-radius: 1rem;
  background: #e9ecef;
  min-width: 250px;
  margin: 0.25rem 0;
}

body.path-user .field--label-above .field__item {
  padding: 0.25rem 1rem;
  border-radius: 1rem;
  background: #e9ecef;
  width: 100%;
  margin: 0.25rem 0;
}