/* General Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/*  */
body {
  background-color: #121212;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #e0e0e0;
  line-height: 1.5;
}

/*div for dashboard of the graph display*/
.dashboard {
  background-color: #1b1b1b;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 40px 20px;
  max-width: 1000px;
  margin: auto;
}

.vital-box {
  background-color: none;
  display: flex;
  padding: 0px;
  align-items: stretch;
}

/* Vital Info */
.vital-info {
  display: inline-block;
  margin-right: 12px;
  border-radius: 12px;
  flex-direction: column;
  width: 15%;
  height: 200px;
  background-color: #00000079;
  justify-content: space-between;
  padding: 12px;
}

/* Chart wrapper */
.chart-wrapper {
  flex: 1;
  position: relative;
  margin-right: 5px;
  font-family: Arial, Helvetica, sans-serif;
  width: 500px;
  height: 200px;
  overflow: hidden;
}

/* Vital Header */
.vital-header {
  font-size: 16px;
  color: #ffffff;
  margin-bottom: 10px;
}

/* Vital Value */
.vital-value {
  font-size: 36px;
  font-weight: bold;
  margin-bottom: 15px;
}

/* UPDATED: RR Container - Inline layout */
.vital-rr-container {
  display: flex;
  align-items: baseline;
  /* Align text on baseline */
  gap: 6px;
  /* Space between label and value */
  margin-top: 8px;
  /* Space below ETCO2 value */
}

/* RR Label - inline */
.vital-labelrr {
  font-size: 20px;
  color: #aaa;
  font-weight: 600;
}

/* RR Value - inline with reduced size */
.vital-valuerr {
  font-size: 20px;
  /* Reduced from 36px to 20px */
  font-weight: bold;
  color: #ffffff;
}

/* Container for graph elements */
.vital-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Graph Name - Aligned to bottom */
.graph-name,
.vital-graph-label {
  font-size: 14px;
  color: #888;
  margin-top: auto;
  padding-top: 10px;
}

/* If you want both to be at the bottom as a group */
.vital-bottom-group {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Canvas Graph */
canvas {
  display: flex;
  width: 100% !important;
  height: 200px !important;
  background-color: #121212;
  border-radius: 12px;
}

/* Unique Value Colors */
.green {
  color: Green;
}

.yellow {
  color: #E6B800;
}

.red {
  color: red;
}

.orange {
  color: orange;
}

/* ETCO2 Specific Styles */
.vital-header-row {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  margin-top: 4px;
}

.vital-label-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.vital-label {
  font-size: 12px;
  font-weight: 600;
  color: white;
  margin-bottom: 2px;
}

/* Sweep Bar - thin line continuously moving */
.sweep-bar {
  position: absolute;
  top: 0;
  left: -10%;
  width: 1.25%;
  height: 100%;
  background-color: #121212;
  animation: sweepGap 5s linear infinite;
  animation-delay: 5s;
  z-index: 2;
  pointer-events: none;
}

/* Sweep animation */
@keyframes sweepGap {
  0% {
    left: -10%;
  }

  100% {
    left: 100%;
  }
}

/* Reveal Bar - full canvas-sized bar sliding right-to-left to reveal graph */
.reveal-bar {
  position: absolute;
  top: 0;
  left: 100%;
  width: 100%;
  height: 100%;
  background-color: #121212;
  animation: revealGraph 5s ease-out forwards;
  animation-delay: 0s;
  z-index: 3;
  pointer-events: none;
}

/* Reveal animation: move left from 100% to 0, sliding reveal-bar leftward */
@keyframes revealGraph {
  from {
    left: 0%;
  }

  to {
    left: 100%;
  }
}

/* ===== ETCO2-specific Animations (10 seconds) ===== */
/* Sweep Bar for ETCO2 */
.sweep-bar-etco2 {
  position: absolute;
  top: 0;
  left: -10%;
  width: 1.25%;
  height: 100%;
  background-color: #121212;
  animation: sweepETCO2 10s linear infinite;
  animation-delay: 10s;
  z-index: 2;
  pointer-events: none;
}

/* Sweep animation (10s full sweep) */
@keyframes sweepETCO2 {
  0% {
    left: 0%;
  }

  100% {
    left: 100%;
  }
}

/* Reveal Bar for ETCO2 */
.reveal-bar-etco2 {
  position: absolute;
  top: 0;
  left: 100%;
  width: 100%;
  height: 100%;
  background-color: #121212;
  animation: revealETCO2 10s ease-out forwards;
  animation-delay: 0s;
  z-index: 3;
  pointer-events: none;
}

/* Reveal animation (10s slide) */
@keyframes revealETCO2 {
  from {
    left: 0%;
  }

  to {
    left: 100%;
  }
}

/* === BUTTON CONTAINER BELOW DASHBOARD === */
.button-container {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20%;
  margin-top: 40px;
  margin-bottom: 60px;
}

/* === BUTTON STYLES === */
.left-button,
.right-button {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: #ffffff;
  background-color: #2E3192;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  transition: background-color 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease;
}

/* Red button style for left button */
.left-button {
  background-color: #F90618;
}

/* Hover effect - subtle pop */
.left-button:hover,
.right-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.5);
}

