/* ============================================================
   Calamba Water District – Global Styles
   ============================================================ */
:root {
  --primary: #0d6efd;
  --primary-dark: #0a58ca;
  --primary-light: #dbeafe;
  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #0dcaf0;
  --sidebar-width: 260px;
  --sidebar-bg: #0f172a;
  --sidebar-hover: rgba(255, 255, 255, .07);
  --sidebar-active: rgba(13, 110, 253, .35);
  --header-height: 64px;
  --body-bg: #f1f5f9;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .05);
  --radius: 12px;
  --transition: .2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--body-bg);
  color: #1e293b;
  font-size: .9rem;
  line-height: 1.6;
}

/* ---- Sidebar ---- */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

#sidebar::-webkit-scrollbar {
  width: 4px;
}

#sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .15);
  border-radius: 4px;
}

.sidebar-brand {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.sidebar-brand .brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  color: #fff;
}

.sidebar-brand-text strong {
  display: block;
  font-size: .95rem;
  font-weight: 700;
}

.sidebar-brand-text small {
  font-size: .72rem;
  color: rgba(255, 255, 255, .5);
}

.sidebar-section {
  padding: 18px 14px 4px;
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .35);
  text-transform: uppercase;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  margin: 2px 10px;
  border-radius: 9px;
  color: rgba(255, 255, 255, .65);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--sidebar-active);
  color: #fff;
}

.sidebar-nav a i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .06);
  border-radius: 10px;
}

.sidebar-user .avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: .85rem;
  flex-shrink: 0;
}

.sidebar-user-info strong {
  display: block;
  font-size: .82rem;
  color: #fff;
}

.sidebar-user-info small {
  font-size: .72rem;
  color: rgba(255, 255, 255, .45);
}

/* ---- Main Content ---- */
#main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition);
}

/* ---- Top Header ---- */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
}

.top-header h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

/* ---- Page Content ---- */
.page-content {
  padding: 24px;
}

/* ---- Summary Cards ---- */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, .1);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-body {
  flex: 1;
  min-width: 0;
}

.stat-body .label {
  font-size: .8rem;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 2px;
}

.stat-body .value {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
  color: #0f172a;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-all;
}

.stat-body .sub {
  font-size: .75rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* ---- Charts ---- */
.chart-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--card-shadow);
}

.chart-card .chart-title {
  font-size: .9rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-wrapper {
  position: relative;
}

/* ---- Tables ---- */
.table-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.table-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.table-card-header h6 {
  margin: 0;
  font-weight: 700;
  font-size: .9rem;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.table {
  margin: 0;
  font-size: .85rem;
}

table.table thead th {
  background: #f8fafc;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  white-space: nowrap;
  border-bottom: 1px solid #e2e8f0;
  padding: 11px 14px;
}

table.table tbody td {
  padding: 11px 14px;
  vertical-align: middle;
}

table.table tbody tr:hover {
  background: #f8fafc;
}

/* ---- Badges ---- */
.badge {
  font-size: .72rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 20px;
}

/* ---- Buttons ---- */
.btn {
  border-radius: 8px;
  font-weight: 500;
  font-size: .875rem;
}

.btn-sm {
  font-size: .78rem;
  padding: 4px 10px;
  border-radius: 7px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* ---- Forms ---- */
.form-control,
.form-select {
  border-radius: 9px;
  border: 1.5px solid #e5e7eb;
  font-size: .875rem;
  padding: 9px 13px;
  transition: border-color .2s, box-shadow .2s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .12);
}

.modal-content {
  border-radius: 16px;
  border: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}

.modal-header {
  border-radius: 16px 16px 0 0;
}

/* ---- Customer Layout ---- */
.customer-nav {
  background: linear-gradient(135deg, #0d47a1, #1976d2);
  box-shadow: 0 2px 16px rgba(0, 0, 0, .2);
}

/* ---- Alerts ---- */
.alert {
  border-radius: 10px;
  font-size: .875rem;
}

/* ---- Timeline ---- */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid currentColor;
  background: #fff;
}

/* ---- Mobile ---- */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 1039;
}

@media (max-width: 991.98px) {
  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.show {
    transform: none;
  }

  #sidebar-overlay.show {
    display: block;
  }

  #main-content {
    margin-left: 0 !important;
  }
}

@media (max-width: 575.98px) {
  .stat-body .value {
    font-size: 1.3rem;
  }

  .page-content {
    padding: 16px;
  }
}