/* Tri-State Consulting — modernized public theme */
:root {
  --tsc-blue: #3153ba;
  --tsc-navy: #000066;
  --tsc-blue-soft: rgba(49, 83, 186, 0.12);
  --tsc-surface: rgba(255, 255, 255, 0.92);
  --tsc-surface-solid: #ffffff;
  --tsc-text: #1a1d26;
  --tsc-muted: #5c6578;
  --tsc-border: rgba(26, 29, 38, 0.12);
  --tsc-radius: 0.75rem;
  --tsc-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.08);
  --tsc-font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
  height: 100%;
  overflow-x: clip;
  max-width: 100%;
}

body.tsc-body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  color: var(--tsc-text);
  font-family: var(--tsc-font);
  background-color: #e8eef8;
  background-image: linear-gradient(180deg, rgba(232, 238, 248, 0.72), rgba(232, 238, 248, 0.88)),
    url("https://storage.googleapis.com/tscmaps-site-storage/static/images/TSC-website-background.jpg");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center bottom;
  background-attachment: scroll; /* fixed is unreliable/wide on mobile browsers */
  overflow-x: clip;
  max-width: 100vw;
  width: 100%;
}

.tsc-shell {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.tsc-main,
.tsc-main > .container {
  width: 100%;
  max-width: 100%;
}

.tsc-navbar {
  background: var(--tsc-surface-solid) !important;
  box-shadow: var(--tsc-shadow);
  border-bottom: 1px solid var(--tsc-border);
}

.tsc-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none !important;
  color: var(--tsc-navy) !important;
}

.tsc-brand img {
  width: 48px;
  height: 48px;
}

.tsc-brand-text {
  font-weight: 700;
  color: var(--tsc-blue);
  text-transform: uppercase;
  font-family: "Times New Roman", Times, serif;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  line-height: 1.1;
}

@media (min-width: 1200px) {
  .tsc-brand-text {
    font-size: 1.35rem;
    letter-spacing: 0.28em;
  }
}

@media (max-width: 575.98px) {
  .tsc-brand-text {
    display: none;
  }
}

.tsc-navbar .nav-link {
  color: var(--tsc-navy) !important;
  font-weight: 600;
  padding: 0.55rem 0.9rem !important;
  border-radius: 999px;
}

.tsc-navbar .nav-link:hover,
.tsc-navbar .nav-link:focus {
  background: var(--tsc-blue-soft);
  color: var(--tsc-blue) !important;
}

.tsc-navbar .nav-link.active {
  background: var(--tsc-blue);
  color: #fff !important;
}

.tsc-main {
  flex: 1 0 auto;
  padding-bottom: 2rem;
}

