/* --- VARIABLES --- */
:root {
  --glass-bg: rgba(0, 0, 0, 0.6);
  --glass-border: 1px solid rgba(255, 255, 255, 0.2);
  --text-color: white;
  --highlight: #ffd700; /* Gold */
  --gold: #ffd700;
  --font-stack: "Segoe UI", Roboto, sans-serif;
}

/* --- BASE --- */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  padding: 0;
  width: 100dvw;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-stack);
  color: var(--text-color);
  background: #222;
  background-image: url("images/bg-shinny.jpg");
  background-size: cover;
  /* THE CUTTER: This chops off the huge map edges */
  overflow: hidden;
  position: fixed; /* Prevents scrollbars from appearing */
}

/* --- MAP --- */
#map-mask {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Matches your Dashboard size logic */
  width: 100%;
  height: 100%;

  /* If you set max-width/height on dashboard, set it here too if you want the map contained */
  max-width: 1280px;
  max-height: 720px;

  /* THE CRITICAL LINE: Hides anything sticking out */
  overflow: hidden;

  z-index: 0;
}

/* --- THE MAP (The Content) --- */
#map-container {
  position: absolute;

  /* Make it HUGE (200% of viewport) so we never see edges when rotating */
  width: 200%;
  height: 200%;

  /* Center it: Pull it back up/left by half its size */
  top: -50%;
  left: -50%;
  margin-left: 50px;
  z-index: 0;
  transition:
    filter 0.5s ease,
    transform 1s linear;

  /* Ensure rotation happens from center */
  transform-origin: center center;
}

/* Day Mode Override */
body.day-mode #map-container {
  filter: brightness(1) contrast(1);
}
#car-marker-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
}
.car-icon {
  font-size: 3rem;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.5));
}

/* --- LAYOUT WRAPPER --- */
.dashboard-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  max-width: 1280px;
  max-height: 720px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 10px;
  pointer-events: none; /* Let clicks pass */
  transform: translate(-50%, -50%);
}

.glass-panel {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: var(--glass-border);
  border-radius: 15px;
  pointer-events: auto;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* --- MAIN AREA (Top Section) --- */
.main-area {
  flex: 1; /* Takes all available height above footer */
  display: flex;
  justify-content: space-between;
  gap: 15px;
  min-height: 0; /* Important for flex scaling */
}

/* LEFT COLUMN (Info) - 60% Width */
.left-column {
  width: 150px; /* 60% ratio */
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 1. GPS Bar */
.top-bar {
  height: 80px; /* Fixed Height */
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  font-size: 1.5rem;
  width: 800px;
}
.address-box,
.system-box {
  display: flex;
  align-items: center;
  gap: 15px;
}

#digital-clock {
  font-variant-numeric: tabular-nums; /* Keeps numbers same width */
  font-family: "Segoe UI", Roboto, monospace; /* Monospace backup */
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--highlight); /* Cyan looks cool for clocks */

  /* Fixed Width Strategy */
  display: inline-block;
  text-align: right; /* Align right so single digits don't look weird */
}
#menu-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  height: 55px;
  width: 55px;
  padding-bottom: 8px;
  z-index: 9000;
}

/* 2. Telemetry (Fills remaining height) */
#telemetry-widget {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 15px;
  background-color: rgba(0, 0, 0, 0.9);
}
.tele-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0px;
  flex-direction: column;
}

