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

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f4f4f4;
}

header {
  background-color: #601442;
  color: #fff;
  padding: 1rem;
  text-align: center;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  list-style: none;
  margin-top: 0.5rem;
}

.nav-links a, button {
  color: #fff;
  text-decoration: none;
  padding: 0.3rem 0.8rem;
  border-radius: 3px;
  background-color: #444;
}

.nav-links a:hover {
  background-color: #555;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.search-container {
  background-color: #fff;
  padding: 1rem;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
}

.legend {
  margin-top: 15px;
  text-align: center;
}

.legend-item {
  margin-right: 10px;
  border-radius: 3px;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.search-type-toggle {
  width: 100%;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.toggle-label {
  margin-right: 20px;
  cursor: pointer;
  display: inline-block;
}

.toggle-label input {
  margin-right: 5px;
}

.search-type-description {
  font-style: italic;
  color: #666;
  margin-top: 5px;
  font-size: 0.9em;
}

.search-form input,
.search-form select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 3px;
  flex: 1;
}

.filters {
  display: flex;
  gap: 1rem;
  flex: 2;
}

.filters select {
  flex: 1;
}

.button-group {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}

#search-button {
  padding: 0.5rem 1rem;
  background-color: #601442;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  flex: 2;
}

#search-button:hover {
  background-color: #7a1a55;
}

.reset-button {
  padding: 0.5rem 1rem;
  background-color: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 3px;
  cursor: pointer;
  flex: 1;
}

.reset-button:hover {
  background-color: #e0e0e0;
}

.results-container {
  background-color: #fff;
  padding: 1rem;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.results-container h2 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #ddd;
}

.permits-list {
  width: 100%;
  overflow-x: auto;
}

.permit-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.permit-table th {
  padding: 0.5rem;
  text-align: left;
  background-color: #f0f0f0;
  border-bottom: 2px solid #ddd;
}

.permit-table td {
  padding: 0.5rem;
}

.permit-row {
  cursor: pointer;
}

.permit-row:hover {
  background-color: #f9f9f9;
}

.permit-details {
  background-color: #fafafa;
}

.permit-description {
  padding-bottom: 1rem;
  border-bottom: solid #999 1px;
}

.description-text {
  padding-left: 1rem;
  display: block;
}

.permit-card {
  transition: all 0.2s ease;
}

.permit-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.matches-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.permit-updated-at {
  font-size: x-small;
  color: #888;
}

.permit-action {
  font-weight: bolder;
  font-size: x-small;
  color: green;
}

.permit-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #888;
}

/* Permit detail page */
.permit-page .permit-container {
  background-color: #fff;
  padding: 2rem;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.permit-page h2 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #ddd;
}

.flat-table {
  /* width: 100%; */
  border-collapse: collapse;
}

.flat-table td {
  padding: 0.1rem 2rem 0.1rem 0.1rem;
  vertical-align: top;
}

pre {
  background-color: #f7f7f7;
  padding: 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 100%;
  overflow: auto;
  font-family: monospace;
  font-size: 0.9rem;
  border-radius: 3px;
}

.pagination-info {
  text-align: right;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #666;
}

.pagination-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
}

.pagination-controls.top {
  margin-bottom: 1rem;
  border-bottom: 1px solid #ddd;
}

.pagination-controls.bottom {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #ddd;
}

.pagination-summary {
  font-size: 0.9rem;
  color: #666;
}

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

.pagination-btn {
  padding: 0.4rem 0.8rem;
  background-color: #601442;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.85rem;
  min-width: 2.5rem;
  text-align: center;
}

.pagination-btn:hover {
  background-color: #555;
}

.pagination-btn.disabled {
  background-color: #aaa;
  cursor: not-allowed;
  opacity: 0.7;
}

.pagination-page-select {
  margin: 0 0.5rem;
}

.page-select {
  padding: 0.4rem;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 0.85rem;
  background-color: #f9f9f9;
  cursor: pointer;
}

.page-counter {
  margin-left: 0.5rem;
  font-size: 0.85rem;
  color: #666;
}

/* Parcel filter styles */
.parcel-filter {
  color: #0066cc;
  text-decoration: underline;
  cursor: pointer;
}

.parcel-filter:hover {
  color: #004080;
}

