/* Reset & layout safety */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Modern CSS Reset */
html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: #1e293b;
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 1rem 0;
  color: #0f172a;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin: 0 0 1rem 0;
  color: #475569;
}

/* Container Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Main Layout */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Navigation Styles - Modern and Clean */
.nav-container {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  text-decoration: none;
  letter-spacing: -0.025em;
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2.5rem;
}

.nav-menu a {
  color: #64748b;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  padding: 0.5rem 0;
  position: relative;
}

.nav-menu a:hover {
  color: #3b82f6;
}

.nav-menu a.active {
  color: #3b82f6;
}

.nav-menu a.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: #3b82f6;
  border-radius: 1px;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #64748b;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.mobile-menu-toggle:hover {
  background-color: #f1f5f9;
}

/* Header Styles */
header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  text-align: center;
  padding: 2rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 5;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: white;
  letter-spacing: -0.025em;
}

header p {
  font-size: 1.1rem;
  color: #cbd5e1;
  margin: 0.5rem 0 1.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Form Styles - Modern and Clean */
form {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  position: relative;
  z-index: 5;
}

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

.input-group {
  position: relative;
  flex: 1;
}

.input-clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #999;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

.input-clear-btn:hover {
  background-color: #f0f0f0;
  color: #666;
}

.input-clear-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.input-group input:focus + .input-clear-btn {
  opacity: 1;
  pointer-events: auto;
}

/* Ensure input has proper padding to accommodate clear button */
.input-group input {
  padding-right: 40px;
}

input {
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  transition: all 0.2s ease;
  outline: none;
}

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

/* Larger input for vendor/category search */
#vendor-input {
  width: 400px;
  min-width: 300px;
}

/* Smaller input for location search */
#location-input {
  width: 200px;
  min-width: 150px;
}

button {
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.15);
}

button:active {
  transform: translateY(0);
}

/* Autocomplete Styles */
.autocomplete-box {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 999;
  width: 100%;
  display: none;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.autocomplete-box div {
  padding: 0.75rem 1rem;
  cursor: pointer;
  background-color: #fff;
  color: #1e293b;
  transition: background-color 0.15s ease;
}

.autocomplete-box div:hover {
  background-color: #f8fafc;
}

/* Category Styles */
.categories,
.featured-vendors {
  padding: 3rem 0;
}

.categories h2,
.featured-vendors h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: #0f172a;
  text-align: center;
}

.category-list {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  justify-content: center;
}

.category {
  background: white;
  padding: 0.875rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid #e2e8f0;
  transition: all 0.2s ease;
  font-weight: 500;
  color: #475569;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.category:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.1);
}

.category.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-color: #3b82f6;
}

.more-categories {
  margin-top: 1rem;
}

.more-categories details {
  text-align: center;
}

.more-categories summary {
  cursor: pointer;
  font-weight: 500;
  color: #3b82f6;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.more-categories summary:hover {
  background-color: #f1f5f9;
}

.more-categories .category-list {
  margin-top: 1rem;
}

/* Vendor card layout - Modern Cards */
.vendor-card {
  display: block;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.vendor-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.vendor-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e1;
}

.vendor-card:hover::before {
  opacity: 1;
}

.vendor-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f172a;
}

.vendor-card p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
  color: #64748b;
  line-height: 1.5;
}

.category-hits {
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.category-hits .category {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  color: #0369a1;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.category-hits .category:hover {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  transform: translateY(-1px);
}

/* Search Results */
.search-results {
  padding: 3rem 0;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  z-index: 1000;
}

.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px 0 rgba(0, 0, 0, 0.2);
}

.back-to-top.show {
  display: flex;
}

/* Footer */
footer {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  padding: 4rem 2rem 2rem;
  margin-top: 4rem;
  position: relative;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #3b82f6, transparent);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 3rem;
}

.footer-section h3 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #f8fafc;
}

.footer-section p,
.footer-section a {
  color: #cbd5e1;
  text-decoration: none;
  line-height: 1.7;
  transition: color 0.2s ease;
}

.footer-section a:hover {
  color: #3b82f6;
}

.footer-bottom {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #334155;
  color: #94a3b8;
}

/* Form Styles */
.register-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 250px;
}

.register-form input,
.register-form textarea,
.register-form select {
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  transition: all 0.2s ease;
  outline: none;
}

.register-form input:focus,
.register-form textarea:focus,
.register-form select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.register-form textarea {
  resize: vertical;
  min-height: 120px;
}

.register-form button {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.register-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.15);
}

.form-submit {
  text-align: right;
}

/* Modal improvements */
#register-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  overflow-y: auto;
  padding: 1rem;
}

