/* =========================================================
   THEME VARIABLES
   ========================================================= */

:root {
  --darkblue: #081f37;
  --mediumblue: #1a2f3f;
  --darkerblue: #06192C;
  --blue: #1e549f;
  --lightblue: #5fc9f3;
  --white: #ffffff;
  --black: #000000;
  --onTime: #2ecc71;
  --lateSmall: #f1c40f;
  --lateBig: #e74c3c;
}


/* =========================================================
   GLOBAL BASE
   ========================================================= */

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 0 1rem;
  background: var(--darkblue);
  color: var(--white);
}

main {
  max-width: 800px;
  margin: auto;
  padding: 2rem 0;
}



/* =========================================================
   HEADER ROW
   ========================================================= */

.headerRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 0 .2rem;
}

/* Left pill */

#nextTrain {
  /* top right bottom left */
  padding: .6rem .6rem .6rem .6rem; 
  border-radius: 999px;
  background: var(--mediumblue);
  font-size: 1rem;
  font-weight: 600;
}

#nextTrain::before {
  content: "";
}

/* Clock on right */

#liveClock {
  font-size: 1.6rem;
  font-weight: 600;
}

.colon {
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}


/* =========================================================
   STATION SELECTORS
   ========================================================= */

.stationSelect {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: .5rem;
  margin-bottom: 1.5rem;
}

.stationSelect select {
  width: 100%;
  min-width: 0;
  padding: .8rem;
  border-radius: 10px;
  border: none;
  background: var(--mediumblue);
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
}

.swapBtn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: none;
  background: var(--lightblue);
  color: var(--darkblue);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}


/* =========================================================
   REFRESH BUTTON
   ========================================================= */

.refresh {
  width: 100%;
  margin-bottom: 1.5rem;
  padding: .8rem;
  border: none;
  border-radius: 8px;
  background: var(--lightblue);
  color: var(--darkblue);
  cursor: pointer;
}


/* =========================================================
   TRAIN LIST
   ========================================================= */

#trainList {
  display: grid;
  gap: 1rem;
}


/* =========================================================
   TRAIN CARD (MOBILE FIRST)
   ========================================================= */

.trainCard {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  padding: 1.1rem 1.2rem;
  border-radius: 10px;
  background: var(--blue);
}


/* =========================================================
   DELAY STATE BACKGROUNDS
   ========================================================= */

.trainCard.lateSmall {
  background: linear-gradient(
    135deg,
    rgba(241, 196, 15, 0.4),
    var(--blue)
  );
}

.trainCard.lateBig {
  background: linear-gradient(
    135deg,
    rgba(231, 76, 60, 0.5),
    var(--blue)
  );
}


/* =========================================================
   LEFT COLUMN
   ========================================================= */

.leftCol {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
}

.leftCol h2 {
  font-size: 2.6rem;
  margin: 0;
  line-height: 1;
  position: relative;
  top: 18px;
}

.platform {
  font-size: 1.3rem;
  font-weight: 600;
}


/* =========================================================
   RIGHT COLUMN
   ========================================================= */

.rightCol {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: .35rem;
}

.rightCol p {
  margin: 0;
  font-size: 1.05rem;
}


/* =========================================================
   DELAY ROW
   ========================================================= */

.delay {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  justify-content: flex-end;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.onTime .dot    { background: var(--onTime); }
.lateSmall .dot { background: var(--lateSmall); }
.lateBig .dot   { background: var(--lateBig); }


/* =========================================================
   DESKTOP REFINEMENT
   ========================================================= */

@media (min-width: 600px) {

  .leftCol h2 {
    font-size: 2.7rem;
  }

}
  

/* =========================================================
   LOADING OVERLAY
   ========================================================= */

#loadingScreen {
  position: fixed;
  inset: 0;
  background: var(--darkblue);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.loader {
  width: 42px;
  height: 42px;
  border: 4px solid var(--white);
  border-top: 4px solid var(--white);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* =========================================================
   MODAL OVERLAY
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: none;          /* default hidden */
  justify-content: center;
  align-items: center;
  padding: 1rem;
  z-index: 2000;
}

/* Visible state */
.modal.show {
  display: flex;
}

/* Prevent background scrolling when open */
body.modalOpen {
  overflow: hidden;
}

/* =========================================================
   MODAL CONTENT
   ========================================================= */

.modalContent {
  background: var(--darkerblue);
  width: 100%;
  max-width: 600px;

  max-height: 85vh;       /* important */
  display: flex;
  flex-direction: column;

  border-radius: 12px;
  overflow: hidden;
}

/* Scrollable content area */
#alertList {
  overflow-y: auto;
  padding: 1.5rem;
}

.white-icon {
  color: #fff;
}

#alertBtn {
  display: inline-block;
  margin: 2px;
  background: transparent;
  border: 0;
}

/* Header inside modal */
.modalContent h2 {
  margin: 0;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

/* Close button pinned to bottom */
#closeModal {
  border: none;
  background: var(--lightblue);
  color: var(--darkblue);
  padding: 1rem;
  font-size: 1rem;
  cursor: pointer;
}