/* Pressed effect */
.left-button:active,
.right-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

/* Responsive button placement example */
button {
  margin: 6px;
}

/* Optional container alignment */
.button-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
}

/* Responsive Design */
@media (max-width: 1080px) {
  .button-container {
    flex-direction: column;
    align-items: center;
  }

  .dashboard {
    padding: 20px 10px;
  }

  .vital-box {
    padding: 15px;
  }

  .vital-header {
    font-size: 16px;
  }

  .vital-value {
    font-size: 28px;
  }

  .vital-valuerr {
    font-size: 16px;
    /* Adjusted for responsive */
  }

  .graph-name {
    font-size: 12px;
  }

  canvas {
    height: 180px !important;
  }
}

@media (max-width: 720px) {
  .button-container {
    padding: 10px;
  }

  .vital-box {
    padding: 10px;
  }

  .vital-header {
    font-size: 14px;
  }

  .vital-value {
    font-size: 24px;
  }

  .vital-valuerr {
    font-size: 14px;
    /* Adjusted for responsive */
  }

  .graph-name {
    font-size: 10px;
  }

  canvas {
    height: 150px !important;
  }

  .chart-time-overlay {
    font-size: 0.8em;
    padding: 4px 8px;
  }
}

@media (max-width: 480px) {
  .button-container {
    flex-direction: column;
    align-items: center;
  }

  .left-button,
  .right-button {
    width: 100%;
    margin-bottom: 10px;
  }

  .dashboard {
    padding: 10px;
  }

  .vital-box {
    padding: 8px;
  }

  .vital-header {
    font-size: 12px;
  }

  .vital-value {
    font-size: 20px;
  }

  .vital-valuerr {
    font-size: 12px;
    /* Adjusted for responsive */
  }

  .graph-name {
    font-size: 8px;
  }

  canvas {
    height: 120px !important;
  }

  .chart-time-overlay {
    font-size: 0.7em;
    padding: 3px 6px;
  }
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(10, 10, 10, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  /* Ensure it is above the navbar (z-index 1000) */
}

.popup-content {
  background: linear-gradient(135deg, #121212, #1e1e1e);
  padding: 24px 32px;
  border-radius: 16px;
  text-align: center;
  width: 340px;
  box-shadow: 0 0 0.1px black;
  color: #f0f0f0;
  font-family: 'Segoe UI', sans-serif;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* === DESCRIPTION: Draggable Desktop Styles === */
@media (min-width: 769px) {
  .popup-overlay {
    background-color: transparent;
    /* Invisible background */
    pointer-events: none;
    /* Allow clicking through to graphs */
    display: block;
    /* Disable flex centering */
  }

  .popup-content {
    pointer-events: auto;
    /* Enable interaction with the popup itself */
    position: absolute;
    /* Allow moving freely */
    top: 140px;
    /* Clear the navbar vertically */
    right: 20px;
    /* Align to right side */
    left: auto;
    transform: none;
    /* Remove centering */
    /* Allow moving freely */
    /* Initial dragging styles */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .popup-content h2 {
    cursor: move;
    /* Explicit 'Move' icon */
    /* Show draggable cursor */
    user-select: none;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin: -10px -10px 10px -10px;
    /* Expand grab area */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }

  .drag-handle {
    font-size: 20px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.6);
    cursor: move;
    line-height: 1;
    margin-top: -3px;
    letter-spacing: 2px;
    /* Use a border-based icon if text fails, but text `::` should work */
  }

  .popup-content h2:active {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.1);
  }

  .popup-content h2:active .drag-handle {
    cursor: grabbing;
    color: rgba(255, 255, 255, 0.8);
  }
}



/* Heartbeat animation only when hovered (Desktop uses specific animation to preserve centering) */
.popup-content:hover {
  animation: heartbeat 0.75s 1;
}

@media (min-width: 769px) {
  .popup-content:hover {
    animation: heartbeat 0.75s 1;
  }
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0.1px black;
  }

  50% {
    transform: scale(1.03);
    box-shadow: 0 0 0.2px black;
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0.4px black;
  }
}


.size-controls {
  margin: 20px 0;
}

.size-controls button {
  font-size: 26px;
  margin: 0 10px;
  padding: 12px 26px;
  border: none;
  border-radius: 10px;
  background: #00e676;
  color: #111;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.3s ease;
}

.size-controls button:hover {
  transform: scale(1.1);
  background: #00c853;
}

.close-popup {
  margin-top: 20px;
  padding: 10px 20px;
  background: #2c2c2c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s ease;
}

.close-popup:hover {
  background: #444;
}

/* Hide element */
.hidden {
  display: none !important;
}

.visible-force {
  display: block !important;
}

/* Graph Toggle Buttons Styling */
.toggle-graph-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.toggle-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  background-color: #388e3c;
}

