/* Base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: 'Consolas', monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Main container */
.app-container {
  padding: 0;
  background-color: white;
  color: black;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  max-width: 800px;
  margin: 0 auto;
}

/* Header styles */
.app-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: row;
  flex-wrap: wrap;
}

.app-title {
  display: none;
  /* Hidden as we'll use the ASCII logo instead */
}

/* Logo styling */
.logo-container {
  width: auto;
}

.logo-line {
  display: flex;
  font-size: 1.4em;
  white-space: pre;
}

/* Main content area */
.app-main {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Map container */
.map-container {
  height: 300px;
  border: 1px solid #ccc;
  border-radius: 0;
  overflow: hidden;
}

/* Override Leaflet styles for monochrome look */
.leaflet-container {
  background-color: white !important;
}

/* Legend */
.legend-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: 'Consolas', monospace;
  justify-content: flex-end;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border-radius: 0;
  background-color: #fafafa;
  border: 1px solid #eee;
}

.legend-color {
  width: 12px;
  height: 12px;
  border: 1px solid #888;
}

.legend-label {
  font-size: 13px;
  white-space: nowrap;
}

/* Bars container */
.bars-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.bars-container {
  background: white;
  border: 1px solid #ccc;
  padding: 16px;
  width: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

.bars-title {
  margin: 0;
  font-size: 18px;
  font-weight: normal;
  font-family: 'Consolas', monospace;
}

.bars-list {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Individual bar rows */
.bar-row {
  display: flex;
  margin-bottom: 16px;
  font-size: 14px;
  width: 100%;
  max-width: 100%;
  font-family: 'Consolas', monospace;
}

.view-info {
  flex-shrink: 0;
  text-align: right;
  margin-right: 8px;
}

.view-number {
  font-weight: normal;
  color: black;
}

.view-signature {
  font-size: 11px;
  color: #0000eeff;
  text-overflow: ellipsis;
  overflow: hidden;
}

.bar-container {
  position: relative;
  flex-grow: 1;
  max-width: calc(100% - 60px);
  overflow: hidden;
  width: 100%;
}

.bar-main {
  height: 24px;
  position: relative;
  border-radius: 0;
  overflow: hidden;
  transition: width 0.05s linear;
  background-color: #eee;
  border: 1px solid #ccc;
  max-width: 100%;
}

.bar-segment {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: black;
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bar-segment.growing {
  background-color: #ddd;
  border-right: 1px solid #aaa;
}

.bar-segment.finalized {
  background-color: #228b221b;
  z-index: 1;
  border-right: 1px solid #888;
}

.bar-segment.unknown {
  background-color: #fce5cdff;
  border-right: 1px solid #aaa;
}

.bar-segment.timed-out {
  background-color: rgba(255, 0, 0, 0.1);
  width: 100% !important;
  right: 0;
  max-width: 100%;
  text-decoration: line-through;
}

.marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  z-index: 2;
}

.notarization-marker {
  background-color: black;
}

.finalization-marker {
  background-color: #228B22ff;
  z-index: 3;
}

.timing-info {
  position: relative;
  height: 20px;
  margin-top: 2px;
}

.latency-text {
  position: absolute;
  color: #444;
  font-size: 11px;
  white-space: nowrap;
  transition: left 0.05s linear;
}

/* Custom marker icons - pure circles without box container */
.leaflet-div-icon {
  background: transparent;
  border: none;
}

.leaflet-control-attribution {
  font-size: 12px !important;
  line-height: 1.2 !important;
  padding: 0 2px !important;
}

.leaflet-control-attribution a {
  font-size: 12px !important;
}

/* Footer */
.footer {
  text-align: left;
  padding: 10px 16px;
  margin-top: 20px;
}

.footer .socials {
  margin-bottom: 10px;
}

.footer .socials a {
  margin-right: 10px;
}

.footer .socials a:hover {
  text-decoration: underline;
}

/* Fix for Leaflet popups */
.leaflet-popup-content {
  margin: 8px;
  min-width: 150px;
  font-family: 'Consolas', monospace;
  color: black;
}

.leaflet-container {
  font: inherit;
}

.leaflet-popup-content-wrapper {
  border-radius: 0;
  border: 1px solid #ccc;
}

/* Style override for map tiles to use monochrome */
.leaflet-tile {
  filter: grayscale(100%) !important;
}

.about-button-container {
  display: flex;
  align-items: center;
}

.key-header-button {
  background: #0000eeff;
  border: 1px solid #0000eeff;
  cursor: pointer;
  font-family: 'Consolas', monospace;
  font-size: 0.9rem;
  margin-right: 6px;
  color: white;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-fill-color: white;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
}

.key-header-button:hover,
.key-header-button:focus,
.key-header-button:active,
.key-header-button:visited {
  background-color: #f0f0f0;
  text-decoration: none;
  color: #0000eeff;
  -webkit-text-fill-color: #0000eeff;
}

.about-header-button {
  background: black;
  border: 1px solid black;
  cursor: pointer;
  font-family: 'Consolas', monospace;
  font-size: 0.9rem;
  color: white;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-fill-color: white;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
}

.about-header-button:hover,
.about-header-button:focus,
.about-header-button:active,
.about-header-button:visited {
  background-color: #f0f0f0;
  text-decoration: none;
  color: black;
  -webkit-text-fill-color: black;
}

/* Smooth waving animation for patriotic gradient */
@keyframes smoothWave {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* USA Cluster variant for about button */
.about-header-button.usa-cluster {
  background: linear-gradient(45deg, #B22234, #3C3B6E, #B22234);
  background-size: 300% 300%;
  border: 1px solid #B22234;
  color: white;
  -webkit-text-fill-color: white;
  animation: smoothWave 4s ease-in-out infinite;
}

.about-header-button.usa-cluster:hover,
.about-header-button.usa-cluster:focus,
.about-header-button.usa-cluster:active,
.about-header-button.usa-cluster:visited {
  background: #f0f0f0;
  text-decoration: none;
  color: #dc143c;
  -webkit-text-fill-color: #dc143c;
}

/* Media Queries */
@media (min-width: 768px) {
  .app-header {
    padding: 20px;
    flex-direction: row;
  }

  .app-main {
    padding: 20px;
  }

  .map-container {
    height: 400px;
  }

  .bar-row {
    margin-bottom: 20px;
  }

  .bar-segment {
    font-size: 13px;
    padding: 0 10px;
  }

  .latency-text {
    font-size: 12px;
  }

  .view-signature {
    font-size: 12px;
  }

  .bars-header {
    margin-bottom: 20px;
  }

  .bars-title {
    font-size: 20px;
  }

  .legend-label {
    font-size: 13px;
  }

  .legend-item {
    padding: 2px 8px;
  }

  .about-header-button {
    font-size: 0.85rem;
  }

  .key-header-button {
    font-size: 0.85rem;
  }
}


@media (max-width: 480px) {
  .app-header {
    padding: 12px;
  }

  .app-main {
    padding: 12px 8px;
  }

  .map-container {
    height: 250px;
  }

  .bar-row {
    margin-bottom: 12px;
    width: 100%;
  }

  .view-info {
    width: 50px !important;
    margin-right: 4px;
    flex-shrink: 0;
  }

  .bar-container {
    max-width: calc(100% - 54px);
  }

  .view-number {
    font-size: 12px;
  }

  .view-signature {
    font-size: 9px;
  }

  .bar-main {
    height: 22px;
  }

  .bar-segment {
    font-size: 10px;
    padding: 0 4px;
  }

  .latency-text {
    font-size: 9px;
  }

  .bars-header {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 8px;
  }

  .bars-title {
    font-size: 16px;
  }

  .legend-container {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  .legend-item {
    font-size: 10px;
    padding: 1px 4px;
  }

  .legend-color {
    width: 10px;
    height: 10px;
  }

  .legend-label {
    font-size: 10px;
  }

  .logo-container {
    width: auto;
    margin-right: 8px;
  }

  .status-indicator {
    width: 10px;
    height: 10px;
  }

  .unknown-label {
    font-size: 10px;
  }

  .leaflet-control-attribution {
    font-size: 8px !important;
    padding: 0 1px !important;
  }

  .leaflet-control-attribution a {
    font-size: 8px !important;
  }

  .about-header-button {
    font-size: 0.8rem;
  }

  .key-header-button {
    font-size: 0.8rem;
  }
}

.search-header-button {
  background: #ffb200;
  border: 1px solid #ffb200;
  cursor: pointer;
  font-family: 'Consolas', monospace;
  font-size: 0.9rem;
  color: white;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-fill-color: white;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  margin-right: 6px;
}

.search-header-button:hover,
.search-header-button:focus,
.search-header-button:active,
.search-header-button:visited {
  background-color: #f0f0f0;
  text-decoration: none;
  color: #ffb200;
  -webkit-text-fill-color: #ffb200;
}

@media (max-width: 480px) {
  .search-header-button {
    font-size: 0.8rem;
  }
}

.search-header-button,
.key-header-button,
.about-header-button {
  text-rendering: optimizeLegibility;
  -webkit-font-feature-settings: "liga" 0;
  font-feature-settings: "liga" 0;
  font-variant-emoji: text;
}