/* =========================================================
   Minya Landfill — Modern Professional UI
   Screen styles only. Print reports use their own isolated CSS.
========================================================= */

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-accent: #eef6f2;
  --border: #dfe6ee;
  --border-strong: #cbd5e1;
  --text: #17212b;
  --muted: #667085;
  --primary: #176b4f;
  --primary-dark: #10513c;
  --primary-soft: #e8f4ef;
  --blue: #2563eb;
  --danger: #b42318;
  --danger-dark: #8f1c14;
  --warning: #b7791f;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 18px 40px rgba(16, 24, 40, 0.11);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --transition: 160ms ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(23, 107, 79, 0.07), transparent 32%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
  direction: rtl;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

/* =========================================================
   Top header
========================================================= */

.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(16px, 4vw, 44px);
  color: #fff;
  background: linear-gradient(135deg, #0e4635 0%, #176b4f 52%, #1f7a5d 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 30px rgba(14, 70, 53, 0.20);
  backdrop-filter: blur(10px);
}

.top-header > div {
  min-width: 0;
}

.top-header h1 {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 29px);
  font-weight: 800;
  letter-spacing: -0.3px;
}

.top-header p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.top-header nav {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.top-header nav button {
  min-height: 42px;
  padding: 9px 16px;
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: transform var(--transition), background var(--transition), border-color var(--transition);
}

.top-header nav button:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.42);
  transform: translateY(-1px);
}

.top-header nav button:active {
  transform: translateY(0);
}

/* =========================================================
   Main shell
========================================================= */

.container {
  width: min(1480px, calc(100% - 28px));
  margin: 26px auto 52px;
}

.message {
  min-height: 0;
  margin-bottom: 14px;
  padding: 0;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
  transition: all var(--transition);
}

.message:not(:empty) {
  padding: 11px 14px;
  background: var(--primary-soft);
  border: 1px solid #c9e4d8;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.panel {
  margin-bottom: 18px;
  padding: clamp(16px, 2.2vw, 24px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.panel > h2 {
  position: relative;
  margin: 0 0 18px;
  padding-right: 14px;
  font-size: 18px;
  font-weight: 800;
  color: #24323d;
}

.panel > h2::before {
  content: "";
  position: absolute;
  right: 0;
  top: 3px;
  width: 5px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), #3ca17b);
}

/* =========================================================
   Forms
========================================================= */

.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 13px;
}

label {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 6px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input,
select {
  min-height: 42px;
  padding: 9px 11px;
}

textarea {
  min-height: 112px;
  padding: 11px 12px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aebccc;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #4f9d7d;
  box-shadow: 0 0 0 4px rgba(23, 107, 79, 0.11);
}

/* =========================================================
   Tables
========================================================= */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

th,
td {
  padding: 11px 10px;
  text-align: center;
  vertical-align: middle;
  border-left: 1px solid #edf1f5;
  border-bottom: 1px solid #edf1f5;
  font-size: 13px;
}

th:last-child,
td:last-child {
  border-left: 0;
}

thead th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: #fbfdfc;
}

td input,
td select {
  min-height: 37px;
  margin: 0;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 12px;
}

/* =========================================================
   Buttons & actions
========================================================= */

.actions,
.monthly-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

button {
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition), background var(--transition);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

#saveBtn,
#printMonthlyReportBtn,
#exportMonthlyCsvBtn,
#exportAnnualCsvBtn,
#printAnnualReportBtn {
  min-height: 44px;
  padding: 10px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 6px 16px rgba(23, 107, 79, 0.20);
  font-weight: 800;
}

#saveBtn:hover,
#printMonthlyReportBtn:hover,
#exportMonthlyCsvBtn:hover,
#exportAnnualCsvBtn:hover,
#printAnnualReportBtn:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 20px rgba(23, 107, 79, 0.27);
}

#archiveTable button {
  margin: 2px;
  padding: 7px 10px;
  background: #edf2f7;
  color: #344054;
  border: 1px solid #d8e0e8;
  font-size: 12px;
  font-weight: 700;
}

#archiveTable button:hover {
  background: #e4ebf2;
}

#archiveTable button[style*="#b91c1c"] {
  color: #fff !important;
  background: linear-gradient(135deg, var(--danger-dark), var(--danger)) !important;
  border-color: transparent !important;
}

/* =========================================================
   Daily / archive / monthly cards
========================================================= */

.daily-summary,
.archive-summary,
.monthly-summary {
  display: grid;
  gap: 12px;
}

