/* Design language matched to the Assurety Solutions "TrackingAssurety" product
   (D:\Repos\Aaliyan-PremBI-24Dec-25\PremBI-24Dec-25) - same brand blue, font,
   radii and shadow language, applied here to a different product. */
:root {
  --brand-blue: #0C4F9E;
  --brand-blue-dark: #0a3f80;
  --brand-blue-focus: rgba(12, 79, 158, .12);
  /* Green accent pulled from assuretyconsulting.com/bi-analytics/ (#009f4d was the most frequent
     brand green on that page - link color, section accents, badges). Not previously part of this
     app's palette, which was blue-only. */
  --brand-green: #009f4d;
  --brand-green-dark: #007f3e;
  /* Bootstrap's .bg-success/.text-success/etc. reference these two variables directly
     (background-color/color: rgba(var(--bs-success-rgb), var(--bs-*-opacity)) !important), so
     overriding them here re-skins every Bootstrap "-success" utility class to the brand green
     without touching each one individually. .btn-success is the one exception - see the
     explicit override further down, since that Bootstrap build bakes its color in as a literal
     hex per rule instead of using this variable. */
  --bs-success: #009f4d;
  --bs-success-rgb: 0, 159, 77;
  --bg: #f5f6f8;
  --border: #e5e7eb;
  --border-input: #d1d5db;
  --text-dark: #111827;
  --text-body: #374151;
  --text-muted: #6b7280;
  --danger: #dc3545;
  --danger-bg: #fdecea;
  --danger-border: #f5c2c0;
  --danger-text: #b3261e;
  --active-bg: #EEF2FF;
}

html {
  font-size: 15px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html, body {
  height: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text-dark);
  font-family: 'Segoe UI', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 3px var(--brand-blue-focus);
  border-color: var(--brand-blue);
}

/* Navbar - white top nav, matches TrackingAssurety's _NavBar.cshtml */
.navbar.app-navbar {
  background-color: #ffffff !important;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.app-navbar .navbar-brand {
  color: var(--brand-blue) !important;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.app-navbar .navbar-brand img.brand-logo {
  height: 22px;
  width: auto;
}

.navbar-nav {
  flex-wrap: wrap;
  row-gap: .25rem;
}

.navbar-nav .nav-item {
  flex-shrink: 0;
}

.app-navbar .nav-link {
  display: flex;
  align-items: center;
  gap: .35rem;
  color: var(--text-body) !important;
  font-weight: 600;
  font-size: .85rem;
  border-radius: 6px;
  padding: .5rem .55rem !important;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}

.app-navbar .dropdown-menu {
  font-size: .85rem;
}

.app-navbar .dropdown-item {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.app-navbar .nav-link:hover {
  background-color: #f3f4f6;
}

.app-navbar .nav-link.active {
  background-color: var(--active-bg);
  color: var(--brand-blue) !important;
}

.app-navbar .nav-link.logout {
  color: var(--danger) !important;
}

.app-navbar .nav-link.logout:hover {
  background-color: var(--danger-bg);
}

.app-navbar .user-chip {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--text-muted);
  font-size: .8rem;
  padding: .5rem .6rem;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Page shell */
/* The sticky-footer flex chain (body: display:flex/column, min-height:100vh) only reaches
   main.page-shell's flex:1 0 auto if main's actual parent also grows to fill body - it doesn't
   by default, so on short-content pages the footer used to sit right under the content instead
   of at the bottom of the viewport. .content-wrap is that parent (the <div class="container">
   wrapping <main> in _Layout.cshtml). */
.content-wrap {
  flex: 1 0 auto;
}

main.page-shell {
  flex: 1 0 auto;
  padding-top: .5rem;
  padding-bottom: 3rem;
}

/* Opt-in (ViewData["FullWidth"] = true, see _Layout.cshtml) - the page's own content bleeds
   edge-to-edge (no left/right/top/bottom padding) and stretches to fill all remaining viewport
   height below the nav rather than a fixed vh guess, so it works regardless of nav/footer height.
   min-height:0 on the flex chain is required so a flex child (the app-card/iframe here) is
   actually allowed to be constrained/scroll instead of growing past its container - flex items
   default to min-height:auto otherwise. */
/* content-wrap only carries flex-item properties (how it behaves as a child of body's flex
   layout) - it isn't itself display:flex, so main.page-shell's own "flex: 1 0 auto" below is
   normally a no-op (flex properties only apply to elements that are themselves flex items).
   .content-wrap-full makes it a flex container too, so main actually stretches to fill it. */
.content-wrap-full {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

main.page-shell.page-shell-full {
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 0;
}

.page-shell-full .app-card {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  /* Full-bleed, edge-to-edge against the nav and browser edges - rounded corners/border/shadow
     read as a floating card, not a screen-filling embed. */
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: .15rem;
  color: var(--text-dark);
}

.page-header .page-subtitle {
  color: var(--text-muted);
  font-size: .9rem;
}

/* Cards */
.app-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, .04);
  overflow: hidden;
}

.app-card .app-card-body {
  padding: 1.25rem 1.4rem;
}

/* Insights page - Chart.js needs a bounded-height parent to size responsive canvases into.
   Kept short (md/sm/donut-sm) so the whole page fits without scrolling on a normal laptop screen. */
.chart-wrap {
  position: relative;
  height: 280px;
}

.chart-wrap-md {
  height: 118px;
}

.chart-wrap-sm {
  height: 108px;
}

.chart-wrap-donut {
  height: 140px;
  width: 140px;
}

/* Rectangular (not square) so Chart.js has room to put the legend beside the ring rather than
   squeezing both into a tiny square - donut stays a healthy size, legend reads cleanly. */
.chart-wrap-donut-sm {
  height: 92px;
  width: 100%;
}

.app-card-body-sm {
  padding: .5rem .8rem;
}

.app-card-body-sm h6 {
  font-size: .82rem;
}

.stat-tile-sm {
  padding: .4rem .75rem;
  gap: .05rem;
}

.stat-tile-sm .stat-label {
  font-size: .64rem;
}

.stat-tile-sm .stat-value {
  font-size: 1.15rem;
}

.mini-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
  padding: .2rem 0;
  border-bottom: 1px dashed var(--border);
}

