/**
 * SEO Page Styles
 * Shared styles for all SEO landing pages (geo, niche, custom)
 *
 * Loaded via: /assets/styles/seo.css
 * Only loaded on SEO pages, not on main app pages.
 *
 * Uses CSS variables from theme.css for consistent theming.
 */

/* ============================================================================
   Base Page Layout
   ============================================================================ */

body {
  margin: 0;
  font-family: var(--font-text, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: var(--font-text-size, 1rem);
  line-height: var(--font-text-line-height, 1.6);
  color: var(--foreground);
  background: var(--background);
}

#page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--foreground);
}

.seo-page {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.seo-main {
  flex: 1;
}

.seo-content {
  /* Content width is controlled by .seo-page-main container */
  margin: 0 auto;
}

.seo-content h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

/* ============================================================================
   Content Body Styles
   ============================================================================ */

/* Capitalize headings (handles lowercase template variables like {{niche}}) */
.seo-content h1,
.seo-content h2,
.seo-content h3,
.seo-content h4,
.seo-content h5,
.seo-content h6,
.seo-body h1,
.seo-body h2,
.seo-body h3,
.seo-body h4,
.seo-body h5,
.seo-body h6 {
  text-transform: capitalize;
}

.seo-body {
  font-size: 1.125rem;
  line-height: 1.7;
}

.seo-body h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.seo-body h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.seo-body p {
  margin-bottom: 1rem;
}

.seo-body p.intro {
  font-size: 1.25rem;
  color: var(--muted);
  line-height: 1.6;
}

.seo-body ul {
  list-style: none;
  padding-left: 0;
}

.seo-body ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.seo-body ul li::before {
  content: "\2713"; /* checkmark */
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: bold;
}

.seo-body strong {
  color: var(--foreground);
}

.seo-body ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.seo-body ol li {
  margin-bottom: 0.5rem;
  padding-left: 0;
}

.seo-body ol li::before {
  content: none;
}

.seo-body a {
  color: var(--primary);
}

/* ============================================================================
   Location Image (Geo Pages)
   ============================================================================ */

.seo-location-image {
  margin-bottom: 2rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.seo-location-image img {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: cover;
  display: block;
}

/* ============================================================================
   Map Embed (Geo Pages)
   ============================================================================ */

.seo-map {
  margin: 2rem 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.seo-map iframe {
  width: 100%;
  height: 300px;
  border: 0;
  display: block;
}

.seo-map-placeholder {
  width: 100%;
  height: 300px;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

/* ============================================================================
   Hero Banner (Custom/Campaign Pages)
   ============================================================================ */

.seo-hero {
  position: relative;
  margin: -2rem -2rem 2rem -2rem;
  padding: 4rem 2rem;
  background-size: cover;
  background-position: center;
  text-align: center;
  color: white;
}

.seo-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.7) 100%);
}

.seo-hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.seo-hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.seo-hero p {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.95;
}

.seo-hero .seo-cta-btn {
  font-size: 1.25rem;
  padding: 1rem 2.5rem;

}

/* ============================================================================
   Call to Action
   ============================================================================ */

.seo-cta {
  margin-top: 3rem;
  padding: 2rem;
  background: var(--card-bg);
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--primary);
}

.seo-cta h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.seo-cta p {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.seo-cta-btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.125rem;
}

/* ============================================================================
   Cross-Linking Section
   ============================================================================ */

.seo-crosslinks {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.seo-crosslinks h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--muted);
}

.seo-crosslinks-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.seo-crosslink {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--card-bg);
  border-radius: 6px;
  color: var(--foreground);
  text-decoration: none;
  font-size: 0.875rem;
}

/* Multiple cross-link sections */
.seo-crosslinks + .seo-crosslinks {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
}

/* ============================================================================
   Child Locations (for country/state geo pages)
   ============================================================================ */

.seo-child-locations {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.seo-location-group {
  margin-bottom: 2rem;
}

.seo-location-group:last-child {
  margin-bottom: 0;
}

.seo-location-group h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--foreground);
}

.seo-location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.seo-location-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border-radius: 8px;
  border:1px solid var(--primary);
  color: var(--foreground);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
}

/* Back to state link */
.seo-back-link {
  margin-top: 1.5rem;
}

.seo-location-link.seo-back {
  display: inline-flex;
  background: transparent;
  color: var(--muted);
}

@media (max-width: 768px) {
  .seo-location-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .seo-location-link {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
  }

  .seo-location-group h3 {
    font-size: 1.25rem;
  }
}

/* ============================================================================
   Member Grid
   ============================================================================ */

.seo-members {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.seo-members h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
}

.seo-member-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.seo-member-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);

}

.seo-member-photo {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--border);
}

.seo-member-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.seo-member-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--border) 0%, var(--card-bg) 100%);
}

/* Overlay with name, age, location at bottom of photo */
.seo-member-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 0.625rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.seo-member-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seo-member-location {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Title below the photo - 2 lines with ellipsis */
.seo-member-card .seo-member-title {
  padding: 0.5rem 0.625rem;
  font-size: var(--text-xs);
  font-weight: 200;
  line-height: 1.4;
  color: var(--foreground);
  background: var(--card-bg);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 4rem;
}

/* ============================================================================
   SEO Page Header (override main site fixed header)
   ============================================================================ */

/* Override fixed-header padding — SEO header is static, not fixed */
#page-seo,
#page-wrapper {
  padding-top: 0;
}

/* SEO pages use relative header, not fixed */
#page-wrapper #site-header {
  position: static;
  display: flex;
  align-items: center;
  height: var(--header-height, 70px);
  padding: 0;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

