/* ============================================================
   Church Tech Maintenance Tracker — Page Styles
   Uses main.css sidebar layout (#sidebar + #main-content + .view)
   ============================================================ */

/* ── Loading overlay ───────────────────────────────────────── */
#maint-loading {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 14px;
  color: var(--text-muted);
  z-index: 9999;
}

#maint-loading.hidden { display: none; }

/* ── Content max-width (matches toolbox standard) ──────────── */
.maint-stats,
.maint-toolbar,
.maint-table-wrap {
  max-width: 1200px;
}

/* ── Stats row (in equipment view, below view-header) ──────── */
.maint-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px 20px 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-card__label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
  font-weight: 600;
}

.stat-card__value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy-dark);
  line-height: 1;
}

/* ── Toolbar (search + filters) ────────────────────────────── */
.maint-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.maint-search {
  flex: 1;
  min-width: 200px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  background: var(--bg);
  color: var(--text);
}
.maint-search:focus { border-color: var(--navy-light); background: #fff; }

.maint-filter {
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.maint-filter:focus { border-color: var(--navy-light); }

/* ── Table ─────────────────────────────────────────────────── */
.maint-table-wrap { overflow-x: auto; }

.maint-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.maint-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--surface-alt);
}

.maint-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.maint-table tbody tr:last-child td { border-bottom: none; }
.maint-table tbody tr:hover td { background: var(--bg); cursor: pointer; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-tag      { background: #dbeafe; color: #1d4ed8; }
.badge-complete { background: #dcfce7; color: #166534; }
.badge-pending  { background: #fef9c3; color: #854d0e; }

/* ── Tag chips (equipment tags in maintenance rows) ────────── */
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 12px;
  margin: 1px 2px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ── Empty state ───────────────────────────────────────────── */
.maint-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Modal overrides — wider for this app ──────────────────── */
.modal--wide { width: 620px; }

/* ── Modal detail view ─────────────────────────────────────── */
.detail-section {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin: 18px 0 10px;
}
.detail-section:first-child { margin-top: 0; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-field label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  display: block;
  margin-bottom: 2px;
}

.detail-field .val { font-size: 14px; color: var(--text); }
.detail-field .val--mono { font-family: monospace; font-size: 13px; }

.hist-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--bg);
}

.hist-item__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.hist-item__type { font-size: 13px; font-weight: 600; }
.hist-item__date { font-size: 12px; color: var(--text-muted); }

/* ── Form fields in modals ─────────────────────────────────── */
.mf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mf-group { margin-bottom: 12px; }

.mf-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 5px;
}

.mf-group input[type="text"],
.mf-group input[type="date"],
.mf-group select,
.mf-group textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  background: var(--bg);
  color: var(--text);
}

.mf-group input:focus,
.mf-group select:focus,
.mf-group textarea:focus { border-color: var(--navy-light); background: #fff; }
.mf-group textarea { resize: vertical; min-height: 70px; }

/* Equipment checkbox list */
.eq-checklist {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 0;
  background: var(--bg);
}

.eq-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
}

.eq-check-item:hover { background: var(--surface); }
.eq-check-item input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; }

/* ── Modal footer row ──────────────────────────────────────── */
.modal-footer-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
  align-items: center;
}

.modal-footer-row .left { margin-right: auto; }

/* ── Toast ─────────────────────────────────────────────────── */
#maint-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: all .25s;
  pointer-events: none;
  white-space: nowrap;
}

#maint-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
