/* ============================================================================
   RUS ZIP License Issuer — Stripe-inspired design system (issue #29)

   Shared palette for the app (and the future landing site, per the storefront
   design spec): RUS white / blue / dark / gold exposed as CSS custom
   properties. Components: translucent sticky navbar, rounded soft-shadow
   cards, generous whitespace. Presentation layer only — no behavior here.
   ========================================================================= */

:root {
  /* RUS palette — the landing site (#30) reuses these same names. */
  --rus-white: #ffffff;
  --rus-blue: #0057b8;          /* primary action blue, from the logo blues */
  --rus-blue-hover: #00469a;
  --rus-blue-active: #00387c;
  --rus-blue-soft: #eaf2fb;     /* selected / hover wash */
  --rus-dark: #0a1e3f;          /* headings, navbar wordmark */
  --rus-gold: #c9a227;          /* accent hairlines, highlights */
  --rus-gold-soft: #fdf5df;     /* warm notice wash */
  --rus-gold-border: #eeda9a;
  --rus-surface: #f6f9fc;       /* page background behind white cards */
  --rus-border: #e3e9f0;
  --rus-text: #1d2b3a;
  --rus-muted: #5f6f80;

  --rus-radius-lg: 0.875rem;    /* cards, modals */
  --rus-radius: 0.5rem;         /* inputs, buttons, alerts */

  --rus-sidebar-w: 15rem;       /* expanded sidebar */
  --rus-sidebar-rail: 4.5rem;   /* collapsed, icon-only rail */

  --rus-shadow-sm: 0 1px 2px rgba(9, 30, 66, 0.06);
  --rus-shadow: 0 2px 5px rgba(9, 30, 66, 0.05), 0 10px 24px rgba(9, 30, 66, 0.08);
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background-color: var(--rus-surface);
  color: var(--rus-text);
}

/* ------------------------------------------------------------------ brand */

.navbar-brand {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.rus-brand-logo {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
}

.rus-brand-logo-lg {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
}

.rus-brand-wordmark {
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--rus-dark);
}

/* ------------------------------------------------- narrow-viewport bar */

/* The slim md-down bar that opens the offcanvas drawer; from md up the
   sidebar itself is the navigation. It shares the old navbar's translucent
   sticky treatment. */
.rus-mobilebar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(0.75rem);
  -webkit-backdrop-filter: blur(0.75rem);
  border-bottom: 1px solid var(--rus-border);
}

/* ------------------------------------------------------------------- type */

h1, h2, h3, h4, h5, h6 {
  color: var(--rus-dark);
}

/* Gold tick under every page heading (h1 on each page). */
.rus-page-title {
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--rus-gold);
  display: inline-block;
}

/* ---------------------------------------------------------------- cards */

.card {
  border: 1px solid var(--rus-border);
  border-radius: var(--rus-radius-lg);
  box-shadow: var(--rus-shadow);
}

.modal-content {
  border: 1px solid var(--rus-border);
  border-radius: var(--rus-radius-lg);
}

.card-header {
  background-color: var(--rus-white);
  border-bottom: 1px solid var(--rus-border);
  border-radius: var(--rus-radius-lg) var(--rus-radius-lg) 0 0;
  font-weight: 600;
  color: var(--rus-dark);
}

/* ---------------------------------------------------------------- buttons */

.btn {
  border-radius: var(--rus-radius);
  font-weight: 500;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--rus-white), 0 0 0 0.25rem var(--rus-blue);
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--rus-blue);
  --bs-btn-border-color: var(--rus-blue);
  --bs-btn-hover-bg: var(--rus-blue-hover);
  --bs-btn-hover-border-color: var(--rus-blue-hover);
  --bs-btn-active-bg: var(--rus-blue-active);
  --bs-btn-active-border-color: var(--rus-blue-active);
  --bs-btn-disabled-bg: #7ea6cf;
  --bs-btn-disabled-border-color: #7ea6cf;
}

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

/* Google Sign-In (issue #62): white button per Google's sign-in branding —
   official four-color "G" icon, #1F1F1F label, #DADCE0 border, subtle hover. */
.btn-google {
  --bs-btn-color: #1f1f1f;
  --bs-btn-bg: #ffffff;
  --bs-btn-border-color: #dadce0;
  --bs-btn-hover-color: #1f1f1f;
  --bs-btn-hover-bg: #f8f9fa;
  --bs-btn-hover-border-color: #dadce0;
  --bs-btn-active-color: #1f1f1f;
  --bs-btn-active-bg: #f1f3f4;
  --bs-btn-active-border-color: #dadce0;
  --bs-btn-disabled-bg: #ffffff;
  --bs-btn-disabled-color: #1f1f1f;
  --bs-btn-disabled-border-color: #dadce0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}

.btn-google:hover {
  box-shadow: 0 1px 3px rgb(60 64 67 / 18%);
}

.btn-google-icon {
  flex: 0 0 auto;
  display: block;
}

/* ------------------------------------------------------------------ forms */

.form-control,
.form-select {
  border-radius: var(--rus-radius);
  border-color: #cfd9e4;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--rus-blue);
  box-shadow: 0 0 0 0.2rem rgba(0, 87, 184, 0.15);
}

.form-control::placeholder {
  color: #9aa8b6;
}

/* ----------------------------------------------------------------- tables */

.table {
  --bs-table-hover-bg: var(--rus-blue-soft);
  margin-bottom: 0;
}

.table > thead > tr > th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rus-muted);
  border-bottom: 1px solid var(--rus-border);
}

