/* PermitStack App — dashboard styles */

.app-body {
  min-height: 100vh;
  background: var(--bg);
}

/* Page header */
.page-header {
  padding: 24px 20px 0;
}
.page-header h1 {
  font-size: 24px;
  color: var(--fg);
  margin-bottom: 4px;
}
.page-header p {
  font-size: 14px;
  color: var(--fg-muted);
}

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 20px;
}
.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--bg-alt);
}
.stat-card .stat-num {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
}
.stat-card.applied .stat-num { color: var(--accent); }
.stat-card.approved .stat-num { color: #2D7A4F; }
.stat-card.expired .stat-num { color: var(--problem-red); }

/* Section */
.section {
  padding: 0 20px 24px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
}

/* Job cards */
.job-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.job-card {
  background: var(--white);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--bg-alt);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.job-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.job-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.job-card-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--fg);
  line-height: 1.3;
}
.job-card-trash {
  color: var(--fg-muted);
  font-size: 18px;
  opacity: 0.4;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}
.job-card-trash:hover { opacity: 1; color: var(--problem-red); }
.job-card-address {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.job-card-meta {
  display: flex;
  gap: 16px;
}
.job-card-meta span {
  font-size: 12px;
  color: var(--fg-muted);
}
.job-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 500;
}
.badge-applied { background: #FFF3EE; color: var(--accent); }
.badge-approved { background: var(--solution-bg); color: #2D7A4F; }
.badge-expired { background: var(--problem-bg); color: var(--problem-red); }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 40px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--bg-alt);
  border-radius: 2px;
  margin: 0 auto 20px;
}
.modal h2 {
  font-size: 20px;
  margin-bottom: 20px;
  color: var(--fg);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--bg-alt);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bg);
  color: var(--fg);
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: var(--white);
  width: 100%;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--bg-alt);
  color: var(--fg);
}
.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  padding: 8px 12px;
  font-size: 14px;
}

/* Job detail */
.job-detail {
  display: none;
}
.job-detail.open {
  display: block;
}
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 0;
}
.detail-header h2 {
  font-size: 20px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--fg-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 4px 0;
}
.back-btn:hover { color: var(--fg); }

/* Permit list */
.permit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.permit-card {
  background: var(--white);
  border-radius: 10px;
  padding: 14px;
  border: 1px solid var(--bg-alt);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.permit-info .permit-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}
.permit-info .permit-meta {
  font-size: 12px;
  color: var(--fg-muted);
}
.permit-info .permit-number {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* Photo grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.photo-thumb {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-alt);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-empty {
  font-size: 12px;
  color: var(--fg-muted);
  grid-column: 1 / -1;
  text-align: center;
  padding: 16px 0;
}

/* Photo upload */
.photo-upload-area {
  border: 2px dashed var(--bg-alt);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
  margin-bottom: 12px;
}
.photo-upload-area:hover { border-color: var(--accent); }
.photo-upload-area input { display: none; }
.photo-upload-icon { font-size: 24px; margin-bottom: 8px; }
.photo-upload-text { font-size: 13px; color: var(--fg-muted); }

.preview-photo {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  margin-bottom: 12px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* Photo modal specific */
.photo-modal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

/* Toast / alert */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  display: none;
}
.toast.show { display: block; }

/* Tabs */
.detail-tabs {
  display: flex;
  gap: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--bg-alt);
  margin-bottom: 16px;
}
.detail-tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}
.detail-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

@media (min-width: 640px) {
  .job-list { max-width: 640px; }
  .stats-bar { max-width: 640px; }
}