/* Global styles for core/templates/core/base.html.

   Keep selectors relatively tight and focused on layout primitives
   (navbar, wrappers, footer) so page-specific templates can layer on.
*/

:root {
  --alx-navy: #082336;
  --alx-blue: #004bbc;
  --alx-ink: #000518;
  --alx-link: #264154;
  --alx-border: #d8dde6;
}

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap");

body {
  color: var(--alx-ink);
  background: #f5f5f5;
  font-family: Montserrat, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Settings pages (profile/emails/keys/otp/etc). */
.settings-page {
  max-width: 820px;
  margin: 1.5rem auto 2rem;
}

.settings-page .settings-form {
  max-width: 100%;
}

.settings-page .card {
  border: 1px solid var(--alx-border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.settings-page .card-body {
  padding: 1.25rem;
}

.settings-profile-avatar {
  flex: 0 0 auto;
}

/* Only the legacy top-nav/public layout uses a flex wrapper.
   AdminLTE sidebar layout expects the default wrapper behavior. */
body.layout-top-nav .wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
  padding-left: 5px !important;
  color: var(--alx-ink) !important;
}

body.layout-top-nav .content-wrapper {
  flex: 1 0 auto;
}

body.layout-top-nav .main-footer {
  flex-shrink: 0;
}

.navbar-user-avatar img {
  display: inline-block;
  vertical-align: middle;
}

.card .nav.nav-tabs {
  padding-left: 10px;
}

/* .card-primary:not(.card-outline) > .card-header {
  background-color: var(--alx-navy);
} */

a {
  color: var(--alx-link);
}

a:hover {
  color: #304b5e;
}

/* Make regular in-content links clearly identifiable.
   Exclude component-like links (buttons, badges, nav items, dropdown/list items)
   that already have strong affordances. */
.content-wrapper a:not(.btn):not(.btn-link):not(.badge):not(.nav-link):not(.dropdown-item):not(.list-group-item):not(.page-link):not(.navbar-brand):not(.brand-link):not(.alx-status-badge) {
  text-decoration: underline;
  text-decoration-color: currentColor; /* fallback */
  text-decoration-color: color-mix(in srgb, currentColor 70%, transparent);
  text-decoration-thickness: max(1px, 0.08em);
  text-underline-offset: 0.14em;
}

.content-wrapper a:not(.btn):not(.btn-link):not(.badge):not(.nav-link):not(.dropdown-item):not(.list-group-item):not(.page-link):not(.navbar-brand):not(.brand-link):not(.alx-status-badge):hover {
  color: var(--alx-blue);
  text-decoration-thickness: max(2px, 0.12em);
  text-decoration-color: currentColor;
}

/* Visited links: subtle but detectable. */
.content-wrapper a:not(.btn):not(.btn-link):not(.badge):not(.nav-link):not(.dropdown-item):not(.list-group-item):not(.page-link):not(.navbar-brand):not(.brand-link):not(.alx-status-badge):visited {
  color: #4b3a74; /* fallback */
  color: color-mix(in srgb, var(--alx-link) 70%, #6f42c1 30%);
}

/* Keyboard accessibility: clear focus ring for links. */
.content-wrapper a:not(.btn):not(.btn-link):not(.badge):not(.nav-link):not(.dropdown-item):not(.list-group-item):not(.page-link):not(.navbar-brand):not(.brand-link):not(.alx-status-badge):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--alx-blue) 70%, white);
  outline-offset: 2px;
  border-radius: 0.15rem;
}

.content-wrapper a.list-group-item.list-group-item-action {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--alx-blue) 25%, transparent);
}

.content-wrapper a.list-group-item.list-group-item-action:hover {
  box-shadow: inset 3px 0 0 var(--alx-blue);
}

.content-wrapper a.list-group-item.list-group-item-action:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--alx-blue) 70%, white);
  outline-offset: 2px;
}

.btn.btn-primary,
.btn.btn-outline-primary {
  color: #264154;
  background-color: #fff;
  border-color: #264154;
  font-weight: 600;
}

.btn.btn-primary:hover,
.btn.btn-outline-primary:hover {
  color: #fff;
  background-color: var(--alx-blue);
  border-color: var(--alx-blue);
}


.auth-nav-search {
  flex: 1 1 auto;
  justify-content: center;
}

.auth-nav-search .input-group {
  width: 100%;
  max-width: 520px;
}

/* Keep the autocomplete results aligned with the search input. */
.auth-nav-search #global-search-menu {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
}

@media (max-width: 767.98px) {
  .auth-nav-search #global-search-menu {
    left: 0;
    transform: none;
    max-width: none;
  }
}

@media (max-width: 767.98px) {
  .auth-nav-search {
    margin-top: .5rem;
    margin-bottom: .5rem;
  }

  .auth-nav-search .input-group {
    max-width: none;
  }
}

.user-panel > .image > .img-circle,
.widget-user > div > div > .img-circle {
  border: 1px solid darkgray;
}

/* Profile page enhancements (kept here to reduce CSS includes; selectors are scoped). */
.profile-page {
  max-width: 1080px;
  margin: 1.5rem auto 0;
  padding-bottom: 2rem;
}

