:root {
  --primary: #16439c;
  --primary-dark: #0f2e6b;
  --secondary: #4b5563;
  --accent: #f3f4f6;
  --bg-body: #f9fafb;
  --white: #ffffff;
  --text-main: #111827;
  --text-muted: #4b5563;
  --radius: 4px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --max-width: 1200px;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

header {
  background-color: var(--white);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
  height: 80px;
  display: flex;
  align-items: center;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.logo-icon {
  background-color: var(--primary);
  padding: 0.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.025em;
  text-transform: uppercase;
}

.nav-links {
  display: none;
  gap: 2rem;
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
}

.nav-links a.active {
  border-bottom: 2px solid var(--primary);
  padding-bottom: 2px;
}

.hero {
  background: linear-gradient(rgba(22, 67, 156, 0.85), rgba(22, 67, 156, 0.85)), url('https://images.unsplash.com/photo-1589829545856-d10d557cf95f?auto=format&fit=crop&q=80&w=1200') center/cover no-repeat;
  color: var(--white);
  padding: 4rem 1rem;
  text-align: center;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.hero h2 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.hero p {
  font-size: 1.125rem;
  opacity: 0.9;
  font-weight: 300;
}

main {
  max-width: var(--max-width);
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.page-title {
  margin-bottom: 3rem;
  text-align: center;
}

@media (min-width: 768px) {
  .page-title {
    text-align: left;
  }
}

.page-title h2 {
  font-size: 2rem;
  font-weight: 700;
  position: relative;
  display: inline-block;
  padding-bottom: 0.5rem;
}

.page-title h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: var(--primary);
}

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

@media (min-width: 1024px) {
  .content-grid {
    grid-template-columns: 180px 1fr 280px;
  }
}

.sidebar-left, .sidebar-right {
  display: none;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .sidebar-left, .sidebar-right {
    display: flex;
  }
}

.banner-placeholder {
  background-color: #e5e7eb;
  border: 2px dashed #9ca3af;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-weight: 700;
  font-size: 1.5rem;
  cursor: default;
  transition: background-color 0.2s;
}

.banner-placeholder:hover {
  background-color: #d1d5db;
}

.banner-img, .banner-img-tall {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid #e5e7eb;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.banner-img:hover, .banner-img-tall:hover {
  transform: scale(1.02);
}

.banner-square {
  aspect-ratio: 1 / 1;
}

.banner-tall {
  height: 500px;
}

.directory-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Filters Section */
.filters-section {
  background-color: var(--white);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid #f3f4f6;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .filters-section {
    flex-direction: row;
    align-items: flex-end;
  }
}

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

.filter-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-group input, .filter-group select {
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-color: var(--white);
  /* Fix iOS default styles */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Custom Select Arrow for iOS/Others when appearance: none */
.filter-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

.filter-group input:focus, .filter-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 67, 156, 0.1);
}

.sort-buttons {
  display: flex;
  gap: 0.5rem;
}

.sort-buttons button {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  background-color: var(--white);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.sort-buttons button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: #f0f4ff;
}

.sort-buttons button.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.no-results {
  text-align: center;
  padding: 3rem;
  background-color: var(--white);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-style: italic;
}

/* Floating Button */
.float-btn {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  background-color: var(--primary);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) translate3d(0,0,0); /* translate3d for iOS GPU */
  transition: all 0.3s ease;
  z-index: 9999; /* Ensure it stays on top */
  -webkit-tap-highlight-color: transparent;
}

.float-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) translate3d(0,0,0);
}

.float-btn:hover {
  background-color: var(--primary-dark);
  transform: scale(1.1) translate3d(0,0,0);
}

@media (min-width: 1024px) {
  .float-btn {
    right: 3rem;
    bottom: 3rem;
  }
}

.directory-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.listing-card {
  background-color: var(--white);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid #f3f4f6;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.listing-card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.card-title:hover {
  text-decoration: underline;
}

.card-location {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-phone {
  background-color: var(--accent);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-block;
}

footer {
  background-color: #1f2937;
  color: var(--white);
  padding: 4rem 1.5rem 2rem;
  margin-top: 4rem;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}

@media (min-width: 768px) {
  .footer-content {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-info h4, .footer-links h4, .footer-contact h4 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.footer-info p {
  color: #9ca3af;
  max-width: 320px;
}

.footer-links ul {
  list-style: none;
  padding: 0;
}

.footer-links li {
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: #9ca3af;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--white);
}

.footer-contact p {
  color: #9ca3af;
  margin-bottom: 0.5rem;
}

.footer-bottom {
  border-top: 1px solid #374151;
  margin-top: 3rem;
  padding-top: 2rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}
