﻿body {
    padding-top: 70px;
    padding-bottom: 20px;
}

/* Set padding to keep content from hitting the edges */
.body-content {
    /*padding-left: 5px;
    padding-right: 5px;*/
    width: 99%;
}

/* Override the default bootstrap behavior where horizontal description lists 
   will truncate terms that are too long to fit in the left column 
*/
.dl-horizontal dt {
    white-space: normal;
}

/* Set width on the form input elements since they're 100% wide by default */
input,
select,
textarea {
    max-width: 280px;
}

.container {
  padding-right: 5px;
  padding-left: 5px;
  margin-right: 5px;
  margin-left: 5px;
}

.navbar {
  background-color: #3438fa;
  border-color: #080808;
}

.body-content {
  min-height: calc(100vh - 100px);
}

.body-content > h2 {
  margin-top: 10px;
  margin-bottom: 20px;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.filter-form label {
  margin-bottom: 0;
  font-weight: normal;
}

.form-group {
  margin-bottom: 1rem;
}

.btn-default {
  color: #212529;
  background-color: #f8f9fa;
  border-color: #ced4da;
}

.btn-default:hover,
.btn-default:focus {
  color: #212529;
  background-color: #e2e6ea;
  border-color: #dae0e5;
}

.filter-form .checkbox {
  padding-left: 20px;
  margin-bottom: 7px;
}

.filter-form button {
  margin-bottom: 0;
}

.map-sidebar .panel,
.travel-track {
  margin-bottom: 10px;
}

.home-map-page {
  position: relative;
  width: 100%;
  margin-left: 0;
  display: grid;
  grid-template-columns: minmax(180px, 190px) minmax(0, 1fr);
  align-items: flex-start;
  gap: 10px;
  box-sizing: border-box;
}

.map-sidebar {
  width: auto;
  min-width: 0;
}

.map-controls {
  width: 100%;
  padding: 2px 8px 4px 0;
}

.map-sidebar .form-group {
  margin-bottom: 6px;
}

.map-sidebar label {
  display: block;
  margin-bottom: 2px;
  font-size: .78rem;
}

.map-sidebar .map-controls > .form-group:first-child > label,
.track-label-row {
  height: 26px;
  box-sizing: border-box;
}

.map-sidebar .map-controls > .form-group:first-child > label {
  display: flex;
  align-items: center;
  margin-bottom: 0;
}

.track-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.track-label-row label {
  margin-bottom: 0;
}

.map-sidebar .form-control {
  width: 100%;
  max-width: none;
  height: 26px;
  min-height: 26px;
  padding: .1rem .35rem;
  font-size: .75rem;
}

.map-sidebar .form-select {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.date-picker-control {
  position: relative;
  width: 27px;
  height: 26px;
}

.date-picker-control #tracStartTime {
  display: none;
}

.date-picker-control #tracStartTimePicker {
  position: absolute;
  top: 0;
  right: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  color: transparent;
  background: transparent;
  font-size: 0;
  opacity: 0 !important;
  appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  z-index: 1;
}

.date-picker-button {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 25px;
  height: 24px;
  padding: 0;
  border: 1px solid #adb5bd;
  border-radius: 2px;
  background: #fff;
  color: #495057;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.calendar-icon {
  position: relative;
  display: block;
  width: 13px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 2px;
}

.calendar-icon::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  width: 100%;
  border-top: 1px solid currentColor;
}

.calendar-icon::after {
  content: "";
  position: absolute;
  top: -3px;
  left: 2px;
  width: 7px;
  height: 3px;
  border-left: 1px solid currentColor;
  border-right: 1px solid currentColor;
}

.picture-date-picker {
  position: relative;
  display: inline-block;
  width: 150px;
}

.picture-date-picker #pictureStartDate {
  padding-right: 30px;
}

.picture-date-picker #pictureStartDatePicker {
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 100%;
  padding: 0;
  border: 0;
  color: transparent;
  background: transparent;
  font-size: 0;
  opacity: 0 !important;
  appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  z-index: 1;
}

.picture-date-picker .date-picker-button {
  pointer-events: none;
}

.map-sidebar .track-summary,
.map-sidebar .live-data {
  margin-top: 6px;
  font-size: .8rem;
}

.track-details {
  min-width: 0;
}

.map-sidebar .form-check {
  margin-top: 6px;
  margin-bottom: 0;
  font-size: .78rem;
}

.panel {
  border: 1px solid #ddd;
  border-radius: .375rem;
  background-color: #fff;
}

.panel-heading {
  padding: 10px 15px;
  border-bottom: 1px solid #ddd;
  background-color: #f5f5f5;
}

.panel-body {
  padding: 15px;
}

.smp-map {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  height: calc(100vh - 190px);
  min-height: 280px;
  border: 1px solid #ddd;
  background: #f5f5f5;
}

.map-content {
  min-width: 0;
  width: calc(100vw - 220px);
}

.track-summary,
.live-data {
  margin-top: 10px;
}

.live-data {
  color: #31708f;
  font-weight: bold;
}

.picture-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.picture-page {
  width: 100%;
  box-sizing: border-box;
}

