/* Modern NewingtonWeather styling for wxtempdetail.php.
   Loaded after wxreports.css so the legacy report logic/colors remain intact. */

#main-copy {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 28px 0 40px;
  box-sizing: border-box;
}

.nw-page-shell {
  width: calc(100% - 48px);
  max-width: 1680px;
  margin: 0 auto;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--nw-body-text);
  padding: 0;
}

.nw-panel {
  background: var(--nw-card-bg);
  border: 1px solid var(--nw-card-border);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--nw-card-shadow);
}

.nw-temp-panel-head {
  min-height: 48px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(90deg, var(--nw-section-head-top) 0%, var(--nw-section-head-bottom) 100%);
  color: var(--nw-on-primary);
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
  box-sizing: border-box;
}

.nw-temp-title {
  margin: 0 !important;
  padding: 0 !important;
  color: var(--nw-on-primary) !important;
  background: none !important;
  border: 0 !important;
  font-size: 24px !important;
}

.nw-temp-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.nw-temp-live i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nw-live);
  box-shadow: var(--nw-live-glow);
}

.nw-panel-subtitle {
  padding: 13px 18px;
  background: var(--nw-card-bg);
  border-bottom: 1px solid var(--nw-divider);
  color: var(--nw-muted);
  font-size: 14px;
}

.nw-panel-body {
  padding: 18px;
  background: var(--nw-soft-bg);
}

#report {
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  background: var(--nw-card-bg);
  border: 1px solid var(--nw-card-border);
  border-radius: 13px;
  box-sizing: border-box;
  overflow-x: auto;
}

#report h1 {
  margin: 0 0 4px;
  color: var(--nw-primary-dark);
  font-size: 23px;
  line-height: 1.2;
}

#report h3 {
  margin: 0;
  color: var(--nw-body-text);
  font-size: 14px;
}

/* Center and modernize the year selector + report navigation area. */
#report .getreportdtbx {
  float: none !important;
  width: min(100%, 1040px) !important;
  max-width: 1040px;
  margin: 16px auto 18px !important;
  padding: 14px 16px !important;
  text-align: center !important;
  background: var(--nw-soft-bg);
  border: 1px solid var(--nw-card-border);
  border-radius: 10px;
  box-sizing: border-box;
}

#report .getreportdtbx form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 10px;
}

#report select,
#report input[type="submit"],
#report input[type="button"],
#report button {
  min-height: 30px;
  border-radius: 7px;
  border: 1px solid var(--nw-card-border);
  box-sizing: border-box;
}

#report select {
  background: var(--nw-card-bg);
  padding: 3px 8px;
  color: var(--nw-body-text);
}

#report input[type="submit"],
#report input[type="button"],
#report button {
  padding: 4px 11px;
  background: var(--nw-primary);
  border-color: var(--nw-primary);
  color: var(--nw-on-primary);
  font-weight: 700;
  cursor: pointer;
}

/* The report's generated tables should span the content area cleanly. */
#report > table {
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  border-collapse: collapse;
  table-layout: fixed;
}

/* Keep the color-key table centered instead of stuck to the left. */
#report > table + table {
  width: min(100%, 1080px) !important;
  margin: 16px auto 0 !important;
  table-layout: auto;
}

#report .labels,
#report .colorband {
  background: var(--nw-table-head) !important;
  color: var(--nw-on-primary) !important;
  font-weight: 700;
}

#report .colorband {
  text-align: center !important;
  padding: 8px !important;
}

#report td,
#report th {
  text-align: center;
  vertical-align: middle;
}

#report .dev {
  text-align: center !important;
  margin: 10px auto 0 !important;
  color: var(--nw-muted);
  font-size: 11px;
}

/* wxreportinclude.php commonly emits buttons/links directly in the selector box. */
#report .getreportdtbx a {
  display: inline-block;
  margin: 3px 2px;
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--nw-primary);
  color: var(--nw-on-primary) !important;
  text-decoration: none;
  font-weight: 700;
}

#report .getreportdtbx a:hover,
#report input[type="submit"]:hover,
#report input[type="button"]:hover,
#report button:hover {
  background: var(--nw-primary-hover);
  border-color: var(--nw-primary-hover);
}

