/* Hide any element tagged “hidden” */
.hidden {
  display: none !important;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f7;
  margin: 0;
  padding: 0;
}

.page {
  max-width: 1100px;
  width: 95vw;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  box-sizing: border-box;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2em 1em 1.2em 1em;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 1.5em;
  position: sticky;
  top: 0;
  z-index: 200;
}

.site-title {
  font-size: 1.6em;
  font-weight: 700;
  color: #0077cc;
  letter-spacing: 0.03em;
}

.site-title-link {
  text-decoration: none;
  color: inherit;
}

.site-user {
  display: flex;
  align-items: center;
}

.sortable-stop-row {
  cursor: move;
  border-left: 4px solid transparent;
}

.user-btn,
.user-btn:link,
.user-btn:visited {
  background: #f7fafc;
  color: #0077cc;
  border: none;
  border-radius: 2em;
  padding: 0.5em 1.3em;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition:
    background 0.15s,
    color 0.15s;
  display: flex;
  align-items: center;
  gap: 0.7em;
  text-decoration: none; /* Remove underline for links */
  outline: none;
}

.user-btn:hover:not(:disabled) {
  background: #eaf6fb;
  color: #005fa3;
}

.user-btn.logged-in {
  background: #eaf6fb;
  color: #555;
  /* cursor: default; */
  /* pointer-events: none; */
}

.user-menu {
  position: relative;
  display: inline-block;
}
.user-dropdown {
  position: absolute;
  right: 0;
  top: 110%;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 0.5em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  min-width: 120px;
  padding: 0.5em 0;
}
.logout-btn {
  width: 100%;
  background: none;
  border: none;
  color: #d73027;
  font-weight: 600;
  padding: 0.7em 1em;
  text-align: left;
  cursor: pointer;
  border-radius: 0.5em;
  transition: background 0.15s;
}
.logout-btn:hover {
  background: #ffeaea;
}

.remove-btn {
  background: #fff0f0;
  color: #d73027;
  border: 1px solid #f5c2c7;
  border-radius: 2em;
  padding: 0.3em 1em;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.5em;
  transition:
    background 0.15s,
    color 0.15s,
    border 0.15s;
}
.remove-btn:hover {
  background: #ffd6d6;
  color: #a71d2a;
  border: 1px solid #d73027;
}

.plan-btn {
  background: #e6f4ea;
  color: #19692c;
  border: 1px solid #9ad7a1;
  border-radius: 2em;
  padding: 0.3em 1em;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5em;
  transition:
    background 0.15s,
    color 0.15s,
    border 0.15s;
}
.plan-btn:hover:not(:disabled) {
  background: #d4edda;
  color: #145524;
  border-color: #28a745;
}
.plan-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.popup-desc {
  margin-top: 0.3em;
  font-size: 0.9em;
  line-height: 1.3;
}
.popup-desc.collapsed {
  max-height: 4.5em;
  overflow: hidden;
}
.desc-toggle {
  background: none;
  border: none;
  color: #0077cc;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-size: 0.85em;
  margin-top: 0.2em;
}

.user-avatar {
  width: 2em;
  height: 2em;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #0077cc;
  margin-right: 0.5em;
}

.tab-nav {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #ddd;
}

.tab-nav button {
  flex: 1;
  padding: 0.75rem 0;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
}

.tab-nav button.active {
  color: #000;
  border-bottom: 3px solid #0077cc;
}
.labels-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 0.7em; /* vertical horizontal */
  align-items: flex-start;
  min-height: 1.5em;
}
.label {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  margin-bottom: 0.2em;
  margin-right: 0.5em; /* Add this for extra horizontal space */
  white-space: nowrap; /* Prevent label text from breaking inside the label */
}
.rating {
  color: #ffb400;
  margin: 0.25rem 0;
}
/* Responsive, always-stacked planning table */
.planning-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 2rem;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  font-size: 1rem;
  transition: box-shadow 0.2s;
  /* Remove table layout for stacking */
  display: block;
}

.planning-table thead {
  display: none;
}

.planning-table,
.planning-table tbody,
.planning-table tr,
.planning-table td {
  display: block;
  width: 100%;
}

.planning-table tr {
  margin-bottom: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0.5em 0;
}

.planning-table td {
  box-sizing: border-box;
  padding: 0.7em 1em;
  border-bottom: 1px solid #f0f0f0;
  white-space: normal;
  word-break: break-word;
  position: relative;
  justify-content: space-between;
  align-items: flex-start;
}

