/* === Global === */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: #f4f4f4;
  padding-top: 60px; /* Dopasowane do wysokości nav */
}

h2.title {
  font-size: 2rem;
  margin: 1rem;
  color: #000;
  text-shadow: 1px 1px 2px #999;
}

/* === Controls === */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 0.7rem 1rem;
  background: #fff;
  justify-content: flex-start;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  align-items: center;
  border-bottom: 1px solid #ddd;
  top: 0;
  z-index: 999;
}

.controls label {
  font-size: 0.85rem;
  margin-right: -8px;
  color: #444;
}

.controls input[type="text"],
.controls input[type="number"],
.controls input[type="date"],
.controls select {
  padding: 6px 10px;
  font-size: 0.85rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
  max-width: 100%;
}

.controls input:focus,
.controls select:focus {
  border-color: #888;
}

.controls button {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #f8f8f8;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.controls button:hover {
  background: #eee;
  border-color: #999;
}

/* === Controls: Custom Widths === */
.controls input[type="text"]#txSign { width: 80px; }
.controls input[type="text"]#flightId { width: 50px; }
.controls select#band { width: 90px; }
.controls input[type="date"] { width: 135px; }
.controls input[type="number"]#simHours,
.controls input[type="number"]#timeStep { width: 55px; }

/* === Map === */
#map {
  height: 60vh;
  margin: 0;
  border-top: 2px solid #ccc;
  border-bottom: 2px solid #ccc;
  z-index: 1;
}

/* === Table === */
table {
  width: 100%;
  max-width: 95%;
  margin: 0.5rem 1rem 0rem 1rem;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  font-size: 0.85rem;
}

table th,
table td {
  padding: 4px 6px;
  border: 1px solid #eee;
  text-align: left;
  white-space: normal;
  word-break: break-word;
}

table th {
  background-color: #dee2e6;
  font-weight: 700;
  color: #111;
  border-bottom: 2px solid #bbb;
  text-align: left;
  font-size: 0.85rem;
  padding: 6px;
}

table tbody tr:hover {
  background-color: #f3f3f3;
}

/* === Stats === */
#stats {
  margin: 0.5rem 1rem 0rem 1rem;
  font-weight: bold;
}

#stats .stat-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  background: #fff;
  padding: 0.7rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  font-size: 0.85rem;
  color: #333;
  line-height: 1.3;
}

#stats .stat-box div {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

#stats .stat-box span {
  color: #555;
  font-weight: 500;
}

#stats .stat-box b {
  font-weight: 600;
  color: #111;
}

/* === Loading === */
#loading {
  font-weight: bold;
  color: #444;
  padding: 10px;
}

/* === Responsive === */
@media (max-width: 768px) {
  .controls {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .controls label,
  .controls input,
  .controls select,
  .controls button {
    width: 100%;
  }
}

@media (max-width: 600px) {
  #stats .stat-box {
    font-size: 0.85rem !important;
    line-height: 1.2;
    padding: 6px 10px;
    gap: 0.3rem 0.8rem;
    flex-direction: column;
  }

  #stats .stat-box span,
  #stats .stat-box b {
    font-size: inherit !important;
  }
  
  #resultTable th:nth-child(2),
  #resultTable td:nth-child(2),
  #resultTable th:nth-child(3),
  #resultTable td:nth-child(3) {
    display: none;
  }
}


@media (min-width: 768px) {
  table {
    max-width: 700px;
    margin-left: 1rem;
    margin-right: auto;
  }
}
#table-chart-wrapper {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1 0rem;
  margin-top: 0.5rem;
  flex-wrap: wrap; /* żeby na małym ekranie było jedno pod drugim */
}

#resultTableContainer {
  flex: 0 0 700px;
  max-width: 700px;
}

#flightChart {
  width: 100%;
  height: 320px; /* lub ile chcesz, np. 500px */
  max-height: 100%;
}
@media (max-width: 768px) {
  #table-chart-wrapper {
    flex-direction: column-reverse; /* 👈 TO jest klucz */
  }

#chartContainer {
  display: flex;
  flex-direction: column; /* ⬅ ZAMIENIAMY z row na column */
  gap: 1rem;
}

  #flightChart {
    width: 100%;
    height: 300px;
  }
}
#chartContainer {
  position: relative;
}

#resetChartBtn {
  position: absolute;
  top: 0px;
  left: 80px;
  z-index: 10;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  opacity: 0.8;
}
#resetChartBtn:hover {
  background: #f0f0f0;
}

@media (max-width: 1340px) {
  #chartContainer {
    display: none !important;
  }
}

#fullscreenChartBtn {
  position: absolute;
  top: 0px;
  left: 170px;
  z-index: 10;
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-family: Arial, sans-serif;
  color: #333;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  opacity: 0.95;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

#fullscreenChartBtn:hover {
  background: #f7f7f7;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

#table-chart-wrapper {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

#resultTableContainer {
  flex: 0 0 700px;
  max-width: 700px;
}

#chartContainer {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;  /* 👈 Odstęp od góry */
  margin-left: 1rem; /* 👈 Dystans między tabelą a wykresami */
  margin-right: 1rem;     /* jak #stats */
}

.chart-box {
  width: 100%;         /* 👈 to zostaje */
  position: relative;
  background: white;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  height: 320px;
}

.chart-box canvas {
  width: 100%;
  height: 100%;
}



.chart-box button {
  position: absolute;
  top: 8px;
  left: 8px; /* <-- przesuwamy na lewą stronę */
  z-index: 10;
  font-size: 0.75rem;
  padding: 4px 8px;
  background: white;
  border: 1px solid #bbb;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.8;
}
.chart-box button:hover {
  background: #eee;
}
.chart-box button.fullscreenChartBtn {
	left: 90px; /* ⬅ przesuwamy dalej w prawo względem resetu */

}
.chart-box:fullscreen {
  background-color: #f4f4f4;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.chart-box:fullscreen canvas {
  max-height: 40vh;
  width: 100%;
  height: auto !important;
  background-color: transparent;
}