#page-wrapper #site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 80rem;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}

#page-wrapper #site-header .header-left {
  display: flex;
  align-items: center;
}

#page-wrapper #site-header .site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

#page-wrapper #site-header .site-logo img {
  height: 40px;
  max-width: 200px;
}

#page-wrapper #site-header .site-logo-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
}

#page-wrapper #site-header .header-actions {
  display: flex;
  align-items: center;
}

#page-wrapper #site-header .login-link {
  padding: 0.5rem 1.25rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.9375rem;
}

/* ============================================================================
   SEO Page Main Content
   ============================================================================ */

.seo-page-main {
  flex: 1;
  max-width: 80rem;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
}

/* ============================================================================
   SEO Page Footer (uses #site-footer from main styles)
   ============================================================================ */

#page-wrapper #site-footer {
  margin-top: auto;
}

#page-wrapper #site-footer .container {
  max-width: 80rem;
  margin: 0 auto;
}

#page-wrapper #site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

#page-wrapper #site-footer .footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
}

#page-wrapper #site-footer .footer-links {
  gap: 1rem;
}

/* ============================================================================
   Responsive Styles
   ============================================================================ */

@media (max-width: 768px) {
  .seo-main {
    padding: 1.5rem;
  }

  .seo-page-main {
    padding: 1.5rem 1rem;
  }

  .seo-content h1 {
    font-size: 1.75rem;
  }

  .seo-body {
    font-size: 1rem;
  }

  .seo-location-image img {
    max-height: 250px;
  }

  .seo-map iframe {
    height: 200px;
  }

  .seo-hero {
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
    padding: 3rem 1.5rem;
  }

  .seo-hero h1 {
    font-size: 2rem;
  }

  .seo-hero p {
    font-size: 1.125rem;
  }

  .seo-member-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .seo-member-overlay {
    padding: 0.375rem 0.5rem;
  }

  .seo-member-title {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
  }

  #page-wrapper #site-header .site-logo img {
    height: 32px;
  }

  #page-wrapper #site-header .login-link {
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  .seo-member-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .seo-member-name {
    font-size: 0.8125rem;
  }

  .seo-member-location {
    font-size: 0.6875rem;
  }

  .seo-member-title {
    font-size: 0.6875rem;
  }

  .seo-crosslinks-grid {
    gap: 0.375rem;
  }

  .seo-crosslink {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }
}

/* ============================================================================
   Dark Mode Support
   ============================================================================ */

/* Dark mode is handled automatically through the site's CSS variables.
   The --background, --foreground, --card, --border, etc. variables
   are set by the site's theme system based on user preference. */

/* ============================================================================
   Cookie Consent (not loaded from site CSS on SEO pages)
   ============================================================================ */

#cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: var(--space-4);
  background-color: var(--tooltip-bg);
  color: var(--tooltip-text);
}

#cookie-consent .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-base);
  max-width: 80rem;
  margin: 0 auto;
}

@media (min-width: 640px) {
  #cookie-consent .container {
    flex-direction: row;
  }
  #cookie-consent p {
    text-align: left;
  }
}

#cookie-consent p {
  font-size: var(--text-sm);
  text-align: center;
  margin: 0;
}

#cookie-consent a {
  color: inherit;
  text-decoration: underline;
}

#cookie-consent .cookie-consent-buttons {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

#cookie-consent .btn-accept {
  padding: var(--space-2) var(--space-6);
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
  border: none;
  border-radius: var(--button-radius);
  cursor: pointer;
  white-space: nowrap;
}

#cookie-consent .btn-manage {
  padding: var(--space-2) var(--space-4);
  background-color: transparent;
  color: var(--tooltip-text);
  font-weight: 500;
  border: 1px solid var(--tooltip-text);
  border-radius: var(--button-radius);
  cursor: pointer;
  white-space: nowrap;
}

/* ============================================================================
   Consent Modal (cookie preferences dialog)
   ============================================================================ */

dialog.modal {
  position: fixed;
  background: var(--popup-bg);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 1rem;
  width: calc(100% - 2rem);
  max-width: 420px;
  max-height: fit-content;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  margin: auto;
  margin-top: 5rem;
  padding: 0;
}

dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

dialog.modal header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  border-radius: 1rem 1rem 0 0;
}

dialog.modal header h2 {
  margin: 0 1rem;
  font-size: 1.125rem;
  font-weight: 400;
  text-align: center;
}

dialog.modal header [data-action="close"] {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: 9999px;
}

dialog.modal section {
  padding: var(--space-4) var(--space-8);
}

dialog.modal footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--gap-base);
  justify-content: center;
}

body:has(dialog[open]) {
  overflow: hidden;
}

/* Buttons for consent modal footer */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--button-radius);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: 0.3s;
  border-radius: 9999px;
}

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

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Consent Content */
#consent section { display: flex; flex-direction: column; gap: var(--space-4); }
#consent article { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2) var(--space-3); }
#consent article > div { display: flex; align-items: center; gap: var(--space-2); }
#consent article strong { font-weight: 600; color: var(--foreground); }
#consent article em { font-size: var(--text-xs); font-style: normal; color: var(--muted); background-color: var(--border); padding: 2px 6px; border-radius: var(--radius-sm); }
#consent article p { font-size: var(--text-xs); color: var(--muted); }
#consent article ul { margin: var(--space-2) 0 0; padding-left: var(--space-4); font-size: var(--text-xs); color: var(--muted); }
#consent article ul li { margin-bottom: 2px; }
