/* ================================
   Tile cards (glass)
================================ */

.tile-card {
  border-radius: 1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;

  background-color: rgba(27, 29, 60, 0.1);
  background-clip: padding-box;

  -webkit-backdrop-filter: blur(2px) !important;
  backdrop-filter: blur(3px) !important;
  filter: saturate(120%);

  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 6px 16px rgba(0, 0, 0, 0.4);

  background-image: radial-gradient(
    circle at bottom center,
    rgba(248, 7, 168, 0.1),
    transparent 80%
  );
}

/* Optional gradient ring */
.tile-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  border: 1px solid transparent;

  background: linear-gradient(
    to right,
    rgba(209, 202, 202, 0.116),
    rgba(255, 255, 255, 0.05)
  ) border-box;

  mask:
    linear-gradient(black, black) border-box,
    linear-gradient(black, black) padding-box;
  mask-composite: subtract;
  -webkit-mask-composite: destination-out;
}

/* ================================
   Table tiles (zebra + glow)
================================ */

.table-tile {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  background-color: rgba(27,29,60,0.1);
  background-clip: padding-box;
  -webkit-backdrop-filter: blur(2px) !important;
  backdrop-filter: blur(3px) !important;

  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.2),
    0 6px 16px rgba(0,0,0,0.4);

  border-collapse: separate;
  border-spacing: 0;
}

/* Zebra striping */
.table-tile tbody tr:nth-child(odd) td {
  background-color: rgba(27,29,60, 0.2) !important;
}

.table-tile tbody tr:nth-child(even) td {
  background-color: rgba(27,29,60, 0.10) !important;
}

/* Cells as containers */
.table-tile td {
  position: relative;
  overflow: hidden;
  background-color: transparent !important;
}

/* Base pseudo for glow */
.table-tile td::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
}

/* Reset text-shadow & borders */
.table-tile th,
.table-tile td {
  text-shadow: none !important;
  border: none !important;
  color: #fff;
}

/* Glow band classes */
.table-tile .cell-low {
  color: #E52321 !important;
  text-shadow: 0 0 20px rgba(229, 35, 33, 0.85) !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2) !important;
  filter: saturate(1);
}

.table-tile .cell-lowmedium {
  color: #FFA500 !important;
  text-shadow: 0 0 20px rgba(255, 165, 0, 0.80) !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2) !important;
  filter: saturate(1.2);
}

.table-tile .cell-medium {
  color: #FDC501 !important;
  text-shadow: 0 0 20px rgba(253, 197, 1, 0.95) !important;
  filter: saturate(1.5);
  border-bottom: 2px solid rgba(255, 255, 255, 0.2) !important;
}

.table-tile .cell-mediumhigh {
  color: #7BBE74 !important;
  text-shadow: 0 0 12px rgba(123, 190, 116, 0.70) !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2) !important;
  filter: saturate(1);
}

.table-tile .cell-high {
  color: #06a26b !important;
  text-shadow:
    0 0 20px rgba(6, 162, 107, 0.85),
    0 0 28px rgba(6, 162, 107, 0.55) !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2) !important;
  filter: saturate(1.6);
}

/* ================================
   Modals
================================ */

.custom-modal .modal-content {
  background-color: #1e1e2f;
  color: white;
}

/* ================================
   Gauges – desktop vs mobile
================================ */

.responsive-gauge-desktop {
  display: block;
}

.responsive-gauge-mobile {
  display: none;
}

@media screen and (max-width: 1300px) {
  .responsive-gauge-desktop {
    display: none !important;
  }
  .responsive-gauge-mobile {
    display: flex !important;
  }
}

.gauge-circle-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 4px;
  container-type: inline-size;
}

.gauge-circle {
  width: 70%;
  max-width: 80px;
  max-height: 80px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 3px solid #ffc857;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(13px, 12cqw, 20px);
  font-weight: 200;
  color: #ffffff;
}

.gauge-circle-units {
  font-size: 11px;
  opacity: 0.8;
  margin-left: 2px;
}

/* ================================
   Pills + flow connectors
================================ */

/* Frosted pill base */
.pill {
  transition: transform 120ms ease, box-shadow 180ms ease, background-color 160ms ease;
  background: var(--profile-bg);
  color: var(--font-main);
  border: 1px solid var(--profile-border);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 4px rgba(0,0,0,.15) inset, 0 1px 3px rgba(0,0,0,.25);
  position: relative;
  overflow: visible;
  will-change: transform, box-shadow;
}
.pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0,0,0,.25);
}
@media (prefers-reduced-motion: reduce) {
  .pill { transition: box-shadow 180ms ease; }
  .pill:hover { transform: none; }
}

