/*
  Lotus Portal UI overrides

  Principle:
  - Prefer Bootstrap classes/utilities in markup.
  - Keep this stylesheet focused on (a) brand tokens and (b) the few UI elements that
    cannot be expressed cleanly with Bootstrap utilities.

  Dark/Light mode:
  - Uses Bootstrap 5.3+ native theming via data-bs-theme="light|dark".
  - Avoid hard-coded colors; prefer Bootstrap CSS variables.

  Self-hosted Montserrat (preferred).
  Place the files in:
    /core/ui/fonts/montserrat/Montserrat-VariableFont_wght.woff2
    /core/ui/fonts/montserrat/Montserrat-Italic-VariableFont_wght.woff2
*/

@font-face{
  font-family:'Montserrat';
  font-style:normal;
  font-weight:100 900;
  font-display:swap;
  src:local('Montserrat'), url('/core/ui/fonts/montserrat/Montserrat-VariableFont_wght.woff2') format('woff2');
}
@font-face{
  font-family:'Montserrat';
  font-style:italic;
  font-weight:100 900;
  font-display:swap;
  src:local('Montserrat Italic'), url('/core/ui/fonts/montserrat/Montserrat-Italic-VariableFont_wght.woff2') format('woff2');
}

/* Brand + typography tokens (Bootstrap-native via CSS variables) */
:root {
  --bs-primary: #2563eb;
  --bs-font-sans-serif: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bs-body-font-family: var(--bs-font-sans-serif);

  /* Lotus helpers */
  --lotus-primary: var(--bs-primary);
  --lotus-primary-soft: rgba(37, 99, 235, 0.15);

  /* Login background “glow” tuned for LIGHT mode (default). */
  --lt-login-glow-1: rgba(37, 99, 235, 0.14);
  --lt-login-glow-2: rgba(56, 189, 248, 0.12);

  /* Build marker (useful for cache/debug): */
  --lt-portal-css-build: "20260103-2";
}

html[data-bs-theme="light"] { color-scheme: light; }
html[data-bs-theme="dark"] {
  color-scheme: dark;

  /* Stronger glow in DARK mode so it remains visible. */
  --lt-login-glow-1: rgba(37, 99, 235, 0.30);
  --lt-login-glow-2: rgba(56, 189, 248, 0.24);
}

/* ------------------------------
   Login screens
   ------------------------------ */

body.lotus-login-body {
  min-height: 100vh;
  margin: 0;
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
  background-image:
    radial-gradient(circle at top left, var(--lt-login-glow-1), transparent 55%),
    radial-gradient(circle at bottom right, var(--lt-login-glow-2), transparent 55%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Login hero logo aligned to the auth card width. */
body.lotus-login-body .lotus-brand-logo-img {
  width: 100%;
  max-width: 340px;
  height: auto;
  display: block;
  margin: 0 auto 0.6rem;
  filter: drop-shadow(0 10px 24px rgba(15, 23, 42, 0.35));
  opacity: 0.98;
}

@media (max-width: 420px) {
  body.lotus-login-body .lotus-brand-logo-img {
    max-width: 280px;
  }
}

/* Brand title needs letter spacing (no Bootstrap utility for this). */
.lotus-brand-title {
  letter-spacing: 0.08em;
}

/* OTP input sizing (no reliable Bootstrap utility for fixed square inputs). */
.lt-otp-input {
  width: 48px;
  height: 56px;
  font-size: 1.35rem;
  text-align: center;
  border-radius: var(--bs-border-radius-lg);
}

.lt-otp-input:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.15rem rgba(37, 99, 235, 0.25);
}

/* ------------------------------
   App shell (right-side navbar)
   - Scoped to body.lotus-app-shell to avoid impacting legacy pages.
   ------------------------------ */

/*
  Minimal fallback shell rules (unscoped)
  Purpose: if a subdomain is still serving an older portal.css or the body class
  is missing, the layout remains usable (right sidebar stays on the right).
*/
.lotus-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
}

.lotus-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.lotus-sidebar {
  width: 280px;
  flex: 0 0 280px;
}

.lotus-topbar {
  height: 60px;
  display: flex;
  align-items: center;
}

.lotus-topbar-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body.lotus-app-shell {
  min-height: 100vh;
  margin: 0;
  background-color: var(--bs-body-bg);
}

body.lotus-app-shell .lotus-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
}

body.lotus-app-shell .lotus-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

body.lotus-app-shell .lotus-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--bs-border-color);
  background-color: var(--bs-body-bg);
}

body.lotus-app-shell .lotus-topbar-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body.lotus-app-shell .lotus-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
}