.filter-indicator {
  background-color: #f0f8ff;
  border: 1px solid #b8d4f5;
  border-radius: 3px;
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.clear-filter {
  background-color: #f44336;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
}

.clear-filter:hover {
  background-color: #d32f2f;
}

/* Legacy pagination for backward compatibility */
.pagination {
  display: none;
}

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

.modal-content {
  background-color: #fefefe;
  margin: 10% auto;
  padding: 20px;
  border: 1px solid #888;
  border-radius: 5px;
  width: 80%;
  max-width: 800px;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #666;
}

.permit-details-content {
  margin-top: 1rem;
}

.permit-details-content h2 {
  margin-bottom: 1rem;
}

.detail-row {
  display: flex;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.5rem;
}

.detail-label {
  font-weight: bold;
  width: 200px;
}

.detail-value {
  flex: 1;
}

.jsonToTable {
  width: 100%;
  /* Or a specific width */
  border-collapse: collapse;
  /* Optional: Removes spacing between table cells */
  font-size: 0.8rem;
}

.jsonToTable td {
  /* padding-right: 1rem; */
  /* Adjust padding as needed */
  /* padding-bottom: 0.1rem; */
  /* Optional: Add vertical padding */
  /* padding-top: 0.1rem; */
  /* Optional: Add vertical padding */
}

.jsonToTable tr {
  border-bottom: 1px solid #ddd;
  /* Light gray underline */
}

/* Optional: Remove underline from the last row */
.jsonToTable tr:last-child {
  border-bottom: none;
}

footer {
  text-align: center;
  padding: 1rem;
  background-color: #601442;
  color: #fff;
  margin-top: 2rem;
}

@media (max-width: 768px) {
  .search-form {
    flex-direction: column;
  }
  
  .filters {
    flex-direction: column;
    width: 100%;
  }
  
  #search-button {
    width: 100%;
  }
}

/** View Transition test **/
@view-transition {
  navigation:auto;
}

::view-transition-old(main) {
  animation: fade 0.2s linear forwards;
}
::view-transition-new(main) {
  animation: fade 0.4s linear reverse;
}

@keyframes fade {
  from{
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
/** end View Transition test **/

/* Extracted from inline styles */
.search-type-description span {
  display: none;
}

#basic-search-desc {
  display: block;
}

.legend-item {
  background-color: #EEE;
  padding: 5px;
  border-radius: 3px;
}

.legend-item.new {
  background-color: #90ee90;
}

.legend-item.updated {
  background-color: wheat;
}

/* Permit list table styles */
.permit-table thead th {
  text-align: left;
}

.permit-table td.record-state {
  text-align: center;
}

.property-row {
  margin: 0 auto;
}

.property-listing {
  width: 350px;
  display: inline-block;
  vertical-align: top;
  padding: 10px;
  box-sizing: border-box;
}

.property-listing img {
  width: 100%;
  height: auto;
  border-radius: 5px;
}

.property-listing .address {
  font-weight: bold;
  margin-top: 5px;
}

.property-listing .price {
  color: #28a745;
  margin-top: 5px;
}

.property-listing .listing-meta {
  font-size: smaller;
}

.property-listing .listing-meta span {
  color: #EEE;
}

.property-listing .view-link {
  text-align: center;
}

/* Fulltext search results */
.permit-card {
  border-left: 4px solid #EEE;
  margin-bottom: 20px;
  padding: 10px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.permit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.permit-number {
  font-size: 1.1em;
  font-weight: bold;
}

.permit-date {
  margin-left: 10px;
}

.permit-type-status {
  margin-right: 10px;
}

.permit-external-link {
  margin-left: 10px;
}

.permit-matches {
  margin-top: 15px;
  border-top: 1px solid #eee;
  padding-top: 10px;
}

.permit-matches-title {
  font-weight: bold;
  margin-bottom: 5px;
  color: #555;
}

.matches-table th, 
.matches-table td {
  text-align: left;
  padding: 0.2em 0.3em;
}

.matches-table th {
  background-color: #601442;
  color: white;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 0.85em;
}

.matches-table tr {
  border-bottom: 1px solid #eee;
}

.matches-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

.matches-table tr:last-child {
  border-bottom: none;
}

.matches-table tr:hover {
  background-color: #f1f1f1;
}

.matches-table td:first-child,
.matches-table th:first-child {
  width: 20%;
}

.matches-table td:nth-child(2),
.matches-table th:nth-child(2) {
  width: 25%;
}

/* Permit content styles */
.permit-content h2 {
  margin-bottom: 1rem;
}

.permit-content h2 span {
  padding: 0 1rem 0 0;
}

.permit-content-header {
  padding-top: 1rem;
}

.section-container {
  padding-left: 2rem;
  padding-bottom: 1rem;
  border: #CCC solid 1px;
}

.section-title {
  border-bottom: #999 solid 1px;
  padding-top: 1rem;
}

.no-info {
  padding-top: 0.5em;
  margin-top: 0.5em;
}

.process-status-entry {
  margin-top: 1.5rem;
}

.process-status-icon {
  width: 3rem;
  display: inline-block;
  text-align: center;
}

.process-status-comments {
  padding-left: 1.5rem;
  padding-right: 0.5rem;
  padding-bottom: 1rem;
}

.process-status-comments pre {
  padding-top: 0.5rem;
}

.key-cell {
  padding-right: 1.5rem;
}

.entity-section {
  border: #CCC solid 1px;
}

.entity-content {
  padding-left: 0.5rem;
  padding-bottom: 1rem;
}

.entity-table {
  margin-left: 0.5rem;
}

.license-table {
  padding-top: 1rem;
}