/* RSK.Tav - components styles. Plain CSS; tokens live in base.css.

   Font sizes: custom.css scales the old Tailwind text-xs..text-3xl steps by --text-scale, so
   the same steps are written here as calc(<size> * var(--text-scale)). Base (1rem) and 4xl
   (2.25rem) were never scaled. Line heights stay in fixed rem, as Tailwind paired them. */

:root {
  /* Orange is only used by the temporary-password notice; base.css has no orange-50..600. */
  --orange-50: #fff7ed;
  --orange-200: #fed7aa;
  --orange-400: #fb923c;
  --orange-600: #ea580c;
  --yellow-700: #a16207;
}


/* ---------------------------------------------------------------------------
   Account pages (login-style screens that sit on a pale gradient)
   --------------------------------------------------------------------------- */

.account-page {
  min-height: 100vh;
  background-image: linear-gradient(to bottom right, var(--gray-50), var(--gray-100));
}

/* Used when the page itself (not a wrapping container) carries the gutters. */
.account-page.has-gutters {
  padding: 3rem 1rem;
}

/* Wide centred column inside _AccountLayout. */
.account-page-container {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
  padding: 3rem 1rem;
}

@media (min-width: 640px) {
  .account-page.has-gutters {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  .account-page-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .account-page.has-gutters {
    padding-left: 2rem;
    padding-right: 2rem;
  }
  .account-page-container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Narrow single-card column. */
.account-page-narrow {
  width: 100%;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}


/* ---------------------------------------------------------------------------
   Access denied
   --------------------------------------------------------------------------- */

.access-denied {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.access-denied-body {
  text-align: center;
}

.access-denied-icon {
  display: block;
  width: 6rem;
  height: 6rem;
  margin: 0 auto 1.5rem;
}

.access-denied-title {
  margin-bottom: 1rem;
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.access-denied-text {
  margin-bottom: 2rem;
  font-size: calc(1.25rem * var(--text-scale));
  line-height: 1.75rem;
  color: var(--gray-600);
}

.access-denied-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}


/* ---------------------------------------------------------------------------
   Form card (stacked single-column form in a white card)
   --------------------------------------------------------------------------- */

.form-card {
  padding: 2rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.form-header {
  margin-bottom: 2rem;
}

.form-title {
  font-size: calc(1.5rem * var(--text-scale));
  line-height: 2rem;
  font-weight: 700;
  color: var(--gray-900);
}

.form-subtitle {
  margin-top: 0.5rem;
  font-size: calc(0.875rem * var(--text-scale));
  line-height: 1.25rem;
  color: var(--gray-600);
}

.form-subtitle.is-warning {
  color: var(--orange-600);
}

/* The form itself: fields separated by 1.5rem. */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-label {
  display: block;
  font-size: calc(0.875rem * var(--text-scale));
  line-height: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
}

.form-input {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-input:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px var(--primary-200), var(--shadow-sm);
}

.form-hint {
  margin-top: 0.25rem;
  font-size: calc(0.75rem * var(--text-scale));
  line-height: 1rem;
  color: var(--gray-500);
}

/* Validation message under a field. */
.form-error {
  display: block;
  margin-top: 0.25rem;
  font-size: calc(0.875rem * var(--text-scale));
  line-height: 1.25rem;
  color: var(--red-600);
}

/* Buttons share the row equally. */
.form-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
}

.form-actions .tav-button {
  flex: 1 1 0%;
}

.form-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}

.form-footer p {
  font-size: calc(0.75rem * var(--text-scale));
  line-height: 1rem;
  color: var(--gray-600);
}

.form-footer strong,
.form-footer-label {
  font-weight: 600;
}


/* ---------------------------------------------------------------------------
   Alerts
   --------------------------------------------------------------------------- */

.alert {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid;
  border-radius: 0.5rem;
}

.alert-warning {
  background: var(--orange-50);
  border-color: var(--orange-200);
}

.alert-error {
  background: var(--red-50);
  border-color: var(--red-200);
}

.alert-row {
  display: flex;
}

.alert-icon-wrap {
  flex-shrink: 0;
}

.alert-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--orange-400);
}

.alert-content {
  margin-left: 0.75rem;
}

.alert-title {
  font-size: calc(0.875rem * var(--text-scale));
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--orange-800);
}

.alert-messages {
  font-size: calc(0.875rem * var(--text-scale));
  line-height: 1.25rem;
  color: var(--red-800);
}


/* ---------------------------------------------------------------------------
   User management list
   --------------------------------------------------------------------------- */