/* Telemetry Typography */
/* --- SPEED GAUGE --- */
.speed-gauge-container {
  position: relative;
  width: 120px; /* Size of the gauge */
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;

  /* Ghost Ticks Background */
  background: repeating-conic-gradient(
    from 225deg,
    rgba(255, 255, 255, 0.1) 0deg 2deg,
    transparent 2deg 5deg
  );

  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Background Ring (Dark Grey Ticks) */
.speed-ring-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;

  /* CREATE TICKS */
  background: repeating-conic-gradient(
    from 225deg,
    rgba(255, 255, 255, 0.1) 0deg 2deg,
    /* Tick Width */ transparent 2deg 5deg /* Gap Width */
  );

  /* MASK: Hollow Center + Hide the bottom cutout (270deg range) */
  mask-image:
    radial-gradient(transparent 65%, black 66%),
    conic-gradient(from 225deg, black 0deg 270deg, transparent 270deg);
  -webkit-mask-image:
    radial-gradient(transparent 65%, black 66%),
    conic-gradient(from 225deg, black 0deg 270deg, transparent 270deg);

  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

/* Active Ring (The Colored Ticks) */
.speed-ring-active {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;

  /* Default Fill (JS changes this) */
  background: conic-gradient(
    from 225deg,
    var(--highlight) 0deg,
    transparent 0deg
  );

  /* MASK: Hollow Center + Slice into Ticks */
  mask-image:
    radial-gradient(transparent 65%, black 66%),
    repeating-conic-gradient(
      from 225deg,
      black 0deg 2deg,
      transparent 2deg 5deg
    );
  -webkit-mask-image:
    radial-gradient(transparent 65%, black 66%),
    repeating-conic-gradient(
      from 225deg,
      black 0deg 2deg,
      transparent 2deg 5deg
    );

  -webkit-mask-composite: source-in;
  mask-composite: intersect;

  transition: background 0.5s linear;
  filter: drop-shadow(0 0 5px var(--highlight));
}

/* Text Positioning */
.speed-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}

#speed-val {
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
  color: var(--highlight);
}
.unit {
  font-size: 0.7rem;
  color: #aaa;
  text-transform: uppercase;
}
.label {
  font-size: 0.8rem;
  color: #aaa;
  letter-spacing: 2px;
}

/* --- COMPASS BALL (Lighter & Detailed) --- */
.compass-ball-container {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 50%;

  /* Background */
  background: rgba(30, 30, 30, 0.6);
  backdrop-filter: blur(5px);

  /* REMOVED BORDER: border: 2px solid var(--highlight); */

  /* Stronger Shadow to define the edge without a line */
  box-shadow:
    0 5px 15px rgba(0, 0, 0, 0.6),
    inset 0 0 20px rgba(0, 0, 0, 0.8); /* Inner depth */

  overflow: hidden;
  margin: 5px auto;
}

/* Lens/Shine (Enhanced for borderless look) */
.ball-lens {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  z-index: 5;
  pointer-events: none;

  /* Top-Left Highlight to simulate glass surface */
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.2),
    transparent 60%
  );

  /* Rim lighting via shadow */
  box-shadow: inset 2px 2px 5px rgba(255, 255, 255, 0.2);
}

.compass-marker {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--highlight);
  font-size: 1rem;
  z-index: 6;
  text-shadow: 0 0 5px var(--highlight);
}

.compass-tape {
  display: flex;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 0;
  will-change: transform;
  transition: transform 1s linear;
}

/* --- TICKS --- */
.tick {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  flex-shrink: 0;
  height: 40px;
  position: relative;
}

/* Major Ticks (Text N, NE, E) */
.tick.major {
  font-weight: 900;
  font-size: 1.5rem; /* Bigger Text */
  color: white;
  text-shadow: 0 2px 4px black;
}

/* Minor Ticks (The Lines) */
.tick.minor::after {
  content: "";
  display: block;

  /* Make them visible! */
  width: 3px; /* Thicker */
  height: 12px; /* Taller */

  background: rgba(255, 255, 255, 0.9); /* Bright White */
  border-radius: 2px;
  box-shadow: 0 0 5px black; /* Shadow to pop against map */
}

.tick.number {
  font-weight: 700;
  font-size: 0.9rem; /* Smaller than Major */
  color: var(--highlight); /* Cyan/Gold to differentiate from White Cardinals */
  text-shadow: 0 0 5px black;
  opacity: 0.8;
}