body.lotus-app-shell .lotus-breadcrumbs .lotus-sep {
  opacity: 0.6;
}

body.lotus-app-shell .lotus-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0;
}

/* Topbar dividers (between grid / theme / user controls) */
body.lotus-app-shell .lotus-topbar-vr {
  width: 1px;
  height: 28px;
  margin: 0 0.9rem;
  background: var(--bs-border-color);
  opacity: 0.65;
}

body.lotus-app-shell .lotus-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-size: 0.85rem;
}

body.lotus-app-shell .lotus-user-pill .lotus-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  background: rgba(37, 99, 235, 0.15);
  color: var(--bs-primary);
}

body.lotus-app-shell .lotus-main-content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Sidebar tokens */
body.lotus-app-shell {
  --lt-sidebar-bg: #020617;
  --lt-sidebar-border: rgba(148, 163, 184, 0.22);
  --lt-sidebar-text: #e5e7eb;
  --lt-sidebar-muted: rgba(229, 231, 235, 0.72);
  --lt-sidebar-hover: rgba(255, 255, 255, 0.08);
  --lt-sidebar-active: rgba(37, 99, 235, 0.25);
  --lt-sidebar-dot: #2563eb;
}

body.lotus-app-shell .lotus-sidebar {
  width: 280px;
  background: var(--lt-sidebar-bg);
  color: var(--lt-sidebar-text);
  border-right: 1px solid var(--lt-sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
}

body.lotus-app-shell .lotus-sidebar a {
  color: inherit;
}

body.lotus-app-shell .lotus-sidebar-brand {
  margin-bottom: 1.25rem;
}

body.lotus-app-shell .lotus-sidebar-brandlink {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

body.lotus-app-shell .lotus-sidebar-logo-img {
  height: 34px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  display: block;
}

body.lotus-app-shell .lotus-sidebar-title {
  display: none !important;
}

body.lotus-app-shell .lotus-sidebar-section {
  margin-bottom: 1.25rem;
}

body.lotus-app-shell .lotus-sidebar-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lt-sidebar-muted);
  margin-bottom: 0.6rem;
}

body.lotus-app-shell .lotus-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

body.lotus-app-shell .lotus-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

body.lotus-app-shell .lotus-sidebar-nav a:hover {
  background: var(--lt-sidebar-hover);
}

body.lotus-app-shell .lotus-sidebar-nav a.active {
  background: var(--lt-sidebar-active);
}


body.lotus-app-shell .lotus-nav-parent-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

body.lotus-app-shell .lotus-nav-parent-row > .lotus-nav-link {
  flex: 1 1 auto;
}

body.lotus-app-shell .lotus-nav-toggle {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.25rem;
}

body.lotus-app-shell .lotus-nav-toggle:hover {
  background: var(--lt-sidebar-hover);
}

body.lotus-app-shell .lotus-nav-toggle[aria-expanded="true"] .lotus-nav-chevron {
  transform: rotate(180deg);
}

body.lotus-app-shell .lotus-nav-chevron {
  font-size: 0.72rem;
  opacity: 0.82;
  transition: transform 0.18s ease;
}

body.lotus-app-shell .lotus-nav-children {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin: -0.04rem 0 0.48rem 1.9rem;
  padding-left: 1.25rem;
  border-left: 1px solid var(--lt-sidebar-border);
}

body.lotus-app-shell .lotus-nav-children.is-collapsed {
  display: none;
}

body.lotus-app-shell .lotus-sidebar-nav a.lotus-nav-sublink {
  padding: 0.42rem 0.62rem;
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--lt-sidebar-muted);
  gap: 0.5rem;
}

body.lotus-app-shell .lotus-nav-subicon {
  width: 16px;
  text-align: center;
  opacity: 0.9;
  font-size: 0.9rem;
}

body.lotus-app-shell .lotus-sidebar-nav a.lotus-nav-sublink:hover {
  color: var(--lt-sidebar-text);
  background: color-mix(in srgb, var(--lt-sidebar-hover) 70%, transparent);
}

body.lotus-app-shell .lotus-sidebar-nav a.lotus-nav-sublink.active {
  color: var(--lt-sidebar-text);
  background: var(--lt-sidebar-active);
}

body.lotus-app-shell .lotus-nav-dot {
  display: none !important;
}

body.lotus-app-shell .lotus-nav-icon {
  width: 18px;
  text-align: center;
  opacity: 0.95;
}

body.lotus-app-shell .lotus-sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--lt-sidebar-border);
  font-size: 0.8rem;
  color: var(--lt-sidebar-muted);
}

body.lotus-app-shell .lotus-sidebar-appmeta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