.user-page {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.user-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.user-page-title {
  font-size: calc(1.875rem * var(--text-scale));
  line-height: 2.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

.user-page-subtitle {
  margin-top: 0.5rem;
  font-size: calc(0.875rem * var(--text-scale));
  line-height: 1.25rem;
  color: var(--gray-600);
}

/* overflow hidden clips the rounded corners; the scroller inside handles wide tables. */
.user-table-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.user-table-scroll {
  overflow-x: auto;
}

.user-table {
  width: 100%;
}

/* Hairlines between the sections and between rows. */
.user-table > tbody {
  background: #fff;
  border-top: 1px solid var(--gray-200);
}

.user-table > tbody > tr + tr {
  border-top: 1px solid var(--gray-200);
}

.user-table thead {
  background: var(--gray-50);
}

.user-table th {
  padding: 0.75rem 1.5rem;
  text-align: left;
  font-size: calc(0.75rem * var(--text-scale));
  line-height: 1rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: var(--gray-600);
}

.user-table td {
  padding: 1rem 1.5rem;
  white-space: nowrap;
}

/* The roles cell may wrap its badges. */
.user-table td.is-wrap {
  white-space: normal;
}

.user-table th.is-end,
.user-table td.is-end {
  text-align: right;
}

.user-table tbody tr {
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.user-table tbody tr:hover {
  background: var(--gray-50);
}

.user-cell-text {
  font-size: calc(0.875rem * var(--text-scale));
  line-height: 1.25rem;
  color: var(--gray-700);
}

.user-name {
  font-size: calc(0.875rem * var(--text-scale));
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--gray-900);
}

.user-meta {
  font-size: calc(0.75rem * var(--text-scale));
  line-height: 1rem;
  color: var(--gray-500);
}

.user-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.user-badge {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: calc(0.75rem * var(--text-scale));
  line-height: 1rem;
  font-weight: 600;
}

.user-badge.is-role {
  background: var(--blue-100);
  color: var(--blue-800);
}

.user-badge.is-active {
  background: var(--green-100);
  color: var(--green-800);
}

.user-badge.is-inactive {
  background: var(--red-100);
  color: var(--red-800);
}

/* Row actions dropdown. The list itself is positioned by .dropdown-menu (custom.css) and
   toggled with .hidden from the page script. */
.user-menu {
  position: relative;
  display: inline-block;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: var(--gray-100);
  border-radius: 0.25rem;
  font-size: calc(0.75rem * var(--text-scale));
  line-height: 1rem;
  font-weight: 500;
  color: var(--gray-700);
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.user-menu-trigger:hover {
  background: var(--gray-200);
}

.user-menu-icon {
  width: 1rem;
  height: 1rem;
}

.user-menu-list {
  width: 10rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: calc(0.875rem * var(--text-scale));
  line-height: 1.25rem;
  color: var(--gray-700);
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1), color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* The delete button is a full-width <button> with no divider of its own. */
button.user-menu-item {
  width: 100%;
  border-bottom-width: 0;
}

.user-menu-item:first-child {
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

.user-menu-item:last-child {
  border-bottom-width: 0;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}

.user-menu-item.is-edit:hover {
  background: var(--blue-50);
  color: var(--blue-700);
}

.user-menu-item.is-reset:hover {
  background: var(--yellow-50);
  color: var(--yellow-700);
}

.user-menu-item.is-delete:hover {
  background: var(--red-50);
  color: var(--red-700);
}

.user-empty {
  padding: 2rem 1.5rem;
  background: var(--blue-50);
  border: 1px solid var(--blue-200);
  border-radius: 0.5rem;
  text-align: center;
}

.user-empty-title {
  font-weight: 600;
  color: var(--blue-900, #1e3a8a);
}

.user-empty-text {
  margin-top: 0.25rem;
  font-size: calc(0.875rem * var(--text-scale));
  line-height: 1.25rem;
  color: var(--blue-800);
}

/* ---- Cookie notice: a bar along the bottom of the page until it is acknowledged ---- */

.cookie-notice {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 70;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary-800);
  color: #fff;
  box-shadow: 0 -4px 12px rgb(15 23 42 / 25%);
}

.cookie-notice-text {
  max-width: 60rem;
  font-size: calc(0.875rem * var(--text-scale));
  line-height: 1.25rem;
}

/* The button's own colours are the brand's; on the dark bar it reads as the light one. */
.cookie-notice .tav-button {
  border-color: #fff;
  background: #fff;
  color: var(--primary-700);
}

.cookie-notice .tav-button:hover {
  border-color: var(--secondary-color);
  background: var(--secondary-color);
  color: #000;
}

/* "Read more": the outlined sibling of OK, so the one to press is the filled one. */
.cookie-notice .cookie-notice-more {
  border-color: #fff;
  background: transparent;
  color: #fff;
}

.cookie-notice .cookie-notice-more:hover {
  border-color: var(--secondary-color);
  background: var(--secondary-color);
  color: #000;
}
