/* Base Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #121212;
  --text: #e0e0e0;
  --accent: #64b5f6;
  --btn-bg: #1e1e1e;
  --btn-hover: #333;
  --font: 'Manrope', sans-serif;
}

a {
  color: #e0e0e0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  padding: 1rem;
  text-align: center;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

.topnav {
  background-color: #000;
  display: flex;
  justify-content: center;
  padding: 0.75rem;
}

.topnav a {
  color: white;
  margin: 0 1rem;
  text-decoration: none;
  font-weight: bold;
}

.topnav a:hover {
  text-decoration: underline;
}

main {
  max-width: 75vw;
  margin: auto;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: center;
}

input, select, button {
  padding: 0.5rem;
  font-size: 1rem;
  border-radius: 5px;
  border: none;
}

button {
  background-color: var(--btn-bg);
  color: white;
  cursor: pointer;
}

button:hover {
  background-color: var(--btn-hover);
}

.button-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 auto;
}

.favorites-section {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px dashed #444;
  border-radius: 5px;
  text-align: center;
}

.response {
  margin: 2rem 0 1rem;
}

.legend span {
  display: inline-block;
  margin-right: 1rem;
  padding: 0.3rem 0.6rem;
  border-radius: 3px;
}

.legend {
  text-align: center;
}

.VFR { background: green; }
.MVFR { background: blue; }
.IFR { background: red; }
.LIFR { background: magenta; }
.UNKN { background: gray; }

.tabs {
  margin-top: 2rem;
}

.tab {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab button {
  flex: 1;
  padding: 0.75rem;
  font-weight: bold;
}

.tabcontent {
  display: none;
  background: #1a1a1a;
  border-radius: 5px;
  padding: 1rem;
  overflow-x: auto;
}

.tabcontent.active {
  display: block;
}

.favorites-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  justify-content: center;
}

.favorite-item {
  background-color: #2a2a2a;
  border-radius: 5px;
  display: flex;
  align-items: center;
  padding: 0.3rem 0.6rem;
}

.favorite-button {
  background: none;
  border: none;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.remove-btn {
  margin-left: 0.5rem;
  color: red;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.metar-table {
  width: 100%;
  border-collapse: collapse;
}

.metar-table th, .metar-table td {
  padding: 0.5rem;
  border: 1px solid #333;
  text-align: center;
}

.scalable {
  width: 50vw;
}

.metar-table tr.VFR { background-color: rgba(0, 128, 0, 0.3); }
.metar-table tr.MVFR { background-color: rgba(0, 0, 255, 0.3); }
.metar-table tr.IFR { background-color: rgba(255, 0, 0, 0.3); }
.metar-table tr.LIFR { background-color: rgba(255, 0, 255, 0.3); }

/* Shell holds title + left labels + scroller */
.graph-shell {
  position: relative;
  width: 100%;
  margin: 2rem auto;
  /* Optional max width for the whole block so title stays centered nicely */
  max-width: 1400px; 
}

/* Centered ICAO title (not scrolling) */
.graph-title {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  pointer-events: none;
  color: #fff;
}

/* Left labels column (not scrolling) */
.graph-left {
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;  /* must match LEFT_COL in JS */
  height: 100%;
  pointer-events: none; /* purely decorative */
}

.panel-label {
  position: absolute; /* we set top/height inline in JS to match panels */
  left: 0;
  right: 0;
  padding: 0.25rem 0.5rem;
  color: #fff;
  font-size: 1.2rem;
  /* display: flex;
  align-items: center; */
}

/* Scrolling plot area (only this scrolls) */
.graph-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* The scrolling SVG keeps a constant vertical size.
   It shrinks horizontally with the viewport down to ~600px,
   and below that we force it back to full logical width so
   you can scroll to see it all. */
.graph-svg {
  height: 600px;                      /* constant vertical size */
  display: block;
  width: clamp(600px, 60vw, 1200px);  /* shrink to ~600px, grow to 1200px */
}

@media (max-width: 600px) {
  main {
    max-width: 100vw;
  }

  .graph-svg {
  width: 1200px; /* full logical width -> horizontal scrollbar appears */
  }

  .form-section {
    padding: 1rem;
  }

  .button-row {
    flex-direction: column;
  }

  .tab {
    flex-direction: column;
  }

  .scalable {
    width: 90vw;
  }
}