body.lotus-app-shell .lotus-sidebar-dot {
  opacity: 0.85;
}

body.lotus-app-shell .lotus-sidebar-appname {
  color: var(--lt-sidebar-text);
  opacity: 0.95;
  font-weight: 600;
}

/* Page UI elements */
body.lotus-app-shell .lotus-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

body.lotus-app-shell .lotus-page-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0;
}

body.lotus-app-shell .lotus-page-subtitle {
  margin: 0.35rem 0 0;
  color: var(--bs-secondary-color);
}

body.lotus-app-shell .lotus-page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

body.lotus-app-shell .lotus-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 18px;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.08);
}

body.lotus-app-shell .lotus-filters-row {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

body.lotus-app-shell .lotus-filters-top {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  flex-wrap: wrap;
}

body.lotus-app-shell .lotus-search-group {
  position: relative;
  flex: 1;
  min-width: 260px;
}

body.lotus-app-shell .lotus-search-group input {
  padding-left: 2.4rem;
}

body.lotus-app-shell .lotus-search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bs-secondary-color);
}

body.lotus-app-shell .lotus-filter-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

body.lotus-app-shell .lotus-filter-pill {
  border: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--bs-body-color);
}

body.lotus-app-shell .lotus-filter-pill:hover {
  border-color: rgba(37, 99, 235, 0.5);
}

body.lotus-app-shell .lotus-filter-pill.active {
  border-color: rgba(37, 99, 235, 0.8);
  box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.18);
}

body.lotus-app-shell .lotus-filter-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--bs-secondary-color);
}

body.lotus-app-shell .lotus-filter-pill.active .lotus-filter-pill-dot {
  background: var(--bs-primary);
}

body.lotus-app-shell .lotus-table-subtitle {
  font-size: 0.9rem;
  color: var(--bs-secondary-color);
}

body.lotus-app-shell .lotus-badge-soft {
  background: rgba(37, 99, 235, 0.12);
  color: var(--bs-primary);
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

body.lotus-app-shell .lotus-status {
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

body.lotus-app-shell .lotus-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

body.lotus-app-shell .lotus-status-purchased {
  background: rgba(99, 102, 241, 0.12);
  color: rgba(99, 102, 241, 1);
}
body.lotus-app-shell .lotus-status-purchased .lotus-status-dot { background: rgba(99, 102, 241, 1); }

body.lotus-app-shell .lotus-status-cancelled {
  background: rgba(100, 116, 139, 0.18);
  color: rgba(100, 116, 139, 1);
}
body.lotus-app-shell .lotus-status-cancelled .lotus-status-dot { background: rgba(100, 116, 139, 1); }

body.lotus-app-shell .lotus-status-instock {
  background: rgba(34, 197, 94, 0.12);
  color: rgba(34, 197, 94, 1);
}
body.lotus-app-shell .lotus-status-instock .lotus-status-dot { background: rgba(34, 197, 94, 1); }

body.lotus-app-shell .lotus-status-inuse {
  background: rgba(37, 99, 235, 0.12);
  color: rgba(37, 99, 235, 1);
}
body.lotus-app-shell .lotus-status-inuse .lotus-status-dot { background: rgba(37, 99, 235, 1); }

body.lotus-app-shell .lotus-status-repair {
  background: rgba(234, 179, 8, 0.14);
  color: rgba(202, 138, 4, 1);
}
body.lotus-app-shell .lotus-status-repair .lotus-status-dot { background: rgba(202, 138, 4, 1); }

body.lotus-app-shell .lotus-status-damaged {
  background: rgba(239, 68, 68, 0.14);
  color: rgba(220, 38, 38, 1);
}
body.lotus-app-shell .lotus-status-damaged .lotus-status-dot { background: rgba(220, 38, 38, 1); }

body.lotus-app-shell .lotus-status-retired {
  background: rgba(148, 163, 184, 0.18);
  color: rgba(148, 163, 184, 1);
}
body.lotus-app-shell .lotus-status-retired .lotus-status-dot { background: rgba(148, 163, 184, 1); }

body.lotus-app-shell .lotus-asset-id {
  font-weight: 700;
}

body.lotus-app-shell .lotus-asset-name {
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
}

/* Responsive: sidebar becomes a compact top bar */
@media (max-width: 991.98px) {
  body.lotus-app-shell .lotus-layout {
    flex-direction: column;
  }

  body.lotus-app-shell .lotus-sidebar {
    width: 100%;
    order: 1;
    border-right: 0;
    border-top: 0;
    border-bottom: 1px solid var(--lt-sidebar-border);
  }

  body.lotus-app-shell .lotus-main {
    order: 2;
  }
}