/**
 * css/tax-calculator.css
 * Town of Caledon — Property Tax Calculator
 * Loaded only on the calculator page via toc/tax-calculator library.
 */

/* ── Form layout ─────────────────────────────────────────────────────────── */
.calc-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 20px;
}

.calc-label {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--brand-text, #1d2b36);
  display: block;
}

.calc-req {
  color: #c0392b;
}

.calc-hint {
  font-size: 0.85rem;
  color: var(--brand-muted, #5b6770);
  margin-top: 4px;
  display: block;
}

/* Select wrapper */
.calc-select-wrap {
  position: relative;
  max-width: 480px;
  width: 100%;
}

.calc-select-wrap select {
  width: 100%;
  border: 2px solid #d0dae3 !important;
  border-radius: var(--radius) !important;
  min-height: 48px !important;
  padding: 12px 40px 12px 16px !important;
  font-size: 1rem;
  font-family: inherit;
  color: var(--brand-text, #1d2b36);
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.calc-select-wrap select:focus {
  border-color: #000000 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05) !important;
}

.calc-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--brand-muted, #6b7280);
  display: flex;
  align-items: center;
}

/* Text input */
.calc-input {
  max-width: 480px;
  width: 100%;
  border: 2px solid #d0dae3 !important;
  border-radius: var(--radius) !important;
  min-height: 48px !important;
  padding: 12px 16px !important;
  font-size: 1rem;
  font-family: inherit;
  color: var(--brand-text, #1d2b36);
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.calc-input:focus {
  border-color: #000000 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05) !important;
}

/* Actions row */
.calc-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

/* Error box */
.calc-error {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #fdf0ef;
  border: 1px solid #e8b4b0;
  border-radius: var(--radius);
  color: #c0392b;
  font-size: .9rem;
}

/* ── Results section ─────────────────────────────────────────────────────── */
.calc-divider {
  border: none;
  border-top: 1px solid var(--border, #e0e0e0);
  margin: 28px 0;
}

.calc-section-title {
  font-size: 1.8rem;
  color: var(--brand-blue-dark, #154d8e);
  margin: 0 0 12px;
}

.calc-intro {
  margin-bottom: 20px;
  font-size: 1rem;
  color: var(--brand-text, #1a1a1a);
}

.calc-muted {
  color: var(--brand-muted, #6b7280);
  font-size: .85rem;
  font-weight: normal;
}

/* ── Donut chart layout ──────────────────────────────────────────────────── */
.chart-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin: 24px 0 32px;
}

.chart-container {
  position: relative;
  width: 260px;
  height: 260px;
  flex-shrink: 0;
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 450px;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s ease;
  font-size: .9rem;
  color: var(--brand-text, #1a1a1a);
  cursor: default;
}

.legend-label-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color-box {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-value-group {
  text-align: right;
  font-weight: 500;
  white-space: nowrap;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .chart-layout {
    flex-direction: column;
    gap: 24px;
  }
  .chart-container {
    width: 220px;
    height: 220px;
  }
}

@media (max-width: 650px) {
  .calc-actions {
    flex-wrap: wrap;
  }
}

/* Large text size overrides (accessibility toggles) */
body.text-large .calc-actions,
body.text-xlarge .calc-actions {
  flex-wrap: wrap;
}

/* ── Tax Calculator Plain Table Style (Strictly Scoped to #tax-calculator-app) ── */

#tax-calculator-app .tbl-wrap--plain {
  border: none !important;
  box-shadow: none !important;
  border-radius: var(--radius, 10px) !important;
  overflow-x: auto !important;
}

#tax-calculator-app table.calc-table--plain,
#tax-calculator-app table#resultsTable,
#tax-calculator-app table#townTable {
  width: 100% !important;
  min-width: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: 1px solid #000000 !important;
  border-radius: var(--radius, 10px) !important;
  overflow: hidden !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  margin-bottom: 24px !important;
  box-shadow: none !important;
}

/* Unique accessibility class: retains column headers for screen readers without visual rendering */
#tax-calculator-app table.calc-table--plain thead.calc-thead-accessible,
#tax-calculator-app table#resultsTable thead.calc-thead-accessible,
#tax-calculator-app table#townTable thead.calc-thead-accessible {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* White background, black borders, black text, and uniform typography for all cells */
#tax-calculator-app table.calc-table--plain tr,
#tax-calculator-app table.calc-table--plain th,
#tax-calculator-app table.calc-table--plain td,
#tax-calculator-app table#resultsTable tr,
#tax-calculator-app table#resultsTable th,
#tax-calculator-app table#resultsTable td,
#tax-calculator-app table#townTable tr,
#tax-calculator-app table#townTable th,
#tax-calculator-app table#townTable td {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border: none !important;
  border-bottom: 1px solid #000000 !important;
  border-right: 1px solid #000000 !important;
  color: #000000 !important;
  font-size: 1rem !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  padding: 12px 18px !important;
  text-align: left;
  vertical-align: middle;
}

/* Numeric/amount column right alignment & remove right border on the last column */
#tax-calculator-app table.calc-table--plain td:last-child,
#tax-calculator-app table.calc-table--plain th:last-child,
#tax-calculator-app table#resultsTable td:last-child,
#tax-calculator-app table#resultsTable th:last-child,
#tax-calculator-app table#townTable td:last-child,
#tax-calculator-app table#townTable th:last-child {
  border-right: none !important;
  text-align: right !important;
}

/* Remove bottom border on the last row */
#tax-calculator-app table.calc-table--plain tbody tr:last-child td,
#tax-calculator-app table#resultsTable tbody tr:last-child td,
#tax-calculator-app table#townTable tbody tr:last-child td {
  border-bottom: none !important;
}

/* Rounded corners for the four outer corners (top/bottom left/right) */
#tax-calculator-app table.calc-table--plain tbody tr:first-child td:first-child,
#tax-calculator-app table#resultsTable tbody tr:first-child td:first-child,
#tax-calculator-app table#townTable tbody tr:first-child td:first-child {
  border-top-left-radius: calc(var(--radius, 10px) - 1px) !important;
}

#tax-calculator-app table.calc-table--plain tbody tr:first-child td:last-child,
#tax-calculator-app table#resultsTable tbody tr:first-child td:last-child,
#tax-calculator-app table#townTable tbody tr:first-child td:last-child {
  border-top-right-radius: calc(var(--radius, 10px) - 1px) !important;
}

#tax-calculator-app table.calc-table--plain tbody tr:last-child td:first-child,
#tax-calculator-app table#resultsTable tbody tr:last-child td:first-child,
#tax-calculator-app table#townTable tbody tr:last-child td:first-child {
  border-bottom-left-radius: calc(var(--radius, 10px) - 1px) !important;
}

#tax-calculator-app table.calc-table--plain tbody tr:last-child td:last-child,
#tax-calculator-app table#resultsTable tbody tr:last-child td:last-child,
#tax-calculator-app table#townTable tbody tr:last-child td:last-child {
  border-bottom-right-radius: calc(var(--radius, 10px) - 1px) !important;
}

