* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  line-height: 1.5;
}

.container {
  max-width: 600px; /* Perfect for mobile */
  margin: 0 auto;
  padding: 1rem;
}

/* Header */
.header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  padding: 2rem 0;
  margin-bottom: 1.5rem;
  border-radius: 0 0 1rem 1rem;
}

.header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.header p {
  color: #94a3b8;
  font-size: 0.875rem;
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: white;
  padding: 1rem;
  border-radius: 0.75rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.stat-label {
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Filters Card */
.filters-card {
  background: white;
  padding: 1.25rem;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

.search-group {
  margin-bottom: 1rem;
}

.search-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 2rem; /* Pill shape */
  font-size: 1rem;
  background: #f8fafc;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: white;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background: white;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: #3b82f6;
}

.filter-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.results-count {
  font-size: 0.875rem;
  color: #64748b;
}

.reset-btn {
  background: none;
  border: none;
  color: #3b82f6;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem;
  cursor: pointer;
}

.reset-btn:hover {
  color: #2563eb;
}

/* Jobs List */
.jobs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.job-card {
  background: white;
  padding: 1.25rem;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid transparent;
}

.job-card:active {
  transform: scale(0.99);
  background: #f8fafc;
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.job-title {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.4;
}

.job-ref {
  background: #f1f5f9;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.6875rem;
  color: #475569;
  white-space: nowrap;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  color: #64748b;
}

.job-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.job-province {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: #f1f5f9;
  border-radius: 1rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.5rem;
}

.job-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.8125rem;
}

.job-closing {
  color: #ef4444;
  font-weight: 500;
}

.job-closing.urgent {
  color: #dc2626;
  font-weight: 600;
}

/* Load More Button */
.load-more-container {
  text-align: center;
  margin: 1.5rem 0;
}

.load-more-btn {
  background: white;
  border: 1px solid #e2e8f0;
  padding: 0.875rem 2rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #0f172a;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  width: 100%;
  max-width: 300px;
}

.load-more-btn:active {
  background: #f8fafc;
  transform: scale(0.98);
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 1rem;
  width: 3rem;
  height: 3rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.2s;
}

.back-to-top:active {
  transform: scale(0.95);
  background: #2563eb;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow-y: auto;
}

.modal-content {
  background: white;
  margin: 1rem;
  padding: 1.5rem;
  border-radius: 1rem;
  position: relative;
  max-width: 500px;
  margin: 2rem auto;
}

.close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 1.75rem;
  cursor: pointer;
  color: #64748b;
}

.close:active {
  color: #0f172a;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 3rem;
  color: #64748b;
}

.loading-spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Offline Banner */
.offline-banner {
  background: #fff3cd;
  color: #856404;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border-radius: 0.5rem;
  border: 1px solid #ffeeba;
}

/* Touch-friendly targets */
button,
.job-card,
.filter-select,
.search-input {
  min-height: 44px; /* Apple's recommended minimum */
}

/* Small screens adjustments */
@media (max-width: 480px) {
  .container {
    padding: 0.75rem;
  }

  .stats-bar {
    gap: 0.5rem;
  }

  .stat {
    padding: 0.75rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .filters-grid {
    grid-template-columns: 1fr; /* Stack on very small screens */
  }

  .job-meta {
    flex-direction: column;
    gap: 0.25rem;
  }
}