.pill-label {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-group {
  font-weight: 200;
}

.pill-profile.active {
  background-color: rgba(255,255,255,0.16);
  font-weight: 600;
  border-color: var(--accent);
}

/* Group-block grid + spine */
.group-block {
  position: relative;
}

.group-block::before {
  content: "";
  position: absolute;
  top: var(--spine-top, 0px);
  height: var(--spine-height, 0px);
  left: calc(
    var(--group-width, 220px)
    + var(--col-gap, 10px)
    + (var(--gap, 16px) / 2)
    - (var(--spine, 2px) / 2)
  );
  width: var(--spine, 2px);
  background: var(--accent, rgba(255,255,255,.7));
  opacity: .65;
  border-radius: 2px;
  pointer-events: none;
}

/* Group column */
.group-col {
  position: relative;
  display: flex;
  align-items: center;
}

/* Group → spine stub */
.group-col::after {
  content: "";
  position: absolute;
  top: 50%;
  right: calc(-1 * ( var(--col-gap, 10px) + (var(--gap, 16px) / 2) + (var(--spine, 2px) / 2) ));
  width:  calc(      var(--col-gap, 10px) + (var(--gap, 16px) / 2) + (var(--spine, 2px) / 2) );
  height: 2px;
  background: var(--accent, rgba(255,255,255,0.9));
  transform: translateY(-50%);
  border-radius: 2px;
  pointer-events: none;
}

/* Profiles column container */
.profiles-wrap {
  position: relative;
  padding-left: 0;
}

/* Default pill connectors */
.pill.pill-profile::before {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(-1.1 * (var(--col-gap, 10px)));
  width: calc(var(--col-gap, 10px) * 1.07);
  height: 2px;
  background: var(--accent, rgba(255,255,255,0.9));
  transform: translateY(-50%);
  border-radius: 2px;
  pointer-events: none;
}

/* First pill in row: long connector */
.pill.pill-profile.row-first::before {
  left: calc(-1 * (var(--col-gap, 10px) + (var(--gap, 16px) / 2) + (var(--spine, 2px) / 2)));
  width: calc(var(--col-gap, 10px) + (var(--gap, 16px) / 2) + (var(--spine, 2px) / 2));
}

/* Seamless joins */
:root {
  --join-overlap: 1px;
}

.group-block::before { z-index: 0; }
.group-col::after,
.pill.pill-profile::before,
.pill.pill-profile.row-first::before { z-index: 1; }

.pill.pill-profile.row-first::before {
  left: calc(-1 * (
    var(--col-gap, 10px) + (var(--gap, 16px) / 2) + (var(--spine, 2px) / 2)
    + var(--join-overlap, 1px)
  ));
  width: calc(
    var(--col-gap, 10px) + (var(--gap, 16px) / 2) + (var(--spine, 2px) / 2)
    + var(--join-overlap, 1px)
  );
}

.group-col::after {
  right: calc(-1 * (
    var(--col-gap, 10px) + (var(--gap, 16px) / 2) + (var(--spine, 2px) / 2)
    + var(--join-overlap, 1px)
  ));
  width: calc(
    var(--col-gap, 10px) + (var(--gap, 16px) / 2) + (var(--spine, 2px) / 2)
    + var(--join-overlap, 1px)
  );
}

/* Separate connector vs node colors */
:root {
  --connector-color: rgba(255,255,255,0.55);
  --node-color:      rgba(255,255,255,0.95);
  --node-glow:       rgba(255,255,255,0.40);
  --node-size:       6px;
}

.pill.pill-profile::before,
.pill.pill-profile.row-first::before,
.group-block::before,
.group-col::after {
  background: var(--connector-color) !important;
}

/* Node at group→spine intersection */
.group-col::before {
  content: "";
  position: absolute;
  top: 50%;
  right: calc(-1 * (
    var(--col-gap, 10px) + (var(--gap, 16px) / 2) + (var(--spine, 2px) / 2)
    + (var(--node-size) / 2)
  ));
  width: var(--node-size);
  height: var(--node-size);
  background: var(--node-color);
  border-radius: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 6px var(--node-glow);
  display: none;
}

/* Node for single-row groups at pill→spine intersection */
.pill.pill-profile.row-first {
  position: relative;
}
.pill.pill-profile.row-first::after {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(-1 * (
    var(--col-gap, 10px) + (var(--gap, 16px) / 2) + (var(--spine, 2px) / 2)
    + (var(--node-size) / 2)
  ));
  width: var(--node-size);
  height: var(--node-size);
  background: var(--node-color);
  border-radius: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 6px var(--node-glow);
  display: block;
}

/* Visibility logic */
.group-block.multi-rows .group-col::before { display: block !important; }
.group-block.multi-rows .pill.pill-profile.row-first::after { display: none !important; }

.group-block.single-row .group-col::before { display: none !important; }
.group-block.single-row .pill.pill-profile.row-first::after { display: block !important; }

/* Hover effect for profile pills */
.pill.pill-profile {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.pill.pill-profile:hover {
  background-color: var(--accent, #3B82F6);
  border-color: var(--accent-end, #2563EB);
  color: var(--font-contrast, #fff);
  z-index: 3;
}


/* Hover effect for group pills */
.pill.pill-group {
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.pill.pill-group:hover {
  background: linear-gradient(
    to right,
    var(--accent, #3B82F6),
    var(--accent-end, #2563EB)
  );
  color: var(--font-contrast, #fff);
  border: none;
  z-index: 3;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.25);
}

/* Metric accent pill state */
.pill-profile.has-accent {
  position: relative;
  border: 2px solid var(--pill-accent);
  background-color: transparent;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Use border color as hover fill */
.pill-profile.has-accent:hover {
  background-color: var(--pill-accent);
  border-color: var(--pill-accent);
  color: #ffffff;
}

/* Focus outline */
.pill-profile.has-accent:focus,
.pill-profile.has-accent:focus-visible {
  outline: 2px solid var(--pill-accent);
  outline-offset: 2px;
}

/* Pulse glow */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 4px 1px var(--pill-accent);
  }
  50% {
    box-shadow: 0 0 6px 1.5px var(--pill-accent);
  }
}

.pill-profile.has-accent:hover {
  animation: pulse-glow 1.6s ease-in-out infinite;
  border-color: var(--pill-accent);
  background-color: transparent;
}

.pill-profile.has-accent:focus,
.pill-profile.has-accent:focus-visible {
  box-shadow: 0 0 6px 2px var(--pill-accent);
  outline: 2px solid var(--pill-accent);
  outline-offset: 2px;
}

.pill-profile.has-accent:active {
  filter: brightness(0.95);
}

/* ================================
   React Flow: controls + pill nodes
================================ */

/* Hide minimap, zoom controls, attribution */
.react-flow__minimap {
  display: none !important;
}

.react-flow__controls {
  display: none !important;
}

.react-flow__attribution {
  display: none !important;
}

/* Change node connection dots (handles) */
.react-flow__handle {
  background-color: #FFFFFF !important;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  border: none;
}

/* Pill-shaped nodes */
.react-flow__node.pill-node {
  border-width: 2px !important;
  border-style: solid !important;
  border-radius: 999px !important;
  background-color: var(--node-fill, rgba(27, 29, 60, 0.90));
  color: #fff !important;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.18),
    0 6px 16px rgba(0,0,0,0.40) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  backdrop-filter: blur(4px) !important;
  transition: box-shadow 0.22s ease, filter 0.22s ease;
  will-change: box-shadow, filter;
}

/* Hover glow */
.react-flow__node.pill-node:hover {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.25),
    0 14px 28px rgba(0,0,0,0.55),
    0 0 14px var(--accent, #FFD93D),
    0 0 28px rgba(255, 217, 61, 0.25) !important;
  filter: brightness(1.06) saturate(1.06);
  z-index: 3;
}

/* Band fills */
.react-flow__node.pill-node.band-red    { background-color: rgba(211, 47, 47, 0.7) !important; }
.react-flow__node.pill-node.band-orange { background-color: rgba(245,124,  0, 0.8) !important; }
.react-flow__node.pill-node.band-amber  { background-color: rgba(251,192, 45, 0.7) !important; }
.react-flow__node.pill-node.band-lime   { background-color: rgba(139,195, 74, 0.7) !important; }
.react-flow__node.pill-node.band-green  { background-color: rgba( 46,125, 50, 1) !important; }