.tsc-subhead {
  background: var(--tsc-surface-solid);
  border-bottom: 1px solid var(--tsc-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.tsc-subhead h1,
.tsc-subhead h2,
.tsc-subhead h3 {
  margin: 0;
  color: var(--tsc-navy);
  font-weight: 700;
}

.tsc-content-row {
  --bs-gutter-x: 1.25rem;
  --bs-gutter-y: 1.25rem;
  align-items: start;
}

/* Prevent flex/grid children from forcing horizontal overlap */
.tsc-content-row > [class*="col"] {
  min-width: 0;
  max-width: 100%;
}

.tsc-card,
.simitrans,
.tsc-prose {
  background: var(--tsc-surface);
  backdrop-filter: blur(6px);
  border: 1px solid var(--tsc-border);
  border-radius: var(--tsc-radius);
  box-shadow: var(--tsc-shadow);
  max-width: 100%;
  box-sizing: border-box;
}

.tsc-card,
.simitrans {
  padding: 1.25rem 1.35rem;
}

.tsc-prose {
  padding: 1.5rem;
  text-align: left;
  overflow-x: auto;
}

.tsc-prose img {
  max-width: 100%;
  height: auto;
  display: block;
}

.tsc-prose table {
  width: 100%;
  max-width: 100%;
}

/*
 * CMS county lists are wide HTML tables (one <td> per letter column).
 * Re-flow them into a responsive grid so they don't blow out the page column.
 */
.tsc-prose table.countylist,
.tsc-prose table.countylist > tbody {
  display: block;
  width: 100%;
}

.tsc-prose table.countylist > tbody > tr {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  width: 100%;
  box-sizing: border-box;
}

.tsc-prose table.countylist td {
  display: block;
  flex: 1 1 6.5rem;
  min-width: 0;
  max-width: 100%;
  width: auto !important;
  padding: 0;
  border: 0;
  background: transparent;
  vertical-align: top;
  box-sizing: border-box;
}

.tsc-prose table.countylist td[colspan] {
  flex: 1 1 100%;
  text-align: center;
  font-weight: 700;
  color: var(--tsc-navy);
  padding: 0.25rem 0 0.5rem;
}

.tsc-prose table.countylist ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tsc-prose table.countylist li {
  padding: 0.1rem 0;
}

.tsc-prose table.countylist a {
  color: var(--tsc-navy);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.tsc-prose table.countylist a:hover,
.tsc-prose table.countylist a.active:hover {
  color: var(--tsc-blue);
  text-decoration: underline;
}

.tsc-prose table.countylist a.inactive {
  color: var(--tsc-muted);
  font-weight: 500;
  pointer-events: none;
}

/* Map column: keep imagemap image within card */
.tsc-map-wrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-align: center;
}

.tsc-prose img[usemap],
.tsc-prose img[id="MSC"],
.tsc-prose img[id="GAC"],
.tsc-prose img.fr-dii {
  margin-left: auto;
  margin-right: auto;
  width: 100% !important;
  max-width: min(100%, 420px) !important;
  height: auto !important;
}

/* ---------- Mobile / narrow viewports (state pages especially) ---------- */
@media (max-width: 991.98px) {
  .tsc-prose {
    padding: 1rem;
  }

  .tsc-prose table.countylist td {
    flex: 1 1 5.5rem;
  }

  .tsc-content-row {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
  }
}

@media (max-width: 575.98px) {
  .tsc-main > .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .tsc-prose {
    padding: 0.85rem;
  }

  .tsc-prose table.countylist td {
    flex: 1 1 calc(50% - 0.5rem);
    max-width: calc(50% - 0.35rem);
  }

  .tsc-prose table.countylist a {
    font-size: 0.88rem;
    word-break: break-word;
  }

  .tsc-prose img[usemap],
  .tsc-prose img[id="MSC"],
  .tsc-prose img[id="GAC"],
  .tsc-prose img.fr-dii {
    max-width: 100% !important;
  }

  .tsc-subhead h2,
  .tsc-subhead h3 {
    font-size: 1.15rem;
    padding: 0 0.25rem;
  }

  .tsc-footer {
    font-size: 0.85rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* Legacy layout position classes from CMS (col1/col2) — do not float */
.tsc-prose.col1,
.tsc-prose.col2,
.tsc-prose.col3,
.tsc-prose.colfull {
  float: none !important;
  position: static !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  height: auto !important;
}

.tsc-footer {
  flex-shrink: 0;
  background: var(--tsc-surface-solid);
  border-top: 1px solid var(--tsc-border);
  color: var(--tsc-muted);
  font-size: 0.95rem;
}

.tsc-footer a {
  color: var(--tsc-blue);
  text-decoration: none;
  font-weight: 600;
}

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

/* County tool buttons (CMS HTML often uses tables) */
.tsc-county-tools table {
  margin: 0.75rem auto;
  border-collapse: separate;
  border-spacing: 0.5rem;
}

.tsc-county-tools td,
.tsc-county-tools th {
  border: 1px solid var(--tsc-border);
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--tsc-surface-solid);
  box-shadow: var(--tsc-shadow);
}

.tsc-county-tools td a,
.tsc-tool-btn {
  text-decoration: none;
  color: var(--tsc-navy);
  font-weight: 700;
  font-size: 0.95rem;
}

.tsc-county-tools td.active a,
.tsc-county-tools td:hover:not(:has(a.tsc-btn-disabled)):not(:has(a.inactive)) {
  background: #f0f3fb;
}

/* Unused / placeholder county tools (no real URL or handler) */
.tsc-county-tools a.inactive,
.tsc-county-tools a.tsc-btn-disabled,
.tsc-county-tools a[aria-disabled="true"] {
  color: #9aa3b5 !important;
  font-weight: 600;
  cursor: not-allowed;
  opacity: 0.72;
  text-decoration: none !important;
  pointer-events: none;
}

.tsc-county-tools td:has(a.tsc-btn-disabled),
.tsc-county-tools td:has(a.inactive),
.tsc-county-tools td:has(a[aria-disabled="true"]) {
  background: #eef1f6 !important;
  box-shadow: none;
  border-color: #d7dbe3;
}

.tsc-county-tools td:has(a.tsc-btn-disabled):hover,
.tsc-county-tools td:has(a.inactive):hover {
  background: #eef1f6 !important;
}

.tsc-office-panel h6 {
  color: var(--tsc-navy);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
}

/* Search / tool panels */
.tsc-tool-panel .form-label {
  font-weight: 600;
  color: var(--tsc-navy);
  margin-bottom: 0.25rem;
}

.tsc-results-wrap {
  overflow: auto;
  max-height: min(60vh, 32rem);
}

.tsc-results-table {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.tsc-results-table thead th {
  position: sticky;
  top: 0;
  background: #eef2fb;
  color: var(--tsc-navy);
  white-space: nowrap;
  z-index: 1;
}

.tsc-results-table tbody tr:hover {
  background: var(--tsc-blue-soft);
}

.tsc-empty-state {
  color: var(--tsc-muted);
  padding: 1.5rem;
  text-align: center;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex;
}

.tsc-modal .modal-header {
  border-bottom-color: var(--tsc-border);
}

.tsc-modal .modal-title {
  color: var(--tsc-navy);
  font-weight: 700;
}

.tsc-tip {
  font-size: 0.85rem;
  color: var(--tsc-muted);
  background: #fff7ed;
  border: 1px solid #fde6c8;
  border-radius: 0.5rem;
  padding: 0.65rem 0.85rem;
}

/* Tax estimator compact layout */
.tsc-estimator-grid .form-control,
.tsc-estimator-grid .form-select {
  max-width: 16rem;
}

/* Millage rates */
.tsc-millage-table thead th {
  background: #eef2fb;
  color: var(--tsc-navy);
  white-space: nowrap;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tsc-millage-total {
  color: var(--tsc-navy);
}

.tsc-millage-cards {
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.tsc-millage-card {
  background: var(--tsc-surface-solid);
  border: 1px solid var(--tsc-border);
  border-radius: var(--tsc-radius);
  box-shadow: var(--tsc-shadow);
  overflow: hidden;
  width: 100%;
}

.tsc-millage-table-wrap {
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}

.tsc-millage-card-head {
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, #f5f7fd, #eef2fb);
  border-bottom: 1px solid var(--tsc-border);
}

.tsc-millage-codes {
  color: #9a3412;
  font-weight: 600;
  margin-top: 0.2rem;
}

.tsc-millage-card table th {
  font-weight: 600;
  color: var(--tsc-muted);
  width: 55%;
}

.tsc-millage-card .tsc-millage-total-row th,
.tsc-millage-card .tsc-millage-total-row td {
  background: #fff7ed;
  color: var(--tsc-navy);
  border-top: 1px solid #fde6c8;
}

.tsc-millage-card table {
  margin: 0;
}

.tsc-millage-card table th,
.tsc-millage-card table td {
  padding: 0.55rem 1rem;
}

@media (max-width: 575.98px) {
  .tsc-millage-table thead {
    display: none;
  }

  .tsc-millage-table tbody tr {
    display: block;
    border: 1px solid var(--tsc-border);
    border-radius: 0.5rem;
    margin-bottom: 0.65rem;
    padding: 0.35rem 0.5rem;
    background: #fff;
  }

  .tsc-millage-table tbody td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: 0 !important;
    padding: 0.35rem 0.25rem !important;
    text-align: right !important;
  }

  .tsc-millage-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--tsc-muted);
    text-align: left;
  }
}
