html {
  font-size: 14px;
  -webkit-text-size-adjust: none; 
  text-size-adjust: none;
}

body {
  font-family: sans-serif;
  background-color: #1e1e1e;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #eee;
}

.page-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

h1 {
  margin-top: 20px;
  margin-bottom: 20px;
  text-align: center;
  color: #333;
  font-size: 1.5em;
}

h1 .title-highlight {
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

h1 .gg-highlight {
  color: #faf286;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

h1 .dba-highlight {
  color: #00098a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 30;
}

input {
  padding: clamp(8px, 1.5vw, 14px) clamp(12px, 2vw, 20px);
  font-size: clamp(1rem, 2vw, 1.3rem);
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
  width: clamp(200px, 50vw, 400px);
  text-align: center;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.no-results {
  text-align: center;
  padding: 2rem;
  font-size: 1.2rem;
  color: #666;
  min-height: 50vh;
  grid-column: 1 / -1;
}

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

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.category-selector {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.loading-border {
  display: none;
  position: absolute;
  top: -2px;
  left: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  pointer-events: none;
  z-index: 1;
}

.loading-border.active {
  display: block;
}

.loading-border rect {
  stroke-dasharray: 20 644;
  animation: dash 1.5s linear infinite;
}

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 10px;
  box-sizing: border-box;
  align-items: start;
}

.card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  color: inherit;
  opacity: 0;
  animation: fadeInCard 0.3s ease forwards;
  will-change: transform;
  position: relative;
  height: 100%;
}

.card img {
  width: 100%;
  object-fit: cover;
  background: #ddd;
  flex-shrink: 0;
  border-radius: 0;
}

.card-image-wrapper {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  flex-shrink: 0;
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover; 
  display: block;
}

.card-content {
  padding: 4px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  color: white;
}

.card-content h3 {
  margin: 0 0 auto 0;
  font-size: clamp(0.9rem, 0.95rem, 1rem);
  font-weight: 600;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  font-size: clamp(0.75rem, 0.85, 0.95rem);
  gap: 8px;
  margin-top: auto;
  white-space: nowrap;
}

.location {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ccc;
  font-size: clamp(0.75rem, 0.85rem, 0.9rem);
}

.location .city,
.location .zip {
  margin-right: 4px;
  flex-shrink: 1;
}

.price {
  text-align: left;
  font-weight: bold;
  color: #d9534f;
  font-size: clamp(0.9rem, 0.95rem, 1rem);
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slide {
  position: relative;
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #4caf50;
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.slide .google-icon {
  position: absolute;
  bottom: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  z-index: 5;
}

.slide .google-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slide .google-icon:hover {
  transform: scale(1.3);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.toggle-label {
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  color: #333;
  cursor: pointer;
}

.info-btn {
  position: absolute;
  top: 36px;
  right: 8px;
  background: white;
  color: #007bff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.info-btn:hover {
  background: rgba(255, 255, 255, 1);
}

.gg-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(250, 242, 134, 0.8);
  color: #000;
  font-weight: bold;
  padding: 2px;
  border-radius: 4px;
  font-size: 0.7rem;
  pointer-events: none;
  z-index: 1;
}

.dba-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.8);
  color: rgb(0, 9, 138);
  font-weight: bold;
  padding: 2px;
  border-radius: 4px;
  font-size: 0.7rem;
  pointer-events: none;
  z-index: 1;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 30, 30, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 10px;
}

.modal-content {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #eee;
  padding: 20px;
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-content h2 {
  margin-top: 0;
  color: #faf286;
  font-weight: 700;
  font-size: 1.4rem;
  text-align: center;
}

.modal-content p {
  margin: 0;
  line-height: 1.5;
  font-size: 1rem;
  color: #ddd;
  font-weight: 500;
}

.modal-content .address-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-content .maps-icon {
  width: 1em;
  height: auto;
  max-width: 20px;
  transition: transform 0.2s ease;
}

.modal-content a {
  color: #eee;
  text-decoration: none;
}

.modal-content a:hover {
  text-decoration: underline;
}

.close-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #faf286;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 10px;
  width: 100%;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.category-button {
  padding: clamp(8px, 1.5vw, 14px) clamp(12px, 2vw, 20px);
  background: transparent;
  cursor: pointer;
  border: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  width: auto;
  fill: white;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-icon {
  width: 24px;
  height: 24px;
  transform: scaleX(-1);
  color: white;
}

.category-menu {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 10;
  min-width: 200px;
}

.category-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.category-menu li {
  padding: 10px 20px;
  cursor: pointer;
  color: #333;
}

.category-menu li:hover {
  background: #f0f0f0;
}

.category-menu li.active {
  font-weight: bold;
}

.bg-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  color: #333;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.3s ease;
}

.bg-toggle:hover {
  background: #f0f0f0;
}

.bg-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 44px;
  height: 24px;
  background: #ccc;
  border-radius: 24px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.bg-toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 2px;
  left: 2px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.bg-toggle input[type="checkbox"]:checked {
  background: #4caf50;
}

.bg-toggle input[type="checkbox"]:checked::before {
  left: 22px;
}

.card.bg-new-card {
  position: relative;
  z-index: 0;
  border-radius: 12px;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.35), 
    0 6px 12px rgba(0, 0, 0, 0.4), 
    0 12px 24px rgba(0, 0, 0, 0.45),
    0 24px 48px rgba(0, 0, 0, 0.5); 
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card.bg-new-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 
    0 3px 6px rgba(0, 0, 0, 0.38),
    0 10px 20px rgba(0, 0, 0, 0.42),
    0 18px 36px rgba(0, 0, 0, 0.48),
    0 30px 60px rgba(0, 0, 0, 0.52);
}

.card.bg-new-card::after {
  content: "NY";
  position: absolute;
  top: 10px;
  left: 10px;
  background: #4caf50;
  color: #fff;
  font-weight: bold;
  font-size: 0.7rem;
  padding: 2px 5px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 8px 4px rgba(76, 175, 80, 0.6);
  animation: pulseShadowToBorder 2.5s ease-in-out infinite;
  text-transform: uppercase;
}

.ad-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  animation: fadeInModal 0.35s ease forwards;
}

.ad-modal-content {
  width: 80vw;
  max-width: 1000px;
  height: 80vh;
  background: rgba(30, 30, 30, 0.9);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  color: #eee;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  animation: popInModal 0.35s ease forwards;
}

.ad-modal.closing {
  animation: fadeOutModal 0.3s ease forwards;
}

.ad-modal.closing .ad-modal-content {
  animation: popOutModal 0.3s ease forwards;
}

.image-slider {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #000;
}

.slide-indicator {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.slider-inner {
  display: flex;
  height: 100%;
  transition: transform 0.3s ease;
}

.slide {
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  padding: 15px 20px;
  cursor: pointer;
  font-size: 1.5rem;
  z-index: 10;
}

.left-arrow {
  left: 10px;
}

.right-arrow {
  right: 10px;
}

.ad-info {
  padding: 20px;
  text-align: center;
  overflow-y: auto;
}

.ad-title {
  font-size: 1.2rem;
  margin: 0 0 10px 0;
}

.ad-price {
  font-size: 1.2rem;
  color: #d9534f;
  font-weight: bold;
  margin-bottom: 10px;
}

.ad-description {
  text-align: center;
  margin-bottom: 10px;
  white-space: pre-wrap;
  font-size: clamp(0.8rem, 1vw, 1.2rem);
  color: #ddd;
  max-height: calc(1.5em * 5);
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  padding-right: 4px;
  padding: 4px;
}

.ad-location {
  font-size: 1rem;
  font-weight: bold;
  color: #ccc;
}

.ad-divider {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  margin: 12px auto;
  width: 80%;
}

.menu-divider {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(0, 0, 0, 0.3),
    transparent
  );
  margin: 12px auto;
  width: 80%;
}

.original-link {
  position: absolute;
  bottom: 10px;
  right: 10px;
  color: white;
  font-weight: bold;
  text-decoration: none;
  font-size: 0.9rem;
}

.original-link:hover {
  text-decoration: underline;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: #eee;
  font-size: 2rem;
  cursor: pointer;
  z-index: 10;
}

.close-modal:hover {
  color: #fff;
}

@media (max-width: 768px) {
  input {
    font-size: 16px !important;
  }
}

@media (max-width: 600px) {
  #grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  @supports (contain: paint) and (not (-moz-appearance: none)) {
    .card-image-wrapper img {
      height: 100%;
    }
  }
  .card img {
    aspect-ratio: 16 / 9;
  }
  .card-footer,
  .location {
    white-space: normal;
  }
  .card-content {
    padding: 8px;
  }
  .price {
    font-size: 1rem;
  }
  .location {
    font-size: 0.8rem;
  }
}

.card.new-card {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  animation: fadeInCard 0.35s cubic-bezier(0, 0, 0, 1) forwards;
}

@keyframes pulseShadowToBorder {
  0% {
    box-shadow: 0 0 6px 2px rgba(76, 175, 80, 0.6);
  }
  50% {
    box-shadow: 0 0 12px 4px rgba(76, 175, 80, 0.8);
  }
  100% {
    box-shadow: 0 0 6px 2px rgba(76, 175, 80, 0.6);
  }
}

@keyframes fadeInCard {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dash {
  to {
    stroke-dashoffset: -664;
  }
}

@keyframes fadeInModal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOutModal {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes popInModal {
  from {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes popOutModal {
  from {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  to {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
}

@keyframes popInCard {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  60% {
    opacity: 1;
    transform: translateY(-5px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