.profile-page .card {
  border: 1px solid var(--alx-border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.profile-page .card-body {
  padding: 1.25rem 1.25rem 0.75rem;
}

.profile-page .profile-username {
  line-height: 1.1;
}

.profile-page #user_username {
  font-size: 0.95rem;
}

.profile-page #user_mail {
  font-size: 0.95rem;
}

.profile-page #user_mail a {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.14em;
}

.profile-page #user_mail a:hover {
  text-decoration-style: solid;
}

.profile-page #user_attributes {
  font-size: 0.95rem;
}

.profile-page #user_attributes .list-group-item {
  padding: 0.55rem 0.9rem;
}

.profile-page .profile-attr-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: #111827;
}

.profile-page .profile-attr-label i {
  width: 1.15rem;
  text-align: center;
  color: rgba(0, 0, 0, 0.55);
}

.profile-page .profile-attr-value {
  max-width: 62%;
  word-break: break-word;
  text-align: right;
}

.profile-page .profile-attr-value a {
  color: var(--alx-link);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.14em;
}

.profile-page .profile-attr-value a:hover {
  text-decoration-style: solid;
}

.profile-page .profile-chat-item a {
  font-family: var(--bs-font-monospace);
}

/* Membership request action buttons.
   The list view has a constrained column width, so we explicitly form a 2x2 grid
   when the container is narrow; the request detail view stays single-row. */
.membership-request-actions {
  display: flex;
  gap: 0.5rem;
}

.membership-request-actions--list {
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  container-type: inline-size;
}

@container (max-width: 360px) {
  .membership-request-actions--list > .btn {
    flex: 0 0 calc(50% - 0.25rem);
  }
}

@supports not (container-type: inline-size) {
  .membership-request-actions--list > .btn {
    flex: 0 0 calc(50% - 0.25rem);
  }
}

@media (max-width: 575.98px) {
  .membership-request-actions--list > .btn {
    flex: 0 0 calc(50% - 0.25rem);
  }
}

.membership-request-actions--detail {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.profile-page .profile-pre-list pre {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.25rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: pre;
  overflow-x: auto;
}

.profile-page .profile-memberships {
  border-radius: .25rem;
}

.profile-page .profile-memberships-header {
  background: rgba(0, 0, 0, 0.03);
  padding: 0.6rem 0.9rem;
}

.profile-page .profile-group-icon {
  width: 1.15rem;
  text-align: center;
  margin-right: 0.6rem;
  color: rgba(0, 0, 0, 0.55);
}

.profile-page .profile-group-name {
  font-weight: 600;
}

.profile-page .profile-memberships .profile-group-name > a {
  color: var(--alx-link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 65%, transparent);
  text-decoration-thickness: max(1px, 0.08em);
  text-underline-offset: 0.14em;
}

.profile-page .profile-memberships .profile-group-name > a:hover {
  color: var(--alx-blue);
  text-decoration-thickness: max(2px, 0.12em);
  text-decoration-color: currentColor;
}

.profile-page .profile-memberships .profile-group-name > a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--alx-blue) 70%, white);
  outline-offset: 2px;
  border-radius: 0.15rem;
}

/* Settings: Noggin-like chat nicknames editor. */
#chat-nicks-widget .table {
  background: #fff;
}

#chat-nicks-widget td {
  vertical-align: middle;
}

#chat-nicks-widget .chat-nicks-remove {
  padding: 0.2rem 0.45rem;
  line-height: 1;
}

/* Organization pages (create/edit/detail). */
.organization-page {
  max-width: 1080px;
  margin: 1.5rem auto 2rem;
}

.organization-page .card {
  border: 1px solid var(--alx-border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.organization-hero .card-body {
  padding: 1.25rem;
}

.organization-hero-logo {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
}

.organization-hero-logo img {
  width: 64px;
  height: 64px;
  border-radius: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  object-fit: contain;
}

.organization-hero-logo--placeholder {
  width: 64px;
  height: 64px;
  border-radius: 0.5rem;
  border: 1px dashed rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0, 0, 0, 0.55);
  background: rgba(0, 0, 0, 0.02);
  font-size: 1.4rem;
}

.organization-branding-logo {
  max-height: 120px;
  max-width: 100%;
}

.organization-page .nav-tabs .nav-link.alx-tab-error {
  color: #b02a37;
  font-weight: 600;
  position: relative;
}

.organization-page .nav-tabs .nav-link.alx-tab-error::after {
  content: "";
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.2rem;
  height: 2px;
  background: #dc3545;
  border-radius: 2px;
}

.organization-page .nav-tabs .nav-link.alx-tab-error.active {
  color: #b02a37;
}

.alx-status-badge {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
}

a.alx-status-badge {
  text-decoration: none;
  box-shadow: inset 0 -1px 0 color-mix(in srgb, currentColor 55%, transparent);
}

a.alx-status-badge:hover {
  color: var(--alx-blue);
  box-shadow: inset 0 -2px 0 currentColor;
}

a.alx-status-badge:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--alx-blue) 70%, white);
  outline-offset: 2px;
}

.organization-form-footer .card-footer {
  background: rgba(0, 0, 0, 0.02);
}