.planning-table td[data-label]::before {
  content: attr(data-label);
  font-weight: 600;
  color: #555;
  margin-right: 1.2em;
  flex: 0 0 120px;
  min-width: 100px;
  display: block;
}
.planning-table td:first-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0.2em;
}
.planning-table td:last-child {
  border-bottom: none;
}

.planning-table .label {
  margin-bottom: 0.2em;
  display: inline-block;
}

.current-stop-row {
  border-left: 4px solid #3182bd;
  background: #eaf6fb;
}

.current-badge-table {
  background: #3182bd;
  color: #fff;
  border-radius: 1em;
  padding: 0.1em 0.7em;
  font-size: 0.85em;
  margin-left: 0.5em;
}

.current-badge-table.underway-badge {
  background: #ff9800;
  animation: pulse 1s ease-in-out infinite;
}
.current-badge-table.underway-badge::after {
  content: " \26F5"; /* sailboat emoji */
}

.underway-row {
  background: #fff3e0;
  border-left: 4px solid #ff9800;
}

.underway-info {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}

.underway-info .current-badge-table {
  margin-bottom: 0.3em;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.day-header-row {
  background: #eaf6fb;
  color: #0077cc;
  font-weight: bold;
  font-size: 1.1em;
  letter-spacing: 0.03em;
  padding-top: 1.2em;
  border: 1px solid #e0e0e0;
  border-bottom: none;
  border-radius: 0.5em 0.5em 0 0;
  margin-top: 1rem;
  display: block;
}

.area-header-table {
  background: #eaf6fb;
  color: #0077cc;
  font-weight: bold;
  font-size: 1.1em;
  letter-spacing: 0.03em;
  padding-top: 1.2em;
  border-top: 2px solid #b3e0fc;
  border-radius: 0.5em 0.5em 0 0;
  margin-bottom: 0.5em;
  display: block;
}

.planning-table tr[data-day]:not(.day-header-row) {
  border-left: 1px solid #e0e0e0;
  border-right: 1px solid #e0e0e0;
  background: #fff;
}

.planning-table tr.day-end-row {
  border-left: 1px solid #e0e0e0;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  border-radius: 0 0 0.5em 0.5em;
  margin-bottom: 1rem;
}

.day-header-table {
  background: #f7fafc;
  color: #555;
  font-weight: 600;
  font-size: 1em;
  padding-left: 1.5em;
  border: none;
}

.sortable-stop-row.empty-drop-row td {
  text-align: center;
  color: #bbb;
  font-style: italic;
}

.planning-table .rating {
  font-size: 1.2em;
  color: #ffb400;
  letter-spacing: 0.1em;
}

.planning-table a {
  color: #0077cc;
  text-decoration: none;
  font-size: 1.25em;
  margin-right: 0.7em;
  vertical-align: middle;
  display: inline-block;
  transition:
    color 0.15s,
    transform 0.15s;
}
.planning-table a:last-child {
  margin-right: 0;
}
.planning-table a:hover {
  color: #005fa3;
  transform: scale(1.15);
}
.planning-table i.fa-anchor {
  color: #f39c12;
}
.planning-table i.fa-trello {
  color: #0079bf;
}

/* Optional: make the table look good on all screens */
@media (max-width: 600px) {
  .planning-table td[data-label]::before {
    min-width: 80px;
    margin-right: 0.7em;
  }
  .planning-table td {
    padding: 0.7em 0.5em;
  }
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.controls label {
  display: flex;
  align-items: center;
  background: #f7fafc;
  border-radius: 2rem;
  padding: 0.5rem 1.2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  font-size: 1rem;
  gap: 0.5rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  font-size: 1rem;
  gap: 0.5em;
  cursor: pointer;
}

.summary-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: space-around;
  margin: 0.5rem 0 1rem;
  padding: 0.5rem 1rem;
  background: #f0f4f8;
  border-radius: 0.5rem;
  font-weight: 600;
}

.summary-panel .summary-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #333;
}

.summary-panel .summary-item i {
  color: #0077cc;
}

.toggle-label input[type="checkbox"] {
  accent-color: #0077cc;
  width: 1.1em;
  height: 1.1em;
}

.speed-label {
  font-weight: 600;
  color: #0077cc;
  margin-right: 0.5rem;
  letter-spacing: 0.03em;
}

