:root {
  --brand-color: #f54c4c;
  --brand-color-hover: #e44141;
  --secondary-color: #4a4a4a;
  --light-gray: #f5f5f5;
  --border-color: #dbdbdb;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: #e0e0e0;
}

/* Header styling */
.navbar {
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.navbar-brand .navbar-item {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
}

.navbar-brand .brand-subtitle {
  font-size: 0.8rem;
  color: #f5f5f5;
  margin-left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Search styling */
.search-wrapper {
  background-color: #f5f5f5;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.search-bar {
  width: 100%;
  position: relative;
}

.search-bar .icon {
  position: absolute;
  top: 10px;
  left: 12px;
  color: #7a7a7a;
  z-index: 1;
}

.search-input {
  padding-left: 40px !important;
  border-radius: 25px !important;
  height: 2.75rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Filter sidebar */
.filter-sidebar {
  background-color: #f5f5f5;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: sticky;
  top: 20px;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header .filter-clear {
  font-size: 0.8rem;
  color: var(--brand-color);
}

.filter-section {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.filter-section:last-child {
  border-bottom: none;
}

.filter-title {
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.filter-option {
  margin-bottom: 0.75rem;
}

.filter-option label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.filter-option input[type="radio"] {
  margin-right: 8px;
}

.listing-list {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.price-inputs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.price-inputs .input {
  flex: 1;
  height: 36px;
  width: calc(50% - 10px);
}

.price-inputs span {
  margin: 0 2px;
  flex-shrink: 0;
}

/* Product Card styling */
.product-card {
  background-color: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  transition: all 0.2s ease-in-out;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.product-image-container {
  position: relative;
  padding-top: 75%; /* 4:3 aspect ratio */
  overflow: hidden;
}

.product-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

.product-info {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.product-title {
  font-weight: 500;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-color);
  margin-bottom: 0.5rem;
}

.product-meta {
  color: #7a7a7a;
  font-size: 0.85rem;
  margin-top: auto;
}

.product-location {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

.product-description {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #4a4a4a;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.image-count {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background-color: rgba(0,0,0,0.6);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Pagination */
.pagination {
  margin-top: 2rem;
}

.pagination-link.is-current {
  background-color: var(--brand-color) !important;
  border-color: var(--brand-color) !important;
}

/* Sorting */
.sort-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.sort-select {
  min-width: 150px;
}

/* Gallery Modal */
.modal-content {
  width: 90%;
  max-width: 1000px;
  margin: 0 auto;
  background: #f5f5f5;
  border-radius: 8px;
  overflow-y: auto;
  max-height: 90vh; /* Limit height to 90% of viewport height */
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.gallery-container {
  padding: 1rem;
}

/* Gallery Navigation Arrows */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.gallery-nav:hover {
  background: rgba(0,0,0,0.8);
}

.gallery-nav.prev {
  left: 10px;
}

.gallery-nav.next {
  right: 10px;
}

.gallery-main {
  margin-bottom: 1rem;
  background-color: var(--light-gray);
  padding: 1rem;
  border-radius: 4px;
  position: relative;
}

.gallery-main img {
  width: 100%;
  max-height: 600px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}

.gallery-thumbs .thumb {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.gallery-thumbs .thumb:hover {
  opacity: 0.9;
}

.gallery-thumbs .thumb.active {
  border-color: var(--brand-color);
}

.gallery-info {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}

.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--light-gray);
  color: #7a7a7a;
  aspect-ratio: 4/3;
}

/* Media queries */
@media screen and (max-width: 768px) {
  .filter-sidebar {
    margin-bottom: 2rem;
  }
  
  .price-inputs {
    flex-direction: row;
  }
  
  .price-inputs .input {
    height: 40px;
    font-size: 16px; /* Prevent iOS zoom on focus */
  }
  
  .filter-option label {
    padding: 6px 0;
  }
  
  .filter-section {
    padding: 1.25rem 1rem;
  }
}

/* Buttons */
.button.is-primary {
  background-color: var(--brand-color);
}

.button.is-primary:hover {
  background-color: var(--brand-color-hover);
}

.button.is-light-primary {
  background-color: rgba(245, 76, 76, 0.1);
  color: var(--brand-color);
}

.button.is-light-primary:hover {
  background-color: rgba(245, 76, 76, 0.2);
}

/* Toggle filter visibility on mobile */
#mobile-filter-toggle {
  display: none;
}

@media screen and (max-width: 768px) {
  .filter-sidebar {
    position: fixed;
    z-index: 30;
    top: 0;
    left: 0;
    width: 80%;
    height: 100%;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    border-radius: 0;
  }
  
  #mobile-filter-toggle {
    display: block;
  }
  
  .filter-sidebar.is-active {
    transform: translateX(0);
  }
  
  .filter-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 25;
  }
  
  .filter-overlay.is-active {
    display: block;
  }
}