.mini-stat-row:last-child {
  border-bottom: none;
}

.mini-stat-row .mini-stat-label i {
  color: var(--brand-blue);
  margin-right: .35rem;
}

.signal-light-item {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  color: var(--text-dark);
}

.signal-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: .4rem;
}

.signal-dot.signal-on {
  background: var(--brand-green);
  box-shadow: 0 0 0 3px rgba(0, 159, 77, .18);
}

.signal-dot.signal-off {
  background: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, .18);
}

.map-frame {
  display: block;
  width: 100%;
  height: 78vh;
  min-height: 480px;
  border: none;
}

/* On the Experience page (page-shell-full), the iframe fills whatever height its flex-parent
   .app-card actually has (all remaining space below the nav/header) instead of a fixed vh guess. */
.page-shell-full .map-frame {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.map-frame:fullscreen,
.map-frame:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
}

/* Stat tiles (Dashboard) */
.stat-tile {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.stat-tile .stat-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 700;
}

.stat-tile .stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--brand-blue);
}

/* Dashboard pending/failed file lists - fixed to exactly 5 rows tall (41px per row) regardless of
   how many files there are, scrolling for the rest (up to the 200-file scan cap) instead of the
   card growing to fit however many files are listed. A true `height`, not `max-height`, so the box
   stays the same size even with zero/few files instead of shrinking to fit the empty-state message. */
.file-list-scroll {
  height: 205px;
  overflow-y: auto;
}

