:root {
  --primary: #02245b;
  --secondary: #ff5e14;
  --accent: #3a86ff;
  --light: #f8f9fa;
  --dark: #1d2a38;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.15);
}

body {
  font-family: "Inter", "Open Sans", sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  min-height: 100vh;
}

/* Page Header – background image injected via JS */
.page-header {
  background:
    linear-gradient(to right, rgba(2, 36, 91, 1) 0%, rgba(2, 36, 91, 0) 100%),
    url(/img/products/survey-equipment.png) center center no-repeat;
  background-size: cover;
  min-height: 350px;
  display: flex;
  align-items: center;
}

.page-header h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
}

/* ── Product cards ────────────────────────────────── */
.service-card {
  position: relative;
  margin: 10px 0;
  height: 320px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.4s ease;
  background: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 94, 20, 0.1);
}

.service-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 1;
  transition: all 0.6s ease;
  transform: scale(1);
}

.service-card:hover .service-bg {
  transform: scale(1.05);
  filter: brightness(0.95);
}

.service-bg.loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.service-content {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  color: white;
  transition: all 0.4s ease;
  background: linear-gradient(to top, rgba(2, 36, 91, 0.75) 0%, transparent 60%);
}

.service-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 1.3rem;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  line-height: 1.3;
  padding: 0 0.5rem;
  color: white;
}

.service-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 42px;
  background: white;
  color: var(--primary);
  border: none;
  border-radius: 21px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin: 0 auto;
  cursor: pointer;
}

.service-btn:hover {
  background: var(--secondary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 94, 20, 0.3);
}

/* ── Empty state ─────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  display: block;
}

/* ── Pagination ──────────────────────────────────── */
.pagination-container {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #dee2e6;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
}

.page-item { margin: 0; }

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.75rem;
  border: 1px solid #dee2e6;
  background: white;
  color: var(--primary);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.25s ease;
  cursor: pointer;
  user-select: none;
}

.page-link:hover {
  background: var(--light);
  border-color: var(--primary);
  color: var(--primary);
}

.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.page-item.disabled .page-link {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f8f9fa;
}

.page-item.disabled .page-link:hover {
  background: #f8f9fa;
  border-color: #dee2e6;
  color: var(--primary);
}

.page-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  color: #6c757d;
  list-style: none;
}

.page-size-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.page-size-selector label {
  font-weight: 500;
  color: #495057;
  white-space: nowrap;
}

.page-size-selector select {
  width: auto;
  min-width: 80px;
  padding: 0.5rem 2rem 0.5rem 1rem;
}

.pagination-info {
  margin-right: 1rem;
  color: #495057;
  font-weight: 500;
  white-space: nowrap;
}

.results-info {
  text-align: center;
  margin-top: 1rem;
  color: #6c757d;
  font-size: 0.9rem;
}

/* ── Back button (fixed, expandable on hover) ──────── */
.back-btn {
  position: fixed;
  right: 85px; /* sits left of scroll-to-top (30px + 45px btn + 10px gap) */
  bottom: 30px;
  z-index: 99;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  height: 45px;
  width: 45px;
  border-radius: 50px;
  background-color: var(--primary);
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(2, 36, 91, 0.3);
  transition: width 0.35s ease, border-radius 0.35s ease, background-color 0.25s ease;
  white-space: nowrap;
}

.back-btn:hover {
  width: 175px;
  border-radius: 50px;
  background-color: var(--secondary);
}

.back-btn-icon {
  min-width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  order: 2; /* icon on the right, label expands to the left */
}

.back-btn-label {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding-left: 0;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.35s ease, opacity 0.2s ease 0.15s, padding-left 0.35s ease;
  pointer-events: none;
  order: 1;
  white-space: nowrap;
}

.back-btn:hover .back-btn-label {
  max-width: 130px;
  padding-left: 14px;
  opacity: 1;
}

/* ── Loading spinner on section ─────────────────── */
.loading-spinner {
  display: block;
  width: 2rem;
  height: 2rem;
  margin: 1rem auto;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  .service-card {
    height: 300px;
    margin: 30px 0;
  }

  .service-title { font-size: 1rem; }

  .service-btn {
    width: 130px;
    height: 40px;
    font-size: 0.85rem;
  }

  .pagination-container {
    flex-direction: column;
    gap: 1rem;
  }

  .pagination-info {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }

  .page-size-selector {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .page-link {
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 576px) {
  .page-header { min-height: 250px; }
}