#register-modal > div {
  background: white;
  padding: 2rem;
  max-width: 600px;
  margin: 2rem auto;
  border-radius: 8px;
  position: relative;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

#close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #64748b;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

#close-modal:hover {
  background-color: #f1f5f9;
  color: #1e293b;
}

/* Ensure consistent input styling */
.register-form input[type="text"],
.register-form input[type="email"],
.register-form input[type="tel"],
.register-form input[type="url"] {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  transition: all 0.2s ease;
  outline: none;
  box-sizing: border-box;
}

.register-form input[type="text"]:focus,
.register-form input[type="email"]:focus,
.register-form input[type="tel"]:focus,
.register-form input[type="url"]:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Utility Classes */
.dimmed {
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-menu {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .nav-menu.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 2rem;
    gap: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  }

  .form-row {
    flex-direction: column;
  }

  form {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .search-inputs {
    flex-direction: column;
    width: 100%;
  }

  .input-group {
    width: 100%;
  }

  #vendor-input,
  #location-input {
    width: 100% !important;
    min-width: auto;
  }

  /* Buttons container */
  #search-form-buttons {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
  }

  #search-form-buttons button {
    flex: 1;
    width: auto;
  }

  .autocomplete-box {
    max-height: 200px;
    font-size: 1rem;
  }

  header {
    padding: 1.5rem 1rem;
  }

  header h1 {
    font-size: 2rem;
  }

  header p {
    font-size: 1rem;
  }

  .categories,
  .featured-vendors {
    padding: 2rem 0;
  }

  .container {
    padding: 0 1rem;
  }

  main {
    padding: 1rem;
  }

  .nav-content {
    padding: 0 1rem;
  }

  /* Modal responsive styles */
  #register-modal {
    padding: 0.5rem;
  }

  #register-modal > div {
    margin: 1rem auto;
    padding: 1.5rem;
    max-height: calc(100vh - 2rem);
  }

  .register-form {
    padding: 1rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.75rem;
  }

  .categories h2,
  .featured-vendors h2 {
    font-size: 1.5rem;
  }

  .vendor-card {
    padding: 1rem;
  }

  .container {
    padding: 0 0.75rem;
  }

  header {
    padding: 2rem 0.75rem;
  }

  .nav-content {
    padding: 0 0.75rem;
  }
}

.vendor-header {
  padding: 3rem 2rem;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  position: relative;
}
.vendor-title-block {
  margin-bottom: 1.5rem;
  text-align: left;
}
.vendor-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 2.5rem;
  flex-wrap: nowrap;
  margin-bottom: 0.5rem;
}
.vendor-title-block {
  flex: 0 0 auto;
  min-width: 260px;
  text-align: left;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}
.vendor-header-block {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  width: 100%;
}
.vendor-stats-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 2.5rem;
}
.stat-blocks {
  display: flex;
  gap: 1.5rem;
  flex: 1 1 auto;
  justify-content: flex-start;
  align-items: center;
}
.stat-item {
  width: 160px;
  flex: 0 0 160px;
  min-width: 0;
  max-width: none;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 1.2rem 1.2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.featured-badge {
  flex: 0 0 auto;
  align-self: center;
  margin-left: 2rem;
  width: auto;
  min-width: unset;
  max-width: unset;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.1rem;
  padding: 0.5rem 1.5rem;
  background: #ffd700; /* gold background */
  color: #1c1c1e;      /* dark text */
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.04);
  margin-bottom: 0.5rem; /* reduce whitespace below */
}
.rating-stars {
  color: #fbbf24;
  font-size: 1.5rem;
  margin-right: 0.5rem;
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
}
@media (max-width: 900px) {
  .vendor-header-row, .stat-blocks {
    flex-wrap: wrap;
    gap: 1rem;
  }
  .stat-item, .featured-badge {
    flex: 1 1 160px;
    min-width: 120px;
    max-width: none;
    width: auto;
  }
  .vendor-title-block {
    min-width: 0;
  }
  .vendor-header-block {
    gap: 0.7rem;
  }
}

/* Info block for business hours + contact */
.info-block {
  margin: 2rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 12px;
  border: 1px solid #bae6fd;
  padding: 2rem;
}
.business-hours-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}
.business-hours-contact .business-hours,
.business-hours-contact .contact-info {
  flex: 1 1 220px;
  min-width: 180px;
}
.info-block .contact-info {
  border-top: none;
  background: transparent;
  padding: 0;
}
@media (max-width: 768px) {
  .info-block {
    padding: 1rem;
    margin: 1rem;
  }
  .business-hours-contact {
    flex-direction: column;
    gap: 1rem;
  }
}