.toggle-btn:hover {
  transform: scale(1.05);
}

/* Base styles for all devices */
.sweep-bar {
  position: absolute;
  top: 0;
  left: -10%;
  width: 1.25%;
  height: 100%;
  background-color: #121212;
  animation: sweepGap 5s linear infinite;
  animation-delay: 5s;
  z-index: 2;
  pointer-events: none;
}

.reveal-bar {
  position: absolute;
  top: 0;
  left: 100%;
  width: 100%;
  height: 100%;
  background-color: #121212;
  animation: revealGraph 5s ease-out forwards;
  animation-delay: 0s;
  z-index: 3;
  pointer-events: none;
}

@keyframes sweepGap {
  0% {
    left: -10%;
  }

  100% {
    left: 100%;
  }
}

@keyframes revealGraph {
  from {
    left: 0%;
  }

  to {
    left: 100%;
  }
}

@media (min-width: 360px) and (max-width: 720px) {
  .vital-item {
    flex: 1 1 45%;
  }

  .chart-wrapper,
  canvas {
    height: 160px !important;
  }

  .vital-value {
    font-size: 22px;
  }

  .vital-valuerr {
    font-size: 14px;
    /* Adjusted for mobile */
  }

  .button-container {
    margin-bottom: 30px;
  }
}

/* Graph Toggle Buttons Styling */
.toggle-graph-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

/* === FLOATING ZOOM CONTROLS (DARK THEME) === */
.floating-zoom-controls {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

/* === BUTTON STYLE === */
.floating-zoom-controls button {
  background: linear-gradient(145deg, #1c1c1c, #2a2a2a);
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 600;
  width: 46px;
  height: 46px;
  cursor: pointer;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.6),
    inset 0 1px 2px rgba(255, 255, 255, 0.1);
  transition: all 0.25s ease;
}

/* === HOVER EFFECT === */
.floating-zoom-controls button:hover {
  background: linear-gradient(145deg, #2e2e2e, #3a3a3a);
  color: #F90618;
  transform: scale(1.08);
  box-shadow:
    0 6px 12px rgba(0, 0, 0, 0.7),
    inset 0 1px 3px rgba(255, 255, 255, 0.1);
}

/* === ACTIVE (CLICKED) EFFECT === */
.floating-zoom-controls button:active {
  transform: scale(0.92);
  background: linear-gradient(145deg, #1a1a1a, #242424);
  color: #2E3192;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.8),
    inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* === SMOOTH ZOOM TRANSITION === */
.dashboard {
  transition: transform 0.25s ease-in-out;
}

/* === Scalable Dashboard Wrapper === */
.dashboard-scale-wrapper {
  display: inline-block;
  transform-origin: top center;
  transition: transform 0.25s ease;
  width: 100%;
}

/* Prevent overlapping of next sections */
.dashboard-container {
  position: relative;
  z-index: 1;
  margin-bottom: 4rem;
}

/* Ensure QR Section always stays below */
.resus-session-id-qr-section {
  position: relative;
  z-index: 2;
  background: #1a1a1a;
  margin-top: 2rem;
}

.resus-session-id-qr-section::before {
  background: #F90618;
}

.resus-session-id-current span {
  color: #2E3192;
  background: none;
}