/* --- VSI DIAL (Aircraft Style) --- */
.vsi-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- VSI DIAL (Offset Pivot) --- */
.vsi-dial {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;

  /* Full Circle Border */
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.label-vsi {
  font-size: 0.9rem;
  color: #aaa;
  letter-spacing: 2px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 20%);
  font-weight: bold;
}

/* The Ticks (Short & Right Side) */
.vsi-dial::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;

  /* The Lines */
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 255, 255, 0.4) 0deg 1deg,
    transparent 1deg 15deg
  );

  /* DOUBLE MASK: 
       1. Hide Left Half (linear-gradient)
       2. Hide Center (radial-gradient) -> Makes ticks short 
    */
  -webkit-mask-image:
    linear-gradient(to right, transparent 50%, black 50%),
    radial-gradient(transparent 65%, black 66%);
  mask-image:
    linear-gradient(to right, transparent 50%, black 50%),
    radial-gradient(transparent 65%, black 66%);

  /* Combine masks (Composite) */
  -webkit-mask-composite: source-in;
  mask-composite: intersect;

  z-index: 0;
}

/* Horizon Line */
.vsi-dial::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: auto; /* Start line where needle starts */
  height: 2px;
  width: 10px;
  background: rgba(255, 255, 255, 0.9);
  z-index: 1;
}

/* The Needle (Offset Pivot) */
.vsi-needle {
  position: absolute;

  /* PIVOT POSITION (Keep this matching your Cap) */
  top: 50%;
  left: 20%;

  /* SIZE */
  width: 60%; /* Reach towards the ticks */
  height: 4px; /* Thicker for better visibility */

  /* STYLE: White & Rounded */
  background: white;
  border-radius: 10px; /* Makes it a "Capsule" shape */

  /* Remove the old triangle shape */
  clip-path: none;

  /* ANIMATION LOGIC */
  transform-origin: 0% 50%; /* Pivot around the left tip */
  transform: translateY(-50%) rotate(0deg);
  transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1); /* Smoother damping */

  z-index: 10;

  /* Shadow for depth */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Cap (Pivot Point) */
.vsi-cap {
  position: absolute;
  top: 50%;
  left: 20%;
  width: 10px;
  height: 10px; /* Slightly larger */

  background: var(
    --highlight
  ); /* Gold/Cyan center looks cool inside white needle */
  /* OR make it black to look like a hole/screw */
  /* background: #222; border: 2px solid white; */

  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  box-shadow: 0 0 2px black;
}

.vsi-label {
  position: absolute;
  right: 12px; /* Align near the ticks */
  font-size: 0.5rem;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.5);
  z-index: 1;
}

.vsi-label.up {
  top: 5%;
  right: 40%;
} /* Near 1-2 o'clock */
.vsi-label.dn {
  bottom: 5%;
  right: 40%;
} /* Near 4-5 o'clock */

/* Stack the text next to it */
.alt-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
}
#alt-m-live {
  font-size: 1.5rem;
  font-weight: bold;
}

/* 3. Toggle */
.toggle-container {
  margin-top: auto;
  z-index: 50;
  pointer-events: auto;
  display: flex;
  flex-direction: row;
  gap: 10px;
} /* Pushes to bottom of col if needed */
#theme-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  min-width: 150px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  border-radius: 10px;
  z-index: 51;
}

.radio-cat-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  min-width: 120px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  border-radius: 10px;
  z-index: 51;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* RIGHT COLUMN (Player) - 40% Width */
.right-column {
  width: 450px; /* 40% ratio */
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 4. Album Art */
#album-art-container {
  width: 100%;
  aspect-ratio: 1 / 1; /* Forces Square */
  /* If screen is short, image will shrink to fit, maintaining square */
  min-height: 0;

  background: black;
  border-radius: 15px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}