.daily-summary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.archive-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.monthly-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.daily-summary > div,
.archive-summary > div,
.monthly-summary > div {
  position: relative;
  min-height: 96px;
  padding: 15px 12px !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: linear-gradient(180deg, #fff 0%, #fbfcfd 100%) !important;
  border: 1px solid var(--border) !important;
  border-radius: 13px !important;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.daily-summary > div::after,
.archive-summary > div::after,
.monthly-summary > div::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #1f7a5d, #68b99b);
}

.daily-summary span,
.archive-summary span,
.monthly-summary span {
  margin-bottom: 6px !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  font-weight: 700;
}

.daily-summary strong,
.archive-summary strong,
.monthly-summary strong {
  color: #1f2937 !important;
  font-size: clamp(18px, 2vw, 23px) !important;
  font-weight: 800;
}

.daily-summary small,
.archive-summary small,
.monthly-summary small {
  margin-top: 3px !important;
  color: #8993a4 !important;
  font-size: 10px !important;
}

/* =========================================================
   Archive filters
========================================================= */

.archive-filters {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto !important;
  gap: 12px !important;
  align-items: end !important;
  margin: 4px 0 18px !important;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.archive-filters label {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
}

.archive-filters input {
  width: 100% !important;
}

#clearArchiveFiltersBtn {
  min-height: 42px;
  height: auto !important;
  padding: 9px 16px !important;
  color: #475467;
  background: #fff;
  border: 1px solid var(--border-strong);
  font-weight: 700;
}

#clearArchiveFiltersBtn:hover {
  background: #f8fafc;
}

/* =========================================================
   Monthly / annual blocks
========================================================= */

.monthly-report {
  margin-top: 26px !important;
  padding-top: 22px !important;
  border-top: 1px solid var(--border) !important;
}

.monthly-report h3,
#annualSummarySection h3 {
  margin-bottom: 18px !important;
  color: #22313c;
  font-size: 20px !important;
  font-weight: 800;
}

.monthly-comparison,
.monthly-chart,
#annualSummarySection {
  border-color: var(--border) !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow-sm);
}

.monthly-comparison {
  background: linear-gradient(180deg, #fbfcfd, #f7faf9) !important;
}

.monthly-comparison-grid > div {
  border-radius: 11px !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-sm);
}

.monthly-chart {
  overflow: hidden;
  background: linear-gradient(180deg, #fff, #fbfcfd) !important;
}

.monthly-chart-bar {
  background: linear-gradient(180deg, #2b8a68 0%, #176b4f 100%) !important;
  box-shadow: 0 2px 5px rgba(23, 107, 79, 0.18);
}

#monthlyChartMetricSwitcher button {
  min-width: 90px;
  background: #fff !important;
  color: #344054;
  border-color: var(--border-strong) !important;
}

#monthlyChartMetricSwitcher button:hover {
  background: var(--primary-soft) !important;
}

#annualSummarySection {
  padding: 20px !important;
  background: linear-gradient(180deg, #fff 0%, #fbfcfd 100%);
}

#annualSummarySection select {
  min-width: 150px;
}

#annualSummaryCards > div,
#annualInsightsCards > div,
#annualComparisonGrid > div {
  border-color: var(--border) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-sm);
}

/* =========================================================
   Accessibility / polish
========================================================= */

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

::selection {
  background: rgba(23, 107, 79, 0.20);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #edf1f5;
}

::-webkit-scrollbar-thumb {
  background: #b9c4cf;
  border: 2px solid #edf1f5;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9eabb8;
}

/* =========================================================
   Responsive
========================================================= */

@media (max-width: 1180px) {
  .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .daily-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .archive-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #clearArchiveFiltersBtn {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .top-header {
    position: relative;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-header nav {
    width: 100%;
  }

  .top-header nav button {
    flex: 1;
  }

  .container {
    width: min(100% - 20px, 1480px);
    margin-top: 14px;
  }

  .panel {
    padding: 15px;
    border-radius: 14px;
  }

  .form-grid,
  .archive-summary,
  .monthly-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .daily-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel {
    overflow-x: auto;
  }

  table {
    min-width: 720px;
  }

  #archiveTable {
    min-width: 860px;
  }
}

@media (max-width: 540px) {
  .top-header {
    padding: 14px 12px;
  }

  .top-header h1 {
    font-size: 20px;
  }

  .top-header p {
    font-size: 12px;
  }

  .form-grid,
  .archive-filters,
  .archive-summary,
  .monthly-summary,
  .daily-summary {
    grid-template-columns: 1fr !important;
  }

  .panel {
    padding: 13px;
  }

  .panel > h2 {
    font-size: 16px;
  }

  .daily-summary > div,
  .archive-summary > div,
  .monthly-summary > div {
    min-height: 82px;
  }
}

/* Keep browser screen styles out of isolated print report windows. */
@media print {
  .top-header,
  .container {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
