.project-listing {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Header */
.project-listing-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 2rem;
}

.project-tabs {
  display: flex;
  gap: 0.5rem;
}

.project-tabs .tab-btn {
  padding: 0.75rem 1.5rem;
  border: 2px solid #e5e7eb;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  color: #6b7280;
}

.project-tabs .tab-btn:hover {
  border-color: #3b82f6;
  color: #fff;
}

.project-tabs .tab-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.project-summary {
  display: flex;
  gap: 2rem;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* Filters */
.project-filters {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.filters-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  color: #374151;
  transition: all 0.2s ease;
}

.filters-toggle:hover {
  border-color: #3b82f6;
  color: #3b82f6;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.search-box svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  width: 1rem;
  height: 1rem;
}

.search-box input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
}

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

.filters-panel {
  /* Use flex so controls align nicely in one row when there is space */
  display: flex;
  flex-wrap: wrap;
  align-items: center; /* vertically align inputs and button */
  gap: 12px;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

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

.filter-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.filter-group select,
.filter-group input {
  height: 36px;            /* consistent control height */
  line-height: 36px;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

/* Cost range group styling */
.cost-range-group {
  min-width: 250px;
  max-width: 350px; /* Constrain on desktop */
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 0.5rem;    /* Add spacing above slider */
  margin-bottom: 0.75rem; /* Add spacing below slider */
}

.cost-range-group .range-slider {
  margin-top: 0.25rem;
  align-self: stretch; /* Use available width in container */
}

.project-cost-slider .range-slider-header {
  margin-bottom: 0.5rem;
}

.project-cost-slider .range-slider-values {
  font-size: 0.8125rem;
}

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

.clear-filters-btn {
  padding: 0 14px;
  height: 36px;            /* align with inputs/selects */
  line-height: 36px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.2s ease;
  align-self: center;      /* vertically center relative to row */
  white-space: nowrap;
  margin-left: auto;       /* push to the right when space allows */
}

.clear-filters-btn:hover {
  background: #dc2626;
}

/* Projects Grid */
.projects-container {
  margin-bottom: 2rem;
}

.no-projects {
  text-align: center;
  padding: 3rem;
  color: #6b7280;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.2s ease;
  position: relative;
}

.project-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);
}

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

.project-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
  margin: 0;
  flex: 1;
  /* Prevent long titles from causing horizontal scroll */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.project-category {
  background: #dbeafe;
  color: #1e40af;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.project-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #4b5563;
}

.detail-item svg {
  width: 1rem;
  height: 1rem;
  color: #6b7280;
  flex-shrink: 0;
}

.detail-item .rupee-icon {
  width: 1rem;
  height: 1rem;
  color: #6b7280;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
}

.project-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 1rem;
  border-top: 1px solid #f3f4f6;
}

.mp-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mp-info strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
}

.mp-info span {
  font-size: 0.75rem;
  color: #6b7280;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.status-badge.status-approved {
  background: #dcfce7;
  color: #166534;
}

.status-badge.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.status-in-progress {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.status-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.status-completed {
  background: #dcfce7;
  color: #166534;
}

.status-badge.status-not-started {
  background: #f3f4f6;
  color: #374151;
}

/* Project Actions */
.project-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.payment-details-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.payment-details-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.payment-details-btn:active {
  transform: translateY(0);
}

.payment-details-btn svg {
  font-size: 0.875rem;
}

/* Payment button for recommended works with payments */
.payment-details-btn.with-payments {
  background: #f59e0b;
  color: white;
  border: 1px solid #d97706;
}

.payment-details-btn.with-payments:hover {
  background: #d97706;
  border-color: #b45309;
}

.recommended-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Pagination */
.project-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.pagination-info {
  font-size: 0.875rem;
  color: #6b7280;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  color: #374151;
  transition: all 0.2s ease;
}

.pagination-controls button:hover:not(:disabled) {
  border-color: #3b82f6;
  color: #3b82f6;
}

.pagination-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  font-size: 0.875rem;
  color: #4b5563;
  margin: 0 1rem;
}

/* Loading States */
.project-listing-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #6b7280;
}

.loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.project-listing-error {
  padding: 2rem;
  text-align: center;
  color: #ef4444;
  background: #fee2e2;
  border-radius: 8px;
  border: 1px solid #fecaca;
}

/* Responsive Design */
@media (max-width: 768px) {
  .project-listing {
    padding: 1rem;
  }

  .project-listing-header {
    flex-direction: column;
    gap: 1rem;
  }

  .project-summary {
    justify-content: space-around;
    width: 100%;
  }

  .filters-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .search-box {
    max-width: none;
  }

  .filters-panel {
    /* Stack filters on small screens but keep nice spacing */
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 0.75rem;
  }

  .cost-range-group {
    min-width: unset;
    max-width: none; /* Remove width constraint on mobile */
    align-items: stretch; /* Full width on mobile */
    margin-top: 0.75rem;    /* Increase spacing on mobile */
    margin-bottom: 1rem;    /* Increase spacing on mobile */
  }

  .clear-filters-btn {
    margin-left: 0;    /* reset auto push on small screens */
    align-self: stretch;
    text-align: center;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-pagination {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .project-tabs {
    width: 100%;
  }

  .project-tabs .tab-btn {
    flex: 1;
    text-align: center;
  }

  .project-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-category {
    align-self: flex-start;
  }

  /* Allow summary stats to wrap on narrow screens */
  .project-summary {
    flex-wrap: wrap;
    gap: 1rem;
  }
}