/* Badges */
.badge-status-running { background-color: var(--brand-green); }
.badge-status-stopped { background-color: #6b7280; }
.badge-simulated { background-color: #0ea5e9; }
.badge-real { background-color: #f59e0b; color: #1f2430; }

/* Tables */
.app-table thead th {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom-width: 1px;
  background-color: #fafbfd;
}

.app-table td {
  vertical-align: middle;
}

.app-table tbody tr:hover {
  background-color: var(--active-bg);
}

/* Buttons */
.btn-primary {
  background-color: var(--brand-blue);
  border-color: var(--brand-blue);
  font-weight: 600;
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--brand-blue-dark);
  border-color: var(--brand-blue-dark);
}

.btn-outline-secondary, .btn-outline-danger {
  font-weight: 600;
}

/* .bg-success/.text-success (and anything else referencing --bs-success-rgb) pick this up
   automatically via the :root override below - only .btn-success needs an explicit override
   here, since this Bootstrap build bakes its colors in as literal hex rather than referencing
   the variable. */
.btn-success {
  background-color: var(--brand-green);
  border-color: var(--brand-green);
}

.btn-success:hover, .btn-success:focus {
  background-color: var(--brand-green-dark);
  border-color: var(--brand-green-dark);
}

/* Log entry cards (Subscriptions/Logs) */
.log-entry .log-json {
  font-size: .8rem;
  max-height: 320px;
  overflow: auto;
  border-radius: 8px;
}

/* Footer */
.app-footer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .85rem;
}

/* Auth pages (Login) - matches TrackingAssurety's Pages/Login.cshtml card language */
.auth-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background-color: var(--bg);
  font-family: 'Segoe UI', Arial, sans-serif;
}

.auth-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .08);
  padding: 40px;
  width: 100%;
  max-width: 360px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 8px;
}

.auth-logo img {
  width: 190px;
}

.auth-logo img.auth-logo-img {
  width: 280px;
  max-width: 100%;
}

.auth-app-name {
  text-align: center;
  font-weight: 700;
  color: var(--text-dark);
  margin-top: 10px;
  font-size: 1rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 6px 0 26px;
}

.auth-field-group {
  margin-bottom: 18px;
}

.auth-field-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 6px;
}

.auth-input-wrap {
  position: relative;
}

.auth-input-wrap i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 15px;
  pointer-events: none;
}

.auth-input-wrap .form-control {
  padding-left: 38px;
  border-radius: 8px;
  border: 1px solid var(--border-input);
  font-size: 14px;
}

.auth-input-wrap .form-control:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px var(--brand-blue-focus);
}

.auth-check {
  font-size: 13px;
  color: var(--text-body);
}

.auth-alert-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-auth-primary {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: var(--brand-blue);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  transition: background .15s ease;
}

.btn-auth-primary:hover {
  background: var(--brand-blue-dark);
  color: #fff;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin: 16px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.auth-divider span {
  padding: 0 10px;
}

.btn-auth-secondary {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-body);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s ease;
}

.btn-auth-secondary:hover {
  background: var(--surface-hover, #f4f5f7);
  color: var(--text-body);
}

/* Chatbot widget - floating launcher + collapsible window, added once in _Layout.cshtml so it's
   available site-wide for authenticated users. Fixed to the viewport, not the page, so it stays
   put while the page content scrolls underneath it. */
.chatbot-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(17, 24, 39, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1050;
  transition: background .15s ease, transform .1s ease;
}

.chatbot-launcher:hover {
  background: var(--brand-blue-dark);
  transform: scale(1.05);
}

.chatbot-window {
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 460px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, .18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1050;
}

.chatbot-header {
  background: var(--brand-blue);
  color: #fff;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
}

.chatbot-header button {
  background: none;
  border: none;
  color: #fff;
  opacity: .85;
  font-size: 1.1rem;
  cursor: pointer;
}

.chatbot-header button:hover {
  opacity: 1;
}

.chatbot-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  background: var(--bg);
}

.chatbot-message {
  max-width: 85%;
  padding: .5rem .75rem;
  border-radius: 12px;
  font-size: .9rem;
  line-height: 1.35;
  word-wrap: break-word;
}

.chatbot-message-user {
  align-self: flex-end;
  background: var(--brand-blue);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.chatbot-message-bot {
  align-self: flex-start;
  background: #fff;
  color: var(--text-dark);
  border: 1px solid var(--border);
  border-bottom-left-radius: 2px;
}

.chatbot-message-error {
  align-self: flex-start;
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.chatbot-input-row {
  flex: 0 0 auto;
  display: flex;
  gap: .5rem;
  padding: .6rem;
  border-top: 1px solid var(--border);
}

.chatbot-input-row input {
  flex: 1 1 auto;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  padding: .4rem .6rem;
  font-size: .9rem;
}

.chatbot-input-row button {
  border: none;
  background: var(--brand-blue);
  color: #fff;
  border-radius: 8px;
  width: 36px;
  flex: 0 0 auto;
  cursor: pointer;
}

.chatbot-input-row button:disabled {
  opacity: .6;
  cursor: default;
}