#player-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 5. Controls */
#player-controls-bar {
  flex: 1; /* Fills remaining space in column */
  min-height: 80px; /* Minimum useful height */

  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 0 20px;
  overflow: hidden;
}
.car-track-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.car-station {
  color: var(--gold);
  font-size: 0.9rem;
  text-transform: uppercase;
  font-weight: bold;
}
.car-title {
  font-size: 1.4rem;
  font-weight: bold;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.car-artist {
  font-size: 1rem;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#stop-button {
  height: 100%;
  width: auto;
  aspect-ratio: 1/1;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  padding: 15px;
}

/* --- BOTTOM AREA (Footer) --- */
.bottom-area {
  height: 140px; /* Fixed Footer Height */
  flex-shrink: 0;
}

#channel-scroller {
  height: 100%;
  display: flex;
  overflow-x: auto;
  gap: 15px;
  padding: 10px 15px;
  align-items: center;
  scrollbar-width: none;
  pointer-events: auto;
  cursor: grab;
}

#channel-scroller.active {
  cursor: grabbing; /* Shows a closed hand while dragging */
}
.car-channel-item {
  height: 95%;
  aspect-ratio: 2 / 1;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  transition: transform 0.2s;
  border: 2px solid transparent;
}
.car-channel-item:active {
  transform: scale(0.95);
  background: rgba(0, 255, 204, 0.2);
  border: 2px solid var(--highlight);
}
.car-channel-item img {
  width: 90%;
  height: 90%;
  object-fit: cover;
  pointer-events: none;
}

/* --- ABOUT MODAL --- */
/* --- ABOUT MODAL (System Specs) --- */
.full-screen-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9); /* Dark backdrop */
  z-index: 6000; /* Highest level (above Menu) */
  display: none; /* Hidden by default */
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 25px;
  border: 2px solid var(--highlight); /* Cyan/Gold Border */
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  text-align: left;
}

/* Typography */
.about-header {
  text-align: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 15px;
}
.about-header h2 {
  margin: 0;
  color: var(--highlight);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 1.5rem;
}
.about-header p {
  color: #aaa;
  font-size: 0.8rem;
  font-family: monospace;
  margin-top: 5px;
}

/* Tech Sections */
.tech-section {
  margin-bottom: 20px;
}

.tech-section h4 {
  color: white;
  border-left: 4px solid var(--highlight);
  padding-left: 10px;
  margin-bottom: 8px;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 1px;
}
.tech-section p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #ccc;
  margin-bottom: 8px;
}

/* Tech Badges (The "Pills") */
.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--highlight);
  font-family: monospace;
  text-transform: uppercase;
}

/* Close Button */
#about-close-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--highlight);
  color: var(--highlight);
  font-size: 1rem;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
#about-close-btn:hover {
  background: var(--highlight);
  color: black;
}
/* --- SIDE MENU CONTENT --- */

/* --- SIDE MENU --- */
/* SIDE MENU DRAWER */
#sideMenu {
  position: fixed;
  top: 0;
  left: -100%; /* Hidden Left */
  width: 25%;
  height: 100%;

  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  z-index: 5000;
  transition: left 0.3s ease;

  /* FLEXBOX CENTERING */
  display: flex;
  flex-direction: column;

  /* Center Horizontally */
  align-items: center;

  /* Center Vertically (or use flex-start with padding) */
  justify-content: center;

  /* Padding to ensure it never touches the very top edge */
  padding: 20px;
}

#sideMenu.open {
  left: 0 !important;
} /* Class to open it */

#sideMenu ul {
  list-style: none;
  padding: 0;
  width: 300px;
  text-align: center;
  margin-top: -50px;
}
#sideMenu li {
  margin-bottom: 30px;
}

/* Toggle Switch Style */
.menu-toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  font-weight: bold;
  font-size: 1.2rem;
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: 0.4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--highlight);
}
input:checked + .slider:before {
  transform: translateX(22px);
  background-color: black;
}

/* About Link Button */
#aboutLink {
  display: block;
  width: 100%;
  padding: 15px;
  color: var(--highlight);
  text-decoration: none;
  border: 1px solid var(--highlight);
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
  transition: all 0.2s;
}
#aboutLink:active {
  background: var(--highlight);
  color: black;
}
