/* Same palette as the backoffice (backoffice/static/css/app.css); dark slate chrome marks it as ADMIN. */
:root {
  --app-primary: #7a2e5a;
  --app-primary-dark: #5e2245;
  --app-primary-soft: #e9d5e0;
  --admin-chrome: #1f2430;
  --admin-chrome-dark: #151821;
  --app-bg: #f3f3f6;
  --bs-primary: var(--app-primary);
  --bs-primary-rgb: 122, 46, 90;
  --bs-link-color: var(--app-primary);
  --bs-link-color-rgb: 122, 46, 90;
  --bs-link-hover-color: var(--app-primary-dark);
  --bs-link-hover-color-rgb: 94, 34, 69;
}

html, body {
  min-height: 100%;
  background: var(--app-bg);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  --bs-btn-bg: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary-dark);
  --bs-btn-hover-border-color: var(--app-primary-dark);
  --bs-btn-active-bg: var(--app-primary-dark);
  --bs-btn-active-border-color: var(--app-primary-dark);
  --bs-btn-disabled-bg: var(--app-primary);
  --bs-btn-disabled-border-color: var(--app-primary);
}

.btn-outline-primary {
  --bs-btn-color: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary);
  --bs-btn-hover-border-color: var(--app-primary);
  --bs-btn-active-bg: var(--app-primary-dark);
  --bs-btn-active-border-color: var(--app-primary-dark);
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(var(--bs-primary-rgb), 0.5);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.2);
}

.admin-badge {
  display: inline-block;
  padding: 0.15em 0.45em;
  border-radius: 0.3rem;
  background: var(--app-primary);
  color: #fff;
  font-size: 0.65em;
  font-weight: 700;
  letter-spacing: 0.08em;
  vertical-align: 0.2em;
}

/* ---------- Login ---------- */
.login-page {
  background:
    radial-gradient(circle at 20% 10%, rgba(122, 46, 90, 0.55), transparent 55%),
    linear-gradient(160deg, var(--admin-chrome) 0%, var(--admin-chrome-dark) 100%);
}

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: 1.25rem;
  border-top: 4px solid var(--app-primary) !important;
}

.captcha-img {
  height: 48px;
  width: auto;
  user-select: none;
}

.captcha-input {
  min-width: 0;
}

/* ---------- Layout ---------- */
.app-navbar {
  background: var(--admin-chrome);
  border-bottom: 3px solid var(--app-primary);
  padding-top: env(safe-area-inset-top);
}

.app-main {
  padding-top: calc(59px + env(safe-area-inset-top) + 1rem);
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  max-width: 1400px;
}

.admin-user {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
}

.logout-form .nav-link {
  background: none;
  border: 0;
  width: 100%;
  text-align: start;
}

.min-w-0 {
  min-width: 0;
}

.form-narrow {
  max-width: 900px;
}

.news-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- Salong pages ---------- */
/* Tabs scroll sideways instead of wrapping on narrow screens */
.salong-tabs {
  overflow-x: auto;
  scrollbar-width: none;
}

.salong-tabs .nav-link {
  white-space: nowrap;
  color: var(--bs-secondary-color);
}

.salong-tabs .nav-link.active {
  color: var(--app-primary);
  font-weight: 600;
  border-top: 3px solid var(--app-primary);
}

.form-check-input:checked {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}

.form-check-input:focus {
  border-color: rgba(var(--bs-primary-rgb), 0.5);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.2);
}

.user-archived {
  background: #f7f7f9;
}

.user-archived a.fw-semibold {
  color: var(--bs-secondary-color);
}

/* The save button on long forms stays in view */
.save-bar {
  position: sticky;
  bottom: 0;
  padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
  background: var(--app-bg);
  z-index: 2;
}

/* ---------- Statistics ---------- */
.stat-tile {
  border-left: 3px solid var(--app-primary) !important;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
  line-height: 1.2;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--bs-body-color);
}

.stat-note {
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
}

/* ---------- Server performance ---------- */
/* Status colours are only used for status, always with a text label (OK / Hög / Kritisk). */
.level-ok       { --level: #2e7d32; --level-soft: #e3f1e4; }
.level-warning  { --level: #a15c00; --level-soft: #fbedd5; }
.level-critical { --level: #b3261e; --level-soft: #f9dedc; }

.badge.level-ok,
.badge.level-warning,
.badge.level-critical {
  background: var(--level-soft);
  color: var(--level);
  font-weight: 600;
  white-space: nowrap;
}

.meter {
  height: 6px;
  margin-top: 0.35rem;
  background: #e6e6ec;
}

.meter .progress-bar {
  background: var(--level);
}

.spark {
  color: var(--app-primary);
  display: block;
  overflow: visible;
}

.spark-cell {
  width: 130px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* Bar chart: one series, the brand colour; the current month is darker and labelled. */
.bar-chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 180px;
  border-bottom: 1px solid #c8c8cf;
}

.bar-grid {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.bar-grid span {
  border-top: 1px dashed #e3e3e8;
}

.bar-col {
  position: relative;
  flex: 1 1 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  outline: none;
  cursor: default;
}

.bar {
  width: min(70%, 36px);
  min-height: 2px;
  background: color-mix(in srgb, var(--app-primary) 70%, #fff);
  border-radius: 4px 4px 0 0;
}

.bar.current {
  background: var(--app-primary);
}

.bar-col:hover .bar,
.bar-col:focus-visible .bar {
  background: var(--app-primary-dark);
}

.bar-col:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(var(--bs-primary-rgb), 0.35);
  border-radius: 4px;
}

.bar-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bs-body-color);
  margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}

.bar-labels {
  display: flex;
  gap: 2px;
  margin-top: 0.25rem;
}

.bar-labels span {
  flex: 1 1 0;
  text-align: center;
  font-size: 0.7rem;
  color: var(--bs-secondary-color);
  overflow: hidden;
}

.chart-tip {
  position: absolute;
  top: -0.5rem;
  transform: translate(-50%, -100%);
  background: var(--admin-chrome);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.3rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}

/* Mobile: full-height slide-in menu with large touch targets */
@media (max-width: 991.98px) {
  .app-navbar .offcanvas {
    padding-top: env(safe-area-inset-top);
  }
  .app-navbar .offcanvas .nav-link {
    color: var(--bs-body-color);
    padding: 0.85rem 0.5rem;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
  }
  .app-navbar .offcanvas .nav-link.active {
    color: var(--app-primary);
    font-weight: 600;
  }
  .logout-form {
    margin-top: 1rem;
  }
  .logout-form .nav-link {
    color: var(--bs-danger) !important;
  }
}

/* Desktop: inline menu, active item underlined in the brand colour */
@media (min-width: 992px) {
  .app-navbar .nav-link.active {
    box-shadow: inset 0 -3px 0 var(--app-primary-soft);
  }
  .logout-form .nav-link {
    color: rgba(255, 255, 255, 0.75);
  }
  .logout-form .nav-link:hover {
    color: #fff;
  }
}
