/* ============================================================
   site.css -- Appalachian Rivers
   Minimal overrides; Bootstrap 5 dark theme handles the rest.
   ============================================================ */

:root {
  --color-too-low: #3498db;
  --color-low:     #c9a800;
  --color-optimal: #27ae60;
  --color-high:    #e67e22;
  --color-flood:   #c0392b;
}

/* Flow status badge -- fixed width for uniform column alignment */
.flow-badge {
  font-size: 0.8rem;
  padding: 0.3em 0.65em;
  letter-spacing: 0;
  width: 7em;
  display: inline-block;
  text-align: center;
  line-height: 1.3;
}
.flow-badge .trend-arrow {
  font-size: 0.9rem;
  font-weight: bold;
  opacity: 1;
}

/* Table: tighten up the region view on wide screens */
.table th, .table td {
  vertical-align: middle;
}

/* Sparkline canvas container */
#sparkline {
  width: 100% !important;
}

/* HTMX loading indicator: hidden by default, shown during request */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}

/* Difficulty badge -- fixed width for uniform column */
.badge.bg-secondary {
  opacity: 0.85;
  width: 4.5em;
  display: inline-block;
  text-align: center;
}

/* Sortable column headers */
.sortable {
  cursor: pointer;
  user-select: none;
}
.sortable:hover {
  text-decoration: underline;
}
.sort-arrow {
  font-size: 0.7rem;
}

/* Sub-region group header rows */
.group-header td {
  background: #2a2a2a;
  color: #aaa;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4em 0.65em;
  border-top: 2px solid #444;
}

/* City / sort-preset selectors */
#city-select,
#sort-preset {
  font-size: 0.8rem;
}

/* Mobile compact layout */
@media (max-width: 767.98px) {
  /* Use the full viewport width: trim Bootstrap container gutters */
  main.container-fluid {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }
  #river-table {
    table-layout: fixed;
    width: 100%;
  }
  /* Explicit % widths on all three visible columns sum to 100% so
     the table actually fills its container instead of collapsing. */
  #river-table th:nth-child(1),
  #river-table td:nth-child(1) {
    width: 33%;
    word-break: break-word;
  }
  #river-table th:nth-child(4),
  #river-table td:nth-child(4) {
    width: 35%;
  }
  #river-table th:nth-child(5),
  #river-table td:nth-child(5) {
    width: 32%;
  }
  /* Smalls are display:block on mobile, so the <br>s before them add empty lines.
     Hide the <br>s inside col 1 on mobile only. */
  #river-table td:nth-child(1) br {
    display: none;
  }
  /* River name link: single line + ellipsis so long names don't grow row height */
  #river-table td:nth-child(1) > a {
    display: inline-block;
    max-width: 100%;
    vertical-align: top;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Section description: single line + ellipsis so wrap doesn't grow row height */
  #river-table td:nth-child(1) > small.text-secondary {
    font-size: 0.7rem;
    line-height: 1.15;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Sub-region + difficulty (3rd line, mobile-only): same single-line ellipsis.
     Bootstrap's text-muted (dark gray) is invisible on dark theme — set explicit color. */
  #river-table td:nth-child(1) .d-md-none small.text-muted {
    display: block;
    font-size: 0.65rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(255, 255, 255, 0.5) !important;
  }
  /* Flow badge fits its column */
  .flow-badge {
    font-size: 0.7rem;
    width: 100%;
    max-width: 5.5em;
    padding: 0.2em 0.25em;
    box-sizing: border-box;
  }
  .flow-badge .trend-arrow {
    font-size: 0.7rem;
    font-weight: normal;
  }
  /* Reading column: shrink range text, tighten line height */
  #river-table td:nth-child(5) {
    font-size: 0.85rem;
  }
  #river-table td:nth-child(5) small {
    font-size: 0.7rem;
    line-height: 1.15;
  }
  #river-table td {
    padding-left: 0.2rem;
    padding-right: 0.2rem;
  }
}

/* Hover sparkline popup */
.spark-popup {
  position: fixed;
  z-index: 1050;
  background: #1e1e1e;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 8px 10px 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  pointer-events: none;
  display: none;
  max-width: 90vw;
}
.spark-popup .spark-label {
  font-size: 0.7rem;
  color: #aaa;
  text-align: center;
  margin-top: 2px;
}
