body.home-embed {
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin: 0;
  overflow: hidden;
}

.home-embed-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  display: block;
}

.home-page {
  padding: 40px 30px 60px;
  max-width: 1100px;
  margin: 0 auto;
}

.home-modules {
  display: flex;
  flex-wrap: wrap;
}

.home-modules > [class*="col-"] {
  display: flex;
}

.home-module {
  flex: 1;
  width: 100%;
  min-height: 280px;
  padding: 28px 24px 24px;
  border-radius: 12px;
  border: 2px solid #22534D;
  background-color: #f5f5f5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.home-module-title {
  margin: 0 0 24px;
  font-size: 28px;
  font-weight: 700;
  color: #22534D;
  text-align: center;
}

.home-pages {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.home-module-verification .home-pages {
  grid-template-columns: 1fr;
  max-width: 360px;
  margin: 0 auto;
}

.home-page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background-color: #fff;
  color: #333;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.home-page-link:hover,
.home-page-link:focus {
  background-color: #22534D;
  border-color: #22534D;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(34, 83, 77, 0.25);
  outline: none;
}

@media (max-width: 767px) {
  .home-page {
    padding: 24px 16px 40px;
  }

  .home-modules > [class*="col-"] + [class*="col-"] {
    margin-top: 24px;
  }

  .home-module {
    min-height: 0;
  }

  .home-pages {
    grid-template-columns: 1fr;
  }

  .home-module-verification .home-pages {
    max-width: none;
  }
}

.navbar {
  margin-bottom: 0;
  border-radius: 0;
}

#site-navbar .navbar-fixed-top {
  z-index: 1030;
}

body.has-fixed-navbar {
  padding-top: 0;
}

body.has-fixed-navbar > .container-fluid {
  padding-top: var(--navbar-height, 52px);
}

.navbar-inverse {
    background-color: #000;
    border-color: #080808;
    border: 0;
}

.navbar-inverse .navbar-nav>.active>a,
.navbar-inverse .navbar-nav>.active>a:focus,
.navbar-inverse .navbar-nav>.active>a:hover {
    color: #fff;
    background-color: #22534D;
}

@media (min-width: 768px){
    .navbar-nav {
        float: left;
        margin: 0;
        margin-left: 30px;
    }
}

a.navbar-brand:link {
    color: #fff;
}

.navbar-brand-logo {
  padding: 8px 10px 8px 15px;
  line-height: 0;
}

.navbar-brand-logo img {
  display: block;
  height: 32px;
  width: auto;
  max-height: 32px;
  max-width: 140px;
  padding: 0;
}

.fit-img {
  max-height: calc(100vh - 80px);
  max-width: 100%;
  height: auto;
  width: auto;
}

.list-group.list-group-root {
    padding: 0;
    overflow: hidden;
}

.list-group.list-group-root .list-group {
    margin-bottom: 0;
}

.list-group.list-group-root .list-group-item {
    border-radius: 0;
    border-width: 1px 0 0 0;
}

.list-group.list-group-root > .list-group-item:first-child {
    border-top-width: 0;
}

.list-group.list-group-root > .list-group > .list-group-item {
    padding-left: 15px;
}

.list-group.list-group-root > .list-group > .list-group > .list-group-item {
    padding-left: 30px;
    font-size: 90%;
}

.list-group-item .glyphicon {
    margin-right: 5px;
}

.modal-autofit{
    position: relative;
    display: table; /* This is important */
    overflow-y: auto;
    overflow-x: auto;
    width: auto;
    min-width: 300px;
    max-width: 100%;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0;
}

#modalimg {
    max-height: 90vh;
    max-width: 100vw;
    object-fit: contain;
    height: auto;
    width: auto;
}

/*
* Sidebar
*/
.col-fixed-sidebar {
    padding: 20px;
    background-color: #f5f5f5;
}
.col-fixed-main.spatial-main {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--navbar-height, 52px));
  overflow: hidden;
  padding-bottom: 10px;
}

.plot-grid-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.plot-grid {
  display: grid;
  gap: 8px;
  height: 100%;
  width: 100%;
}
.plot-grid-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.plot-grid-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.plot-grid-3 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr; }
.plot-grid-2x2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.plot-grid-3x2 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }

.plot-cell {
  text-align: center;
  border: 1px solid #ddd;
  padding: 6px;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.plot-cell-title {
  font-size: 16px;
  margin-bottom: 6px;
  font-weight: bold;
  flex-shrink: 0;
  line-height: 1.3;
}
.plot-cell-img-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.plot-cell-img,
.plot-frame,
.plot-missing {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.timeline-bar {
  margin-bottom: 8px;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.timeline-controls {
  display: inline-flex;
  gap: 4px;
}
.timeline-controls .btn {
  width: 34px;
  height: 34px;
  padding: 0;
  line-height: 32px;
}
.timeline-bar #timeline-slider {
  flex: 1;
  min-width: 120px;
  margin: 0 8px;
  vertical-align: middle;
}
.timeline-bar #current-time {
  font-size: 13px;
  white-space: nowrap;
  min-width: 140px;
}

/* UTC / local time toggle switch */
.time-zone-toggle {
  position: relative;
  display: inline-block;
  width: 160px;
  height: 36px;
  margin: 0 0 0 auto;
  cursor: pointer;
  flex-shrink: 0;
}
.time-zone-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.time-zone-toggle .toggle-track {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 18px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  box-sizing: border-box;
}
.time-zone-toggle .toggle-label {
  font-size: 12px;
  font-weight: bold;
  z-index: 1;
  color: #666;
  transition: color 0.2s;
  user-select: none;
}
.time-zone-toggle .toggle-utc { color: #fff; }
.time-zone-toggle input:checked ~ .toggle-track .toggle-utc { color: #666; }
.time-zone-toggle input:checked ~ .toggle-track .toggle-local { color: #fff; }
.time-zone-toggle .toggle-track::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 76px;
  height: 30px;
  background: #22534D;
  border-radius: 15px;
  transition: transform 0.2s;
}
.time-zone-toggle input:checked ~ .toggle-track::before {
  transform: translateX(78px);
}
.time-zone-toggle input:checked ~ .toggle-track {
  background: #ccc;
}
#station-table tbody {
    display: block !important;
    max-height: 340px;
    overflow-y: scroll;
    width: 100%;
}
#station-table thead,
#station-table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

#station-table .station-selected-row {
    background-color: #fff3e6;
}

.chart-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 6px;
}

.btn-stations-open {
    background-color: #337ab7;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 10px 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.btn-stations-open:hover,
.btn-stations-open:focus {
    background-color: #286090;
    color: #fff;
    outline: none;
}

.btn-stations-open:active {
    background-color: #204d74;
    color: #fff;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.chart-controls {
    margin-bottom: 10px;
}

.chart-controls .form-inline label {
    margin-right: 4px;
    margin-left: 8px;
}

.chart-controls .form-inline label:first-child {
    margin-left: 0;
}

.chart-controls .form-control {
    max-width: 180px;
}

.chart-controls .axis-number {
    max-width: 90px;
}

@media (min-width: 800px) {
    .col-fixed-sidebar {
        position: fixed;
        top: var(--navbar-height, 52px);
        bottom: 0;
        left: 0;
        z-index: 900;
        display: block;
        padding: 20px;
        overflow-x: hidden;
        overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
        background-color: #f5f5f5;
        border-right: 1px solid #eee;
        width: 300px;
    }
    .col-fixed-main {
        padding-top: 10px;
        padding-right: 40px;
        padding-left: 340px; /* 300 + 40 */
    }
}