/* Prevent zebra striping and hover background changes across all rows */
#tax-calculator-app table.calc-table--plain tbody tr,
#tax-calculator-app table.calc-table--plain tbody tr:nth-child(odd),
#tax-calculator-app table.calc-table--plain tbody tr:nth-child(even),
#tax-calculator-app table#resultsTable tbody tr,
#tax-calculator-app table#resultsTable tbody tr:nth-child(odd),
#tax-calculator-app table#resultsTable tbody tr:nth-child(even),
#tax-calculator-app table#townTable tbody tr,
#tax-calculator-app table#townTable tbody tr:nth-child(odd),
#tax-calculator-app table#townTable tbody tr:nth-child(even) {
  background: #ffffff !important;
  background-color: #ffffff !important;
}

/* Ensure consistent font size, weight, and black text for all nested child elements */
#tax-calculator-app table.calc-table--plain td *,
#tax-calculator-app table.calc-table--plain th *,
#tax-calculator-app table#resultsTable td *,
#tax-calculator-app table#resultsTable th *,
#tax-calculator-app table#townTable td *,
#tax-calculator-app table#townTable th * {
  color: #000000 !important;
  font-size: 1rem !important;
  font-weight: 400 !important;
}

#tax-calculator-app table.calc-table--plain .calc-table-share,
#tax-calculator-app table#resultsTable .calc-table-share,
#tax-calculator-app table#townTable .calc-table-share,
#tax-calculator-app table#townTable .calc-muted {
  color: #000000 !important;
  font-size: 0.95rem !important;
  font-weight: 400 !important;
}