.picture-user-filter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.picture-tile {
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  box-sizing: border-box;
}

.picture-image-container {
  width: 100%;
  overflow-x: auto;
}

.picture-image-container a {
  display: block;
  width: 100%;
}

.picture-tile img {
  display: block;
  width: 100%;
  min-width: 0;
  height: auto;
  max-width: none;
  background: transparent;
}

.picture-caption {
  padding: 4px 2px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.picture-caption p {
  margin: 3px 0 0;
}

.picture-page > h2 {
  margin-top: 0;
  margin-bottom: 10px;
}

.picture-page hr {
  margin: 8px 0;
}

@media (max-width: 767px) {
  .picture-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.search-map {
  max-width: 640px;
  margin: 20px 0;
}

.travel-track {
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 16px rgb(15 23 42 / 5%);
}

.travel-track .panel-heading h3,
.travel-track .card-header h3 {
  margin: 0;
}

.travel-index-page,
.travel-results-page {
  max-width: 1280px;
  margin: 10px auto 28px;
}

.travel-page-header {
  margin: 0 0 22px;
}

.travel-page-eyebrow,
.travel-track-eyebrow {
  margin: 0 0 5px;
  color: #64748b;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
}

.travel-page-header h1 {
  margin: 0;
  color: #1f2937;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 650;
  letter-spacing: -.03em;
}

.travel-page-header > p:last-child {
  margin: 7px 0 0;
  color: #64748b;
}

.travel-trip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.travel-trip-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 15px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #1f2937;
  text-decoration: none;
  box-shadow: 0 2px 8px rgb(15 23 42 / 4%);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.travel-trip-link:hover,
.travel-trip-link:focus {
  transform: translateY(-1px);
  border-color: #93c5fd;
  color: #1d4ed8;
  text-decoration: none;
  box-shadow: 0 6px 16px rgb(15 23 42 / 8%);
}

.travel-trip-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 1.2rem;
}

.travel-trip-link strong,
.travel-trip-link small {
  display: block;
}

.travel-trip-link strong {
  font-size: 1rem;
}

.travel-trip-link small {
  margin-top: 3px;
  color: #64748b;
  font-size: .85rem;
}

.trip-management-page {
  max-width: 1280px;
}

.trip-gpsuser-group {
  margin-top: 24px;
}

.trip-gpsuser-heading {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #cbd5e1;
  color: #334155;
  font-size: 1.2rem;
}

.trip-user-filter {
  display: grid;
  grid-template-columns: minmax(180px, 320px);
  gap: 6px;
}

.trip-user-filter label {
  color: #475569;
  font-size: .9rem;
  font-weight: 600;
}

.trip-management-card {
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 16px rgb(15 23 42 / 5%);
}

.trip-management-card > h2 {
  margin: 0 0 14px;
  color: #1f2937;
  font-size: 1.15rem;
}

.trip-edit-grid,
.trip-segment-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

.trip-edit-grid label,
.trip-segment-fields label {
  display: block;
  margin-bottom: 4px;
  color: #475569;
  font-size: .85rem;
}

.trip-edit-grid .form-control,
.trip-segment-fields .form-control,
.trip-add-route .form-control {
  width: 100%;
  max-width: none;
}

.trip-plan-editor {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.trip-plan-editor > .trip-edit-grid {
  flex: 1;
}

.trip-management-actions form {
  margin: 0;
}

.trip-segment-editor {
  padding: 16px 0;
  border-bottom: 1px solid #e2e8f0;
}

.trip-segment-fields {
  grid-template-columns: minmax(90px, .5fr) minmax(120px, 1fr) minmax(160px, 2fr) auto;
}

.trip-route-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.trip-route-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px 4px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #334155;
  background: #f8fafc;
  font-size: .82rem;
}

.trip-route-chip form,
.trip-route-chip button {
  margin: 0;
}

.trip-route-chip button {
  padding: 0 3px;
  border: 0;
  color: #64748b;
  background: transparent;
  font-size: 1.1rem;
  line-height: 1;
}

.trip-route-chip button:hover {
  color: #b91c1c;
}

.trip-add-route {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trip-add-route .form-control {
  width: 110px;
}

.trip-delete-segment {
  margin-top: 10px;
  text-align: right;
}

.trip-create-segment {
  padding-top: 16px;
}

.trip-validation-summary:not(:empty) {
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
}

.travel-track-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 17px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.travel-track-header h2 {
  margin: 0;
  color: #1f2937;
  font-size: 1.2rem;
  font-weight: 650;
}

.travel-track-header .travel-track-eyebrow {
  margin-bottom: 3px;
}

.travel-distance-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: .85rem;
  font-weight: 650;
}

.travel-track-body {
  padding: 18px 20px 20px;
}

.travel-track-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.travel-track-stats > div {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.travel-track-stats span,
.travel-track-stats strong {
  display: block;
}

.travel-track-stats span {
  margin-bottom: 4px;
  color: #64748b;
  font-size: .78rem;
}

.travel-track-stats strong {
  overflow-wrap: anywhere;
  color: #1f2937;
  font-size: .9rem;
  font-weight: 600;
}

.travel-chart-panel,
.travel-map-panel {
  margin-top: 16px;
}

.travel-chart-panel h3,
.travel-map-panel h3 {
  margin: 0 0 8px;
  color: #334155;
  font-size: .95rem;
  font-weight: 650;
}

.elevation-chart {
  width: 100%;
  height: 190px;
  margin-bottom: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.travel-map {
  width: 100%;
  height: 420px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #e9eef3;
}

@media (max-width: 767px) {
  .travel-trip-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .travel-track-header,
  .travel-track-body {
    padding-right: 13px;
    padding-left: 13px;
  }

  .travel-track-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .travel-map {
    height: 340px;
  }

  .trip-management-card {
    padding: 13px;
  }

  .trip-plan-editor {
    align-items: stretch;
    flex-direction: column;
  }

  .trip-edit-grid,
  .trip-segment-fields,
  .trip-create-segment {
    grid-template-columns: minmax(0, 1fr);
  }

  .trip-management-actions .btn {
    width: 100%;
  }

  .trip-add-route {
    width: 100%;
  }

  .trip-add-route .form-control {
    flex: 1;
  }
}

.route-detail-map {
  width: 100%;
  height: min(62vh, 620px);
  min-height: 360px;
  border-radius: 0 0 14px 14px;
  background: #e9eef3;
}

.route-details-page {
  max-width: 1280px;
  margin: 10px auto 28px;
  color: #1f2937;
}

.route-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.route-details-header h1 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  font-weight: 650;
  letter-spacing: -.03em;
}

.route-details-eyebrow {
  margin: 0 0 5px;
  color: #64748b;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
}

.route-details-user {
  margin: 6px 0 0;
  color: #64748b;
}

.route-back-button {
  flex: 0 0 auto;
  border-radius: 8px;
  padding: 9px 13px;
}

.route-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.route-stat {
  min-width: 0;
  padding: 15px 17px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgb(15 23 42 / 4%);
}

.route-stat-label {
  display: block;
  margin-bottom: 5px;
  color: #64748b;
  font-size: .8rem;
}

.route-stat strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
  font-weight: 650;
}

.route-stat small {
  color: #64748b;
  font-size: .8rem;
  font-weight: 500;
}

.route-map-card {
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 16px rgb(15 23 42 / 6%);
}

.route-map-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
}