@media (max-width: 900px) {
  .nw-page-shell { width: calc(100% - 20px); }
  .nw-temp-title { font-size: 20px !important; }
  .nw-panel-body { padding: 10px; }
  #report { padding: 10px; }
  .nw-temp-live { font-size: 10px; }
}


/* =========================================================
   Compact report controls
   ========================================================= */
.temp-report-controls,
.wx-report-controls,
.report-controls {
    padding: 14px 20px !important;
    margin-top: 18px !important;
    margin-bottom: 18px !important;
    min-height: 0 !important;
}

.temp-report-controls form,
.wx-report-controls form,
.report-controls form {
    margin: 0 !important;
}

.temp-report-controls .report-mode-row,
.temp-report-controls .report-nav-row,
.temp-report-controls .report-buttons,
.wx-report-controls .report-mode-row,
.wx-report-controls .report-nav-row,
.wx-report-controls .report-buttons,
.report-controls .report-mode-row,
.report-controls .report-nav-row,
.report-controls .report-buttons {
    margin-top: 8px !important;
    margin-bottom: 8px !important;
    gap: 8px !important;
}

/* Catch the legacy centered control area even if it has no helper class. */
.temp-report-modern .report-control-panel,
.temperature-modern .report-control-panel,
#report-control-panel {
    padding: 14px 20px !important;
    min-height: 0 !important;
}

/* Keep buttons tidy and consistent. */
.temp-report-controls input[type="submit"],
.temp-report-controls input[type="button"],
.temp-report-controls button,
.temp-report-controls select,
.wx-report-controls input[type="submit"],
.wx-report-controls input[type="button"],
.wx-report-controls button,
.wx-report-controls select {
    margin-top: 2px !important;
    margin-bottom: 2px !important;
}


/* Compact the daily temperature grid.
   The legacy report uses .reportdt for the Day cells; :has() scopes these
   rules to only the 31 daily rows, leaving month headers and summary rows alone. */
#report table tr:has(> td.reportdt) > td {
  height: 22px !important;
  min-height: 22px !important;
  padding-top: 1px !important;
  padding-bottom: 1px !important;
  line-height: 18px !important;
  font-size: 11px !important;
}
#report table tr:has(> td.reportdt) > td.reportdt {
  font-weight: 700 !important;
  line-height: 18px !important;
}

/* Fallback/extra tightening for browsers and legacy wxreports rules. */
#report td.reportdt {
  height: 22px !important;
  padding-top: 1px !important;
  padding-bottom: 1px !important;
  line-height: 18px !important;
  font-size: 11px !important;
}


/* Force the Day column to stay narrow.
   The old report mixed percentage widths on rowspan/colspan headers, which
   caused browsers to give the first column far more space than requested. */
#report > table:first-of-type th.daycol,
#report > table:first-of-type td.reportdt {
  width: 3% !important;
  min-width: 34px !important;
  max-width: 52px !important;
}
#report > table:first-of-type th.daycol {
  padding-left: 4px !important;
  padding-right: 4px !important;
}


/* Fit the full 12-month report inside the page on desktop. */
#report {
  overflow-x: hidden !important;
}
#report > table:first-of-type {
  width: 100% !important;
  table-layout: fixed !important;
  font-size: 10px !important;
}
#report > table:first-of-type th,
#report > table:first-of-type td {
  padding-left: 2px !important;
  padding-right: 2px !important;
  white-space: nowrap !important;
}

/* The Day column only needs enough room for 1-31. */
#report > table:first-of-type th.daycol,
#report > table:first-of-type td.reportdt {
  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  padding-left: 1px !important;
  padding-right: 1px !important;
}

/* Let all month/data columns divide the remaining width evenly. */
#report > table:first-of-type th.labels:not(.daycol),
#report > table:first-of-type td:not(.reportdt) {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
}

/* Slightly smaller text in the dense data grid so all 12 months fit. */
#report > table:first-of-type td {
  font-size: 9px !important;
}
#report > table:first-of-type th {
  font-size: 10px !important;
}

/* On narrower screens, keep the table usable instead of forcing the whole
   site wider than the browser window. */
@media (max-width: 1200px) {
  #report > table:first-of-type td { font-size: 8px !important; }
  #report > table:first-of-type th { font-size: 9px !important; }
  #report > table:first-of-type th.daycol,
  #report > table:first-of-type td.reportdt {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
  }
}