/* ----------------------------------------------------------------- alerts */

.alert {
  border-radius: var(--rus-radius);
}

/* Gold-tinted warning alerts — the palette's accent voice. */
.alert-warning {
  --bs-alert-color: #6d5610;
  --bs-alert-bg: var(--rus-gold-soft);
  --bs-alert-border-color: var(--rus-gold-border);
  --bs-alert-link-color: #4d3d0a;
}

/* ------------------------------------------------------------------ badges */

.badge {
  border-radius: 9999px;
  padding: 0.35em 0.75em;
  font-weight: 600;
}

/* Gold "Perpetual" badge: bg-info markup stays (test-pinned classes are
   avoided in assertions), restyled into the palette. */
.badge.bg-info {
  background-color: var(--rus-gold-soft) !important;
  color: #6d5610 !important;
  border: 1px solid var(--rus-gold-border);
}

/* ------------------------------------------------------------------ links */

a {
  color: var(--rus-blue);
}

a:hover {
  color: var(--rus-blue-hover);
}

/* --------------------------------------------------------------- snippets */

pre.rus-code {
  background-color: #0e2038;
  color: #dce7f5;
  border: 1px solid #1e3a5f;
  border-radius: var(--rus-radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  overflow-x: auto;
}

/* ----------------------------------------------------------------- footer */

.footer {
  white-space: nowrap;
  line-height: 60px;
  background-color: var(--rus-white);
  border-top: 1px solid var(--rus-border);
  box-shadow: inset 0 2px 0 var(--rus-gold);
  color: var(--rus-muted);
}

/* ---------------------------------------------------------------- sidebar */

/* Authenticated shell (issue #36): a fixed-width nav column beside the
   content column on md+; below md the same nav becomes a Bootstrap
   offcanvas drawer (see .offcanvas-md in the layout). */
body.rus-has-sidebar {
  margin-bottom: 0;
}

.rus-app-shell {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 60px);
}

.rus-app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.rus-app-main > .container {
  flex-grow: 1;
}

.rus-app-shell .footer {
  margin-top: auto;
}

.rus-sidebar {
  --bs-offcanvas-width: var(--rus-sidebar-w);
  /* Bootstrap's responsive offcanvas forces a transparent background at
     md+; the !important restores the solid rail surface. */
  background-color: var(--rus-white) !important;
  border-right: 1px solid var(--rus-border);
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .rus-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    flex: 0 0 auto;
    width: var(--rus-sidebar-w);
    transition: width 0.15s ease-in-out;
  }

  /* Collapsed rail: the class is set on <html> by the layout script,
     pre-paint from localStorage, so the width never flashes. */
  html.rus-rail .rus-sidebar {
    width: var(--rus-sidebar-rail);
  }

  html.rus-rail .rus-sidebar-label {
    display: none;
  }

  html.rus-rail .rus-sidebar-header {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  html.rus-rail .rus-nav-link {
    justify-content: center;
  }

  html.rus-rail .rus-sidebar-toggle {
    align-self: center;
    margin-right: 0;
  }
}

.rus-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--rus-border);
}

.rus-sidebar-brand {
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.rus-sidebar-brand:hover {
  color: inherit;
}

.rus-sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  margin: 0;
  padding: 0.75rem 0.75rem;
  flex-grow: 1;
  overflow-y: auto;
}

.rus-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--rus-radius);
  color: var(--rus-muted);
  font-weight: 500;
  text-decoration: none;
}

.rus-nav-link:hover,
.rus-nav-link:focus {
  color: var(--rus-blue);
  background-color: var(--rus-blue-soft);
}

/* Gold accent on the active entry — the sidebar voice of the navbar rule. */
.rus-nav-link.active {
  color: var(--rus-dark);
  background-color: var(--rus-blue-soft);
  box-shadow: inset 2px 0 0 var(--rus-gold);
}

.rus-nav-link svg {
  flex: 0 0 1.25rem;
}

/* Sign-out: a POST form rendered as a sidebar nav entry. The button resets
   to the anchor look; hover flips to the danger tone instead of blue so the
   destructive action reads at a glance. */
.rus-nav-form {
  margin: 0;
}

.rus-nav-logout {
  width: 100%;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  text-align: start;
  color: var(--rus-muted);
}

.rus-nav-logout:hover,
.rus-nav-logout:focus {
  color: #b3261e;
  background-color: rgb(179 38 30 / 8%);
  box-shadow: none;
}

html.rus-rail .rus-nav-logout {
  justify-content: center;
}

/* Flat, separated Administration group (never collapsible). */
.rus-sidebar-group {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--rus-border);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.rus-sidebar-heading {
  margin: 0.25rem 0.75rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rus-muted);
}

.rus-sidebar-toggle {
  align-self: flex-end;
  margin: 0.75rem 1rem 1rem 0;
  padding: 0.375rem;
  border: 1px solid var(--rus-border);
  border-radius: var(--rus-radius);
  background-color: var(--rus-white);
  color: var(--rus-muted);
}

.rus-sidebar-toggle:hover,
.rus-sidebar-toggle:focus {
  color: var(--rus-blue);
  background-color: var(--rus-blue-soft);
}

.rus-icon-expand {
  display: none;
}

html.rus-rail .rus-icon-collapse {
  display: none;
}

html.rus-rail .rus-icon-expand {
  display: inline-block;
}

/* Legacy form-floating tweaks from the template, kept intact. */
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}