.route-map-heading h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
}

.route-map-heading p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: .85rem;
}

.route-map-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-size: .85rem;
}

.route-map-legend img {
  width: 20px;
  height: 20px;
}

.route-map-notice {
  margin: 0;
  padding: 12px 18px;
  color: #854d0e;
  background: #fef9c3;
}

@media (max-width: 767px) {
  .route-details-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .route-back-button {
    width: 100%;
  }

  .route-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .route-stat {
    padding: 12px;
  }

  .route-detail-map {
    height: 55vh;
    min-height: 280px;
  }
}

.access-denied {
  max-width: 640px;
  margin: 40px auto;
}

.access-denied-image {
  display: block;
  width: 100%;
  max-width: 460px;
  margin: 0 auto 25px;
}

@media (max-width: 767px) {
  .filter-form {
    display: block;
  }

  .filter-form label,
  .filter-form input,
  .filter-form select,
  .filter-form button {
    display: block;
    width: 100%;
    max-width: none;
    margin-bottom: 10px;
  }

  .filter-form .checkbox {
    width: auto;
  }

  .smp-map {
    height: calc(100vh - 330px);
    height: calc(100dvh - 330px);
    min-height: 220px;
  }

  .map-sidebar {
    width: 100%;
    margin-bottom: 10px;
  }

  .map-sidebar .map-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "user track"
      "details details"
      "allpositions allpositions"
      "live live";
    gap: 4px 8px;
  }

  .map-sidebar .map-controls > .form-group {
    width: 100%;
    min-width: 0;
    align-self: start;
    margin-bottom: 0;
  }

  .map-sidebar .map-controls > .form-group:nth-child(1) {
    grid-area: user;
  }

  .map-sidebar .map-controls > .form-group:nth-child(2) {
    grid-area: track;
  }

  .map-sidebar .track-details {
    grid-area: details;
    display: flex;
    flex-direction: row;
    align-self: start;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  .map-sidebar .track-details .track-summary {
    flex: 1 1 0;
    min-width: 0;
    margin-top: 0;
    font-size: .68rem;
    white-space: nowrap;
  }

  .map-sidebar #showAllPositionsControl {
    grid-area: allpositions;
    margin: 2px 0;
  }

  .map-sidebar #livedata {
    grid-area: live;
    align-self: center;
    margin-top: 0;
    text-align: left;
    min-width: 0;
    padding-right: 116px;
    font-size: .68rem;
    white-space: nowrap;
    overflow: visible;
  }

  .map-sidebar #followuser {
    grid-area: live;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    text-align: right;
    justify-self: end;
    white-space: nowrap;
    margin-top: 0;
  }

  .map-sidebar #followuser .form-check-input {
    float: none;
    margin: 0 0 0 .5em;
    order: 1;
  }

  .home-map-page {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }

  .map-content {
    width: 100%;
  }
}
