/* ─────────────────────────────────────────────────────────
   Global utilities
   ───────────────────────────────────────────────────────── */

/* Header text marquee */
.scroll-left {
  white-space: nowrap;
  overflow-x: scroll;
  animation: scroll-left 20s linear infinite;
}
@keyframes scroll-left {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* Small gap helper on md+; no gap on mobile */
.only-between > .col-md-6:first-child { padding-right: 5px; }
.only-between > .col-md-6:last-child  { padding-left:  5px; }
@media (max-width: 767.98px) {
  .only-between > [class^="col"] { padding-left: 0 !important; padding-right: 0 !important; }
}

/* ─────────────────────────────────────────────────────────
   Plotly modebar (vertical variant + globals)
   ───────────────────────────────────────────────────────── */

/* Keep any Plotly modebar visible, above overlays */
.js-plotly-plot .plotly .modebar {
  position: absolute !important;
  z-index: 1000 !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Opt-in vertical bar: add className="modebar-right-vertical" to dcc.Graph */
.modebar-right-vertical .modebar-container {
  position: absolute !important;
  top: 2px !important;
  right: 2px !important;
  left: auto !important;
  bottom: auto !important;
  width: auto !important;   /* don’t stretch full width */
  height: auto !important;  /* avoid 0-height container */
  pointer-events: none !important; /* container passive… */
}
.modebar-right-vertical .modebar {
  left: auto !important;
  right: 2px !important;
  top: 2px !important;
  bottom: auto !important;
  display: flex !important;
  flex-direction: column !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: auto !important;  /* …buttons remain clickable */
}
.modebar-right-vertical .modebar .modebar-group {
  display: flex !important;
  flex-direction: column !important;
  margin: 0 !important;
}
.modebar-right-vertical .modebar .modebar-btn {
  margin: 2px 0 !important;
  filter: none !important;
  box-shadow: none !important;
  opacity: 1 !important;
  /* Theme-aware default dim */
  color: rgba(var(--bs-body-color-rgb, 255,255,255), 0.25) !important;
}
.modebar-right-vertical .modebar .modebar-btn:hover,
.modebar-right-vertical .modebar .modebar-btn:focus,
.modebar-right-vertical .modebar .modebar-btn.active {
  color: rgba(var(--bs-body-color-rgb, 255,255,255), 0.80) !important;
}
/* Ensure SVG icons inherit color */
.modebar-right-vertical .modebar .modebar-btn svg path {
  fill: currentColor !important;
}

/* Touch: larger hit targets */
@media (pointer: coarse) {
  .js-plotly-plot .plotly .modebar-btn { padding: 9px 10px; }
}

/* modebar tooltio hide animation */
.modebar-right-vertical .modebar .modebar-btn::after { transition: none !important; }
.modebar-right-vertical .modebar .modebar-btn:hover::after,
.modebar-right-vertical .modebar .modebar-btn:focus::after {
  animation: tooltip-hide-2s 2s forwards !important;
}


/* If you overlay a home button, keep it below the modebar and leave space */
/* ── Home button tooltip (uses data-tip) ─────────────────────────────── */
.home-btn {
  position: relative;                /* anchor for ::before/::after */
  outline: none;
}

/* bubble */
.home-btn::after {
  content: attr(data-tip);
  position: absolute;
  top: 100%;                         /* below the button */
  right: 0;                          /* align to right edge */
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
  color: var(--bs-body-bg);
  background: var(--bs-body-color);  /* fallback */
  background: color-mix(in srgb, var(--bs-body-color) 85%, transparent);
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  pointer-events: none;
  z-index: 3001;                     /* just above Plotly modebar (3000) */
  transition:
    opacity .15s ease,
    transform .15s ease,
    visibility 0s linear .15s;       /* delay hiding for smooth fade */
}

/* show on hover & keyboard focus */
/* Show tooltip on hover & keyboard focus */
.home-btn:hover::after,
.home-btn:focus-visible::after,
.home-btn:hover::before,
.home-btn:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity .15s ease,
    transform .15s ease,
    visibility 0s;
}

/* Auto-hide after 2s ONLY when focused AND NOT hovered */
@keyframes tooltip-hide-2s {
  0%, 85% { opacity: 1; visibility: visible; }
  100%    { opacity: 0; visibility: hidden; }
}
.home-btn:focus-visible:not(:hover)::after { animation: tooltip-hide-2s 2s forwards; }
.home-btn:focus-visible:not(:hover)::before { animation: tooltip-hide-2s 2s forwards; }

/* If hovering, cancel any prior animation “forwards” state */
.home-btn:hover::after,
.home-btn:hover::before {
  animation: none !important;
}

/* icon styling */
.home-btn i {
  font-size: 20px;
  color: var(--bs-body-color);
  opacity: .7;
  transition: opacity .2s ease, filter .2s ease;
}

.home-btn:hover i,
.home-btn:focus-visible i {
  opacity: 1;
  filter: brightness(1.6);
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .home-btn::before,
  .home-btn::after { transition: none; }
}


/* ─────────────────────────────────────────────────────────
   Photo tab
   ───────────────────────────────────────────────────────── */

.photo-frame{
  position: relative;
  display:flex;
  align-items:center;
  justify-content:center;
  width: 100%;
  height: 60vh;                 /* phone/tablet default */
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(69,90,100,0.6);
  background: transparent;
  border-radius: 20px;
}
.photo-mask{
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  isolation: isolate;
  will-change: transform;
}
.photo-img{
  display:block;
  width:100%;
  height:100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 0 !important;  /* rounding from mask */
}
@media (min-width: 992px){
  .photo-frame{ width: 56vw; height: 72vh; overflow: hidden; }
  .photo-mask{ background: var(--bs-body-bg, #0b0b0b); }
  .photo-img{ object-fit: cover; }
}
.photo-arrow{
  position:absolute;
  top:50%;
  transform: translateY(-50%);
  z-index: 2;
  border:none;
  background: rgba(0,0,0,0.25);
  color: var(--bs-body-color, #fff);
  backdrop-filter: blur(2px);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.photo-arrow:hover{ background: rgba(0,0,0,0.35); }
.photo-arrow-left { left: 8px; }
.photo-arrow-right{ right: 8px; }
.photo-caption{
  position:absolute;
  bottom: 6px;
  left: 12px;
  right: 12px;
  text-align:center;
  font-size: 1.1rem;
  color: var(--bs-body-color, #eee);
}
@media (min-width: 992px){
  .photo-caption{ font-size: 1.25rem; }
}
@keyframes kenburnsA { 0%{transform:scale(1)} 100%{transform:scale(1.2)} }
@keyframes kenburnsB { 0%{transform:scale(1.06)} 100%{transform:scale(1)} }
.photo-anim-A { animation: kenburnsA 4s linear forwards; }
.photo-anim-B { animation: kenburnsB 4s linear forwards; }
.fade-in { animation: fadein .4s ease; }
@keyframes fadein { from{opacity:0} to{opacity:1} }

#photos-mode-tabs { display:flex; justify-content:center; gap: 8px; }

/* ─────────────────────────────────────────────────────────
   Dropdown tweaks (v1/v2 compatible)
   ───────────────────────────────────────────────────────── */

.Select-control,
.is-focused .Select-control,
.has-value .Select-control,
.has-value.Select--single > .Select-control,
.is-open .Select-control {
  border: 2px solid var(--bs-primary) !important;
  border-radius: 10px;
  box-shadow: none !important;
}
.Select-placeholder,
.Select-value,
.Select-value-label,
.Select-input > input {
  color: var(--bs-body-color) !important;
}

/* ─────────────────────────────────────────────────────────
   KPI cards & Material icons
   ───────────────────────────────────────────────────────── */

.card-kpi { border-left: 15px solid var(--bs-primary); height: 100%; padding: 0.75rem; }

@font-face {
  font-display: block;
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 400;
  src: url("./fonts/material-symbols-outlined.woff2") format("woff2");
}
.material-symbols-outlined {
  direction: ltr;
  display: inline-block;
  font-family: 'Material Symbols Outlined', sans-serif;
  font-feature-settings: 'liga';
  font-size: 24px;
  -webkit-font-smoothing: antialiased;
  font-style: normal;
  font-weight: normal;
  letter-spacing: normal;
  line-height: 1;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
}
.card-kpi .material-symbols-outlined { margin: auto 0; }

.card-kpi-title { font-size: 1rem; margin: 0; }

.card-kpi .card-header,
.card-kpi .card-footer,
.card-kpi .card-body {
  align-items: center;
  background: none;
  border: none;
  margin: 0;
  padding: 0;
}
.card-kpi .card-header { display: flex; flex-direction: row; gap: 0.5rem; }
.card-kpi .card-body { align-items: center; color: var(--bs-primary); display: flex; flex-grow: 1; font-size: 1.5rem; font-weight: 600; }
.card-kpi .card-footer { color: var(--bs-primary); display: flex; font-weight: 600; gap: 0.25rem; }
.card-kpi .card-footer .material-symbols-outlined { font-size: 1.25rem; }

.card-kpi .color-pos.card-footer { color: var(--bs-blue); }
.card-kpi .color-neg.card-footer { color: var(--bs-pink); }
.card-kpi:has(.color-pos) { border-left: 4px solid var(--bs-blue); }
.card-kpi:has(.color-neg) { border-left: 4px solid var(--bs-pink); }

/* Style for the input area footer */
.chat-input-area {
  position: fixed; /* This is the key property */
  bottom: 0;
  left: 0;
  width: 100%;

  /* Styling to match your screenshot */
  background-color: #1a1a1a; /* Dark background */
  padding: 12px;
  display: flex; /* Helps align the input and button */
  align-items: center;
  box-sizing: border-box; /* Important for padding and width calculation */
}

/* Style the text input field */
.chat-input-area input {
  flex-grow: 1; /* Allows the input to take up most of the space */
  margin-right: 10px; /* Space between input and button */
  /* Add your other styling like border-radius, color, etc. */
}

/* Add padding to the bottom of the main content */
.chat-messages {
  /* This prevents the last message from being hidden by the fixed input area */
  /* The value should be slightly more than the height of your .chat-input-area */
  padding-bottom: 80px;
}

/* Dash dcc.Dropdown uses react-select (v1-style class names) */
/* ========= Shared base styles for your wrapper class ========= */
.dark-friendly-dd {
  font-size: 14px;
}

/* Control (closed) */
.dark-friendly-dd .Select-control {
  border-radius: 8px;
  transition: border-color .15s ease, box-shadow .15s ease;
  min-height: 38px;
}

/* Placeholder + value text */
.dark-friendly-dd .Select-placeholder,
.dark-friendly-dd .Select--single > .Select-control .Select-value,
.dark-friendly-dd .Select-value-label {
  line-height: 36px; /* vertically center text */
}

/* Indicators (arrow, clear) */
.dark-friendly-dd .Select-arrow-zone,
.dark-friendly-dd .Select-clear-zone {
  padding: 0 10px;
}

/* Menu popover & options */
.dark-friendly-dd .Select-menu-outer {
  border-radius: 8px;
  margin-top: 6px;
  z-index: 1005; /* above modals/toolbars if needed */
}
.dark-friendly-dd .Select-option {
  padding: 8px 10px;
  cursor: pointer;
}

/* Focus/active state (applies in both themes; colors overridden below) */
.dark-friendly-dd .is-focused > .Select-control,
.dark-friendly-dd .Select-control:hover {
  border-width: 1px;
  outline: none;
}

/* Disabled state */
.dark-friendly-dd .is-disabled > .Select-control {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ========= DARK THEME ========= */
/* Dark mode: selected option & value styling */
[data-bs-theme="dark"] .dark-friendly-dd .Select--single > .Select-control .Select-value,
[data-bs-theme="dark"] .dark-friendly-dd .Select-value-label {
  color: #ffffff !important;             /* white text for selected value */
  background-color: #1e293b !important;  /* dark slate background */
}

[data-bs-theme="dark"] .dark-friendly-dd .Select-control {
  background-color: #111827; /* slate-900 */
  border: 1px solid #334155; /* slate-700 */
  color: #f1f5f9;            /* slate-100 */
}
[data-bs-theme="dark"] .dark-friendly-dd .Select-placeholder {
  color: #94a3b8; /* slate-400 */
}
[data-bs-theme="dark"] .dark-friendly-dd .is-focused > .Select-control,
[data-bs-theme="dark"] .dark-friendly-dd .Select-control:hover {
  border-color: #2563eb; /* blue-600 */
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}
[data-bs-theme="dark"] .dark-friendly-dd .Select-menu-outer {
  background-color: #0b1220; /* dark panel */
  border: 1px solid #334155;
}
[data-bs-theme="dark"] .dark-friendly-dd .Select-option {
  color: #e5e7eb; /* gray-200 */
}
[data-bs-theme="dark"] .dark-friendly-dd .Select-option.is-focused {
  background-color: rgba(37, 99, 235, 0.18);
}
[data-bs-theme="dark"] .dark-friendly-dd .Select-option.is-selected {
  background-color: rgba(37, 99, 235, 0.28);
  font-weight: 600;
}

/* ========= LIGHT THEME ========= */
[data-bs-theme="light"] .dark-friendly-dd .Select-control {
  background-color: #ffffff;
  border: 1px solid #cbd5e1; /* slate-300 */
  color: #0f172a;            /* slate-900 */
}
[data-bs-theme="light"] .dark-friendly-dd .Select-placeholder {
  color: #64748b; /* slate-500 */
}
[data-bs-theme="light"] .dark-friendly-dd .is-focused > .Select-control,
[data-bs-theme="light"] .dark-friendly-dd .Select-control:hover {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
[data-bs-theme="light"] .dark-friendly-dd .Select-menu-outer {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
}
[data-bs-theme="light"] .dark-friendly-dd .Select-option {
  color: #0f172a;
}
[data-bs-theme="light"] .dark-friendly-dd .Select-option.is-focused {
  background-color: rgba(37, 99, 235, 0.10);
}
[data-bs-theme="light"] .dark-friendly-dd .Select-option.is-selected {
  background-color: rgba(37, 99, 235, 0.18);
  font-weight: 600;
}

/* ========= Clear/caret color tweaks ========= */
[data-bs-theme="dark"] .dark-friendly-dd .Select-arrow,
[data-bs-theme="dark"] .dark-friendly-dd .Select-clear {
  border-top-color: #93c5fd; /* light blue caret */
  color: #bfdbfe;
}
[data-bs-theme="light"] .dark-friendly-dd .Select-arrow,
[data-bs-theme="light"] .dark-friendly-dd .Select-clear {
  border-top-color: #2563eb;
  color: #2563eb;
}

/* ──────────────────────────────────────────────────────────────
   Compact, rounded DatePickerRange (works in light & dark modes)
   Scope to just our Reports picker via .date-compact wrapper
   ────────────────────────────────────────────────────────────── */

/* Same look/feel as dropdown (.form-select / .dark-friendly-dd) */
.date-compact .DateRangePickerInput {
  /* height + rounding + border to match dropdowns */
  height: 40px;                  /* match your dropdown height */
  border-radius: 10px;           /* same round as your dropdown */
  border: 1px solid rgba(0,0,0,0.15);
  background: #ffffff;
  display: flex;
  align-items: center;
  padding: 0 8px;
  box-shadow: none;
}

/* Make inner inputs match text size & vertical centering */
.date-compact .DateInput,
.date-compact .DateInput_input {
  height: 38px;                  /* align with 40px outer minus borders */
  line-height: 38px;
  font-size: 14px;               /* match dropdown text */
  padding: 0 8px;
  background: transparent !important;
  border: none !important;
  color: #111827;                /* slate-900 */
}

/* Arrow between inputs consistent & subtle */
.date-compact .DateRangePickerInput_arrow {
  padding: 0 6px;
  color: #6b7280;                /* gray-500 */
}

/* Focus ring consistent with dropdown focus */
.date-compact .DateRangePickerInput:focus-within {
  border-color: #60a5fa;         /* blue-400 */
  box-shadow: 0 0 0 3px rgba(96,165,250,0.25);
}

/* Calendar popover keeps the rounded aesthetic */
.date-compact .DayPicker {
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

/* Dark mode parity */
[data-bs-theme="dark"] .date-compact .DateRangePickerInput {
  background: #0b111b;
  border: 1px solid rgba(255,255,255,0.12);
}

[data-bs-theme="dark"] .date-compact .DateInput_input {
  color: #e5e7eb !important;     /* gray-200 */
}

[data-bs-theme="dark"] .date-compact .DateRangePickerInput_arrow {
  color: #9ca3af;                 /* gray-400 */
}

[data-bs-theme="dark"] .date-compact .DayPicker {
  background: #0b111b;
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

/* Ensure both wrappers have identical block dimensions */
#rep-window-wrap,
#rep-daterange-wrap {
  width: 100%;
}

/* The slot ensures both controls occupy the same footprint */
.time-control-slot {
  width: 100%;
}

/* Match dropdown look for DatePicker bar */
.date-compact .DateRangePickerInput {
  height: 40px;                 /* == dropdown height */
  border-radius: 10px;          /* == dropdown rounding */
  border: 1px solid rgba(0,0,0,0.15);
  background: #ffffff;
  display: flex;
  align-items: center;
  padding: 0 8px;
  box-shadow: none;
}

.date-compact .DateInput,
.date-compact .DateInput_input {
  height: 38px;                 /* inner height to vertically center text */
  line-height: 38px;
  font-size: 14px;              /* == dropdown text size */
  padding: 0 8px;
  background: transparent !important;
  border: none !important;
  color: #111827;
}

.date-compact .DateRangePickerInput_arrow { padding: 0 6px; color: #6b7280; }

.date-compact .DateRangePickerInput:focus-within {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96,165,250,0.25);
}

/* Dark mode parity (Bootstrap data-bs-theme) */
[data-bs-theme="dark"] .date-compact .DateRangePickerInput {
  background: #0b111b;
  border: 1px solid rgba(255,255,255,0.12);
}
[data-bs-theme="dark"] .date-compact .DateInput_input { color: #e5e7eb !important; }
[data-bs-theme="dark"] .date-compact .DateRangePickerInput_arrow { color: #9ca3af; }

.rounded-img {
    width: 100%;
    border-radius: 50px;       /* adjust as you like: 8px, 12px, 20px */
    display: block;            /* IMPORTANT for centering */
    margin-left: auto;         /* center horizontally */
    margin-right: auto;        /* center horizontally */
}

    overflow: hidden;
    display: block;
}

.img-wrapper {
    margin-bottom: 20px;
}

.img-caption {
    margin-top: 6px;
    font-size: 0.9rem;
    text-align: center;
    color: #555;
}

/* Ferrari red tabs for vibration sensors */
.ferrari-red {
color: #FF2800 !important;        /* Ferrari red text */
font-weight: 600;
}

/* Keep active vibration tab Ferrari Red + underline */
.nav-tabs .nav-link.ferrari-red.active,
.nav-tabs .nav-link.ferrari-red.tab--selected {
color: #FF2800 !important;
border-color: transparent transparent #FF2800 !important;
}

/* Critical battery pulsing animation */
.battery-critical {
    animation: pulse-red 1s infinite;
}


/* ───────── Animated battery widget ───────── */

.battery-wrapper {
  display: inline-flex;
  align-items: center;
}

.battery-shell {
  position: relative;
  width: 40px;
  height: 18px;
  border: 2px solid #aaa;
  border-radius: 8px;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.1);
}

/* Little cap at the right side */
.battery-cap {
  position: absolute;
  top: 4px;
  right: -6px;
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background-color: #aaa;
}

/* ── Charging: animated loop (On Solar) ── */
/* ──────────────────────────────── */
/*   UPRIGHT BATTERY (Direction FIX) */
/* ──────────────────────────────── */
/* ──────────────────────────────── */
/*  UPRIGHT, 75% SIZE, CHARGING UP */
/* ──────────────────────────────── */

.battery-wrapper {
  display: inline-flex;
  align-items: center;
  transform: scale(0.75);      /* 75% of original size */
  transform-origin: top right;
}

.battery-shell {
  position: relative;
  width: 14px;
  height: 30px;
  border: 2px solid #aaa;
  border-radius: 3px;
  overflow: hidden;
  background-color: rgba(0,0,0,0.1);
}

/* Positive terminal at the TOP */
.battery-cap {
  position: absolute;
  top: -6px;
  left: 3px;
  width: 6px;
  height: 3px;
  border-radius: 2px;
  background-color: #aaa;
}

/* Fill, anchored at bottom so it grows UP */
.battery-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 20%;                      /* default */
  transform-origin: bottom;         /* 🔥 force bottom → top */
  background: linear-gradient(to top, #22c55e, #bef264);
}

/* Charging (On Solar) */
.battery-wrapper.charging .battery-fill {
  animation: battery-charge-up 3s linear infinite;
}

/* Normal (>12.5V, not charging) */
.battery-wrapper.normal .battery-fill {
  height: 70%;
  animation: none;
  background: linear-gradient(to top, #22c55e, #4ade80);
}

/* Medium (11.5–12.5V) */
.battery-wrapper.medium .battery-fill {
  height: 50%;
  animation: none;
  background: linear-gradient(to top, #eab308, #facc15);
}

/* Low (<11.5V) */
.battery-wrapper.low .battery-fill {
  height: 30%;
  animation: none;
  background: linear-gradient(to top, #ff2800, #f97373);
}

/* 3-second loop, **bottom → top** */
@keyframes battery-charge-up {
  0%   { height: 20%; }
  25%  { height: 45%; }
  50%  { height: 70%; }
  75%  { height: 100%; }
  100% { height: 20%; }
}

/* KPI Title to animate */
@keyframes flamePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.kpi-title span:first-child,
.kpi-title span:last-child {
  animation: flamePulse 1.5s infinite ease-in-out;
}

