/* VPZ Housing — Clean layout */

/* ===== Layout ===== */
:root {
  --site-max-width: 1100px;
}

.container {
  max-width: var(--site-max-width) !important;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.site-header {
  background: var(--pico-card-background-color, #fff);
  border-bottom: 1px solid var(--pico-muted-border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header nav {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.site-header nav ul {
  margin: 0;
  gap: 0.25rem;
}

.site-header nav a {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
}

.site-header nav a:hover {
  background: var(--pico-secondary-focus);
}

.brand {
  text-decoration: none !important;
}

.nav-user {
  color: var(--pico-muted-color);
  font-size: 0.82rem;
}

.nav-logout {
  font-size: 0.82rem !important;
  color: var(--pico-muted-color) !important;
}

.site-main {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  min-height: calc(100vh - 200px);
}

.site-footer {
  text-align: center;
  padding: 1.5rem 0;
  border-top: 1px solid var(--pico-muted-border-color);
}

/* ===== Login ===== */
.login-container {
  max-width: 26rem;
  margin: 4rem auto;
}

/* ===== Typography ===== */
.muted { color: var(--pico-muted-color); font-size: 0.9em; }

h1 { font-size: 1.6rem; margin-bottom: 1rem; }
h3 { font-size: 1.15rem; margin-top: 1.5rem; }

/* ===== Flash messages ===== */
.flash {
  margin: 0 0 1rem 0;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.9rem;
}
.flash-success { background: #e7f6ec; color: #1d6f3a; border-color: #b3e0c1; }
.flash-error { background: #fde7e9; color: #9b1c2c; border-color: #f5b5bb; }
.flash-info { background: #e7f0fb; color: #1c4f86; border-color: #b8d2ee; }

/* ===== Stat cards ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}
.stat-card {
  padding: 0.75rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 10px;
  text-align: center;
  background: var(--pico-card-background-color, #fff);
}
.stat-card .value { font-size: 1.6rem; font-weight: 700; display: block; line-height: 1.2; }
.stat-card .label { color: var(--pico-muted-color); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* ===== Tables ===== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.5rem 0 1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 10px;
}

table {
  font-size: 0.88rem;
  margin: 0;
  border-collapse: collapse;
  width: 100%;
}

table th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--pico-muted-color);
  background: var(--pico-card-background-color, #fafafa);
  position: sticky;
  top: 0;
}

table th, table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

table tbody tr:last-child td {
  border-bottom: none;
}

table tbody tr:hover {
  background: var(--pico-secondary-focus);
}

table td.actions {
  text-align: right;
  white-space: nowrap;
}

table td.actions a {
  font-size: 0.82rem;
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-unpaid { background: #fff3cd; color: #856404; border-color: #ffeeba; }
.badge-receipt_uploaded { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.badge-verified { background: #cce5ff; color: #004085; border-color: #b8daff; }
.badge-overdue { background: #dc3545 !important; color: white !important; font-weight: bold; }
.badge-unmatched { background: #fce4ec; color: #880e4f; border-color: #f8bbd0; }

/* ===== Cards / Details ===== */
details.card {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: var(--pico-card-background-color, #fff);
}

details.card summary {
  cursor: pointer;
}

/* ===== Forms / Toolbar ===== */
.toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.toolbar label { margin: 0; font-size: 0.88rem; }
.toolbar select, .toolbar input { font-size: 0.88rem; }

/* ===== Alert banner ===== */
.alert-overdue {
  background: #dc3545;
  color: white;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
}
.alert-overdue h3 { color: white; margin: 0 0 0.4rem; font-size: 1.1rem; }
.alert-overdue p { margin: 0.2rem 0; }
.alert-overdue a { color: white !important; text-decoration: underline; font-weight: 600; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0 0.5rem;
  font-size: 0.88rem;
}
.pagination a, .pagination span {
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
}
.pagination a {
  border: 1px solid var(--pico-muted-border-color);
}
.pagination a:hover {
  background: var(--pico-secondary-focus);
}
.pagination .current {
  background: var(--pico-primary-background);
  color: white;
  border: 1px solid transparent;
}
.pagination .disabled {
  color: var(--pico-muted-color);
}

/* ===== Grid layout helpers ===== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}



/* ===== Summary table ===== */
.summary-table { width: 100%; font-size: 0.82rem; }
.summary-table th, .summary-table td { text-align: right; padding: 0.3rem 0.5rem; white-space: nowrap; }
.summary-table th:first-child, .summary-table td:first-child { text-align: left; min-width: 200px; }
.summary-cell { font-variant-numeric: tabular-nums; border-radius: 4px; padding: 0.15rem 0.4rem; }
.summary-paid { background: #d4edda; color: #155724; }
.summary-partial { background: #fff3cd; color: #856404; }
.summary-overdue { background: #f8d7da; color: #721c24; font-weight: 600; }
.summary-empty { color: var(--pico-muted-color); }
.summary-total { background: var(--pico-card-background-color, #f1f1f1); font-weight: 600; }
.summary-table tfoot th { background: var(--pico-card-background-color, #f1f1f1); }

/* ===== Chart container ===== */
.chart-container {
  max-width: 100%;
  padding: 1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 10px;
  background: var(--pico-card-background-color, #fff);
  margin: 1rem 0;
}

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

/* Hamburger toggle (hidden on desktop) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

@media (max-width: 768px) {
  /* Nav becomes vertical on mobile */
  .site-header nav {
    flex-wrap: wrap;
    padding: 0.5rem 0;
  }

  .site-header nav > ul:first-child {
    width: 100%;
    justify-content: space-between;
  }

  .nav-toggle {
    display: inline-block;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0 0;
    border-top: 1px solid var(--pico-muted-border-color);
    margin-top: 0.25rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a, .nav-links span {
    display: block;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.9rem !important;
    border-radius: 6px;
  }

  .nav-links a:hover {
    background: var(--pico-secondary-focus);
  }

  /* Layout */
  .site-main {
    padding-top: 1rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  h1 { font-size: 1.3rem; }
  h3 { font-size: 1.05rem; }

  /* Stat grid */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .stat-card { padding: 0.5rem; }
  .stat-card .value { font-size: 1.3rem; }
  .stat-card .label { font-size: 0.72rem; }

  /* Tables — let them scroll */
  .table-wrapper {
    margin: 0.5rem -0.75rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  table { font-size: 0.82rem; }
  table th, table td { padding: 0.4rem 0.5rem; }

  /* Grid layouts */
  .grid, .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  /* Forms */
  details.card { padding: 0.5rem 0.75rem; }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar label { margin-bottom: 0.25rem; }

  /* Buttons — more touch-friendly */
  button, [role="button"], input[type="submit"] {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  /* Alert banner */
  .alert-overdue {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    border-radius: 0;
    padding: 0.75rem 1rem;
  }

  /* Pagination */
  .pagination {
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .pagination a, .pagination span {
    padding: 0.4rem 0.6rem;
    font-size: 0.82rem;
  }

  /* Summary table */
  .summary-table { font-size: 0.75rem; }
  .summary-table th, .summary-table td { padding: 0.25rem 0.35rem; }

  /* Chart */
  .chart-container { padding: 0.5rem; }

  /* Footer */
  .site-footer { padding: 1rem 0; }
}

/* Small phones */
@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat-card .value { font-size: 1.1rem; }

  .site-header nav a { font-size: 0.85rem !important; }

  table { font-size: 0.78rem; }
  table th, table td { padding: 0.3rem 0.4rem; }

  /* Hide less important columns on very small screens */
  .hide-mobile { display: none; }
}

/* Print styles */
@media print {
  .site-header, .site-footer, .nav-toggle, .pagination, .no-print { display: none !important; }
  .site-main { padding: 0; }
  .container { max-width: 100% !important; }
  table { font-size: 0.8rem; }
}