#speed-input {
  width: 4rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid #d0d7de;
  border-radius: 1.2rem;
  font-size: 1rem;
  outline: none;
  margin: 0 0.5rem;
  background: #fff;
  transition: border 0.2s;
}

#speed-input:focus {
  border: 1.5px solid #0077cc;
  background: #f0f8ff;
}

.speed-units {
  color: #555;
  font-size: 0.95em;
  margin-left: 0.2rem;
}

#map {
  width: 100%;
  min-width: 300px;
  height: 50vh;
  min-height: 300px;
  margin-bottom: 2rem;
  border-radius: 0.5rem;
  overflow: hidden;
  flex: 1 1 350px;
}

#map,
#log-map,
.leaflet-container {
  z-index: 10 !important;
}

.table-col {
  width: 100%;
  flex: 1 1 350px;
}

.leaflet-control {
  z-index: 20 !important;
}

.map-label {
  background: rgba(255, 255, 255, 0.85);
  color: #0077cc;
  font-weight: 600;
  border-radius: 0.3em;
  padding: 0.1em 0.5em;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  border: 1px solid #e0e0e0;
  font-size: 1em;
}
.map-planned-marker {
  filter: drop-shadow(0 0 6px #0077cc88);
}
.map-log-marker {
  filter: drop-shadow(0 0 4px #5555);
}
.leaflet-interactive.map-stop-marker {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
}

.map-current-marker {
  filter: drop-shadow(0 0 6px #0077cc);
}

.underway-marker {
  font-size: 24px;
}

.stars.editable .star {
  cursor: pointer;
}

.area-header-table {
  background: #eaf6fb;
  color: #0077cc;
  font-weight: bold;
  font-size: 1.1em;
  letter-spacing: 0.03em;
  padding-top: 1.2em;
  border-top: 2px solid #b3e0fc;
}
.day-header-table {
  background: #f7fafc;
  color: #555;
  font-weight: 600;
  font-size: 1em;
  padding-left: 1.5em;
}
.current-stop-row {
  border-left: 4px solid #3182bd;
  background: #eaf6fb;
}
.current-badge-table {
  background: #3182bd;
  color: #fff;
  border-radius: 1em;
  padding: 0.1em 0.7em;
  font-size: 0.85em;
  margin-left: 0.5em;
}
.log-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.08);
  font-size: 1rem;
  margin-bottom: 2rem;
}
.log-table th,
.log-table td {
  padding: 1rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}
.log-table th {
  background: #f7fafc;
  color: #222;
  font-weight: 700;
  border-bottom: 2px solid #e0e0e0;
}
.log-table tr:last-child td {
  border-bottom: none;
}
#log-controls {
  display: flex;
  gap: 1em;
  margin-bottom: 1em;
}

#log-controls button {
  background: #0077cc;
  color: #fff;
  border: none;
  border-radius: 2em;
  padding: 0.6em 1.6em;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
  transition:
    background 0.15s,
    box-shadow 0.15s;
}

#log-controls button:hover,
#log-controls button.active {
  background: #005fa3;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Layout for log section */
.log-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.log-left {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
#log-map {
  height: 350px;
  margin-top: 2rem;
}
#log-list {
  overflow-x: auto;
  background: #fff;
  padding: 1em;
  border-radius: 0.5em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-bottom: 1em;
}
@media (min-width: 900px) {
  .log-layout {
    flex-direction: row;
    align-items: flex-start;
  }
  .log-left {
    flex: 1 1 50%;
  }
  #log-map {
    height: 60vh;
  }
  #log-list {
    flex: 1 1 50%;
  }
}
.historical-trip-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2em 0;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.historical-trip-link {
  background: #f7fafc;
  border-radius: 1.5em;
  padding: 0.7em 1.4em;
  font-size: 1.05em;
  color: #0077cc;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #e0e0e0;
  transition:
    background 0.15s,
    color 0.15s,
    box-shadow 0.15s;
  margin-bottom: 0.2em;
  display: inline-block;
}

.historical-trip-link:hover {
  background: #eaf6fb;
  color: #005fa3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}
.historical-log-header,
.historical-log-entry {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1.2fr 0.8fr auto;
  gap: 0.5em;
  align-items: center;
  padding: 0.6em 0.8em;
  background: #f7fafc;
  border-radius: 0.5em;
}
.historical-log-header {
  font-weight: 600;
}
.historical-log-entry {
  font-size: 1em;
}
.historical-log-place {
  font-weight: 600;
  color: #0077cc;
}
.historical-log-labels {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  margin-top: 0.3em;
  cursor: pointer;
}
.historical-log-labels .label {
  display: inline-block;
  padding: 0.1em 0.4em;
  margin: 0 0.2em 0.2em 0;
  border-radius: 0.3em;
  font-size: 0.8em;
}
.historical-log-labels .label.placeholder {
  background: #eee;
  color: #333;
}
.historical-log-distance {
  color: #555;
  font-size: 0.9em;
}
.historical-log-date {
  color: #555;
  font-size: 0.95em;
}
.historical-log-rating {
  color: #ffb400;
  font-size: 1.2em;
  letter-spacing: 0.1em;
}
.historical-log-links a {
  margin-right: 0.5em;
  color: #0077cc;
  font-size: 1.2em;
}

.label-editor {
  position: absolute;
  background: #fff;
  border: 1px solid #ccc;
  padding: 0.5em;
  border-radius: 0.4em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}
.label-editor label {
  display: flex;
  align-items: center;
  margin-bottom: 0.3em;
  cursor: pointer;
}
.label-editor label input {
  margin-right: 0.3em;
}

@media (max-width: 600px) {
  .historical-log-header {
    display: none;
  }
  .historical-log-entry {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "place rating"
      "labels labels"
      "distance date"
      "links links";
  }
  .historical-log-place {
    grid-area: place;
  }
  .historical-log-rating {
    grid-area: rating;
    justify-self: end;
  }
  .historical-log-labels {
    grid-area: labels;
  }
  .historical-log-distance {
    grid-area: distance;
  }
  .historical-log-date {
    grid-area: date;
    justify-self: end;
  }
  .historical-log-links {
    grid-area: links;
  }
}
@media (max-width: 899px) {
  .log-table {
    display: table;
    font-size: 0.95em;
    overflow-x: auto;
    width: 100%;
  }
  .log-table th,
  .log-table td {
    padding: 0.7em 0.5em;
    font-size: 0.95em;
  }
}
.planning-flex {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
@media (min-width: 900px) {
  .planning-flex {
    flex-direction: row;
    align-items: flex-start;
    gap: 2.5rem;
  }
  #map {
    width: 55vw;
    min-width: 400px;
    height: 70vh;
    margin-bottom: 0;
    flex: 2 1 500px;
  }
  .table-col {
    width: 40vw;
    min-width: 320px;
    max-width: 500px;
    flex: 1 1 350px;
  }
}

/* Diesel gauge styles */
#diesel-info {
  background: #fff;
  padding: 1em;
  border-radius: 0.5em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  max-width: 260px;
}

.diesel-gauge-container {
  position: relative;
  width: 220px;
  margin: 0 auto 1rem;
}

.diesel-gauge {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.gauge-bg {
  fill: none;
  stroke: #e0e0e0;
  stroke-width: 12;
}

.gauge-fill {
  fill: none;
  stroke: #00bcd4;
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dasharray 0.3s ease;
}

.gauge-needle {
  stroke: #ff5252;
  stroke-width: 2;
  stroke-linecap: round;
  transition: transform 0.3s ease;
}

.gauge-label {
  font-size: 11px;
  fill: #666;
}

.gauge-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -40%);
  font-weight: 600;
  font-size: 1rem;
  color: #333;
}

.diesel-stats {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
}

.diesel-stats li {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px solid #eee;
}

.diesel-stats li:last-child {
  border-bottom: none;
}

.diesel-stats .label {
  color: #666;
}

.diesel-stats .value {
  font-weight: 600;
}

/* Broken items styles */
#broken-items {
  background: #fff;
  padding: 1em;
  border-radius: 0.5em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 1em;
}

#broken-items h4 {
  margin-top: 0;
  font-size: 1.2em;
}

.broken-items-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.broken-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6em 0.8em;
  background: #f7fafc;
  border-radius: 0.5em;
}

.broken-item .status {
  font-size: 0.85em;
  font-weight: 600;
  padding: 0.2em 0.7em;
  border-radius: 1em;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.broken-item .status.broken {
  background: #ffeaea;
  color: #d93025;
}

.broken-item .status.fixed {
  background: #e6f4ea;
  color: #107c10;
}
