/* ===========================================
   Public Search UI  -  style.css
   Clean, fast, accessible
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=DM+Mono&display=swap');

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

:root {
  --bg:        #ffffff;
  --surface:   #f8f9fa;
  --border:    #e0e0e0;
  --text:      #202124;
  --muted:     #5f6368;
  --link:      #1a0dab;
  --link-vis:  #681da8;
  --accent:    #4285f4;
  --green:     #137333;
  --url-color: #188038;
  --mark-bg:   #fff3cd;
  --danger:    #c5221f;
  --radius:    8px;
  --font:      'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
}

body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a { color: var(--link); text-decoration: none; }
a:visited { color: var(--link-vis); }
a:hover { text-decoration: underline; }

/* ---- HOME ---- */
.home { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.home-wrap { text-align: center; width: 100%; max-width: 560px; padding: 2rem; }
.logo-large {
  font-size: 3.2rem;
  font-weight: 600;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent), #34a853, #fbbc04, #ea4335);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 2rem;
}

/* ---- SEARCH BOX ---- */
.search-box-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: .45rem .6rem .45rem 1.2rem;
  background: var(--bg);
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
  transition: box-shadow .2s, border-color .2s;
}
.search-box-wrap:focus-within {
  box-shadow: 0 2px 12px rgba(0,0,0,.14);
  border-color: transparent;
}
.search-box-wrap input[type="search"] {
  flex: 1;
  border: none;
  outline: none;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
}
.search-box-wrap input[type="search"]::-webkit-search-cancel-button { display: none; }
.btn-search {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: .35rem;
  border-radius: 50%;
  transition: background .15s;
}
.btn-search:hover { background: var(--surface); color: var(--accent); }

.home-links { margin-top: 1.5rem; }
.home-links a { color: var(--muted); font-size: .9rem; margin: 0 .5rem; }
.home-links a:hover { color: var(--text); }

/* ---- RESULTS HEADER ---- */
.results-header {
  display: flex;
  align-items: center;
  padding: .75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  gap: 1.5rem;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.logo-small {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -.5px;
  background: linear-gradient(135deg, var(--accent), #34a853);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  flex-shrink: 0;
}
.search-form-top { flex: 1; max-width: 560px; }
.search-form-home { width: 100%; }

/* ---- RESULTS ---- */
.results-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}
.results-meta { color: var(--muted); font-size: .85rem; margin-bottom: 1.25rem; }
.results-list { list-style: none; }

.result-item {
  margin-bottom: 1.75rem;
  max-width: 660px;
}
.result-domain {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .15rem;
}
.domain-text {
  font-size: .8rem;
  color: var(--muted);
  font-family: var(--font-mono);
}
.result-title { font-size: 1.15rem; font-weight: 500; line-height: 1.3; margin: .1rem 0 .2rem; }
.result-title a { color: var(--link); }
.result-title a:hover { text-decoration: underline; }
.result-url { font-size: .78rem; color: var(--url-color); margin-bottom: .3rem; word-break: break-all; }
.result-snippet { font-size: .92rem; color: var(--muted); line-height: 1.6; }
.result-snippet mark {
  background: var(--mark-bg);
  color: var(--text);
  font-weight: 500;
  padding: 0 1px;
  border-radius: 2px;
}

/* ---- NO RESULTS ---- */
.no-results { padding: 2rem 0; color: var(--muted); }
.no-results strong { color: var(--text); }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: 2rem; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 .6rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; color: var(--accent); text-decoration: none;
  transition: background .15s;
}
.page-btn:hover  { background: var(--surface); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- NOTICES ---- */
.notice {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .95rem;
}
.notice.success { background: #e6f4ea; color: var(--green); border-left: 4px solid var(--green); }
.notice.error   { background: #fce8e6; color: var(--danger); border-left: 4px solid var(--danger); }
.notice.info    { background: #e8f0fe; color: #1967d2; border-left: 4px solid #4285f4; }

/* ---- SUBMIT PAGE ---- */
.submit-page .results-header { margin-bottom: 0; }
.submit-main {
  max-width: 600px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}
.submit-main h1 { font-size: 1.8rem; margin-bottom: 1rem; }
.submit-form { margin: 1.5rem 0; }
.submit-form label { display: block; font-weight: 500; margin-bottom: .4rem; }
.url-input-wrap { display: flex; gap: .6rem; }
.url-input-wrap input[type="url"] {
  flex: 1;
  padding: .6rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color .2s;
}
.url-input-wrap input[type="url"]:focus { border-color: var(--accent); }
.hint { font-size: .82rem; color: var(--muted); margin-top: .4rem; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .6rem 1.2rem;
  border-radius: var(--radius);
  font: inherit;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #1a73e8; }

.submit-guidelines {
  margin-top: 2rem;
  padding: 1.2rem;
  background: var(--surface);
  border-radius: var(--radius);
}
.submit-guidelines h2 { font-size: 1rem; margin-bottom: .6rem; }
.submit-guidelines ul { padding-left: 1.3rem; color: var(--muted); font-size: .9rem; }
.submit-guidelines li { margin-bottom: .3rem; }

/* ---- DOMAIN SEARCH BANNER ---- */
.domain-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #e8f0fe;
  border: 1px solid #c5d8fb;
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  margin-bottom: 1.25rem;
}
.domain-banner-icon { font-size: 1.8rem; }
.domain-banner-title { font-size: 1rem; font-weight: 500; color: var(--text); }
.domain-banner-sub { font-size: .82rem; color: var(--muted); margin-top: .15rem; }

/* ---- DOMAIN DIVIDER (in domain search) ---- */
.domain-divider {
  list-style: none;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  padding: .6rem 0 .3rem;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
  letter-spacing: .02em;
}
.domain-divider:first-child { border-top: none; padding-top: 0; }

/* ---- BACKLINK BADGE ---- */
.backlink-badge {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-size: .72rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .1rem .45rem;
  margin-left: .4rem;
  font-family: var(--font-mono);
}

/* ---- FOOTER ---- */
.results-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: .85rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
.results-footer a { color: var(--muted); }

@media (max-width: 600px) {
  .results-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .search-form-top { width: 100%; max-width: none; }
  .results-main { padding: 1rem; }
}

/* ---- HOME PAGE LEGAL LINKS ---- */
.home-legal {
  margin-top: 1.25rem;
  font-size: .82rem;
  color: var(--muted);
}
.home-legal a { color: var(--muted); }
.home-legal a:hover { color: var(--text); }

/* ---- Home page indexed count ---- */
.index-count {
    color: var(--muted, #6b7280);
    font-size: .85rem;
    margin: .5rem 0 1rem;
    text-align: center;
}
.index-count strong {
    color: var(--text, #1a1a2e);
}

.dashboard-biz-card { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.75rem 1rem; background:#fff; border:1px solid #e5e7eb; border-radius:8px; margin-bottom:.5rem; flex-wrap:wrap; }
.dashboard-biz-info { display:flex; flex-direction:column; gap:.15rem; }
.dashboard-biz-actions { display:flex; gap:.5rem; flex-wrap:wrap; }
.btn-small { padding:.3rem .75rem; border-radius:6px; font-size:.8rem; font-weight:600; text-decoration:none; background:#f3f4f6; color:#374151; border:1px solid #e5e7eb; }
.btn-small:hover { background:#e5e7eb; }
.btn-small.btn-primary { background:#3b82f6; color:#fff; border-color:#3b82f6; }
.btn-small.btn-primary:hover { background:#2563eb; }
.dashboard-biz-card { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.75rem 1rem; background:var(--bg,#fff); border:1px solid var(--border,#e5e7eb); border-radius:8px; margin-bottom:.5rem; flex-wrap:wrap; }
.dashboard-biz-info { display:flex; flex-direction:column; gap:.15rem; }
.dashboard-biz-actions { display:flex; gap:.5rem; flex-wrap:wrap; }

/* Business listings in dashboard */
.biz-listing-list { display:flex; flex-direction:column; gap:.5rem; margin-top:.5rem; }
.biz-listing-row { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.85rem 1rem; background:#fff; border:1px solid #e5e7eb; border-radius:8px; flex-wrap:wrap; }
.biz-listing-meta { display:flex; flex-direction:column; gap:.2rem; }
.biz-listing-name { font-weight:700; font-size:.95rem; color:#111827; }
.biz-listing-loc { font-size:.8rem; color:#6b7280; }
.biz-listing-stars { font-size:.82rem; color:#f59e0b; }
.biz-listing-rc { color:#9ca3af; margin-left:.2rem; }
.biz-listing-btns { display:flex; gap:.4rem; flex-wrap:wrap; }
.dash-add-link { margin-top:.75rem; font-size:.85rem; }
/* ===========================================
   MOBILE RESPONSIVE - append to respective CSS files
   Breakpoints: 768px (tablet), 480px (phone)
   =========================================== */

/* ============================================
   style.css additions
   ============================================ */

/* ---- Search results header ---- */
@media (max-width: 768px) {
  .results-header { flex-direction: column; align-items: flex-start; gap: .5rem; padding: .75rem 1rem; }
  .search-form-top { width: 100%; max-width: none; }
  .search-form-top input[type="text"] { font-size: 16px; } /* prevent iOS zoom */
  .results-main { padding: .75rem 1rem; flex-direction: column; }
  .results-col { width: 100%; }
  .biz-panel { margin-bottom: 1rem; width: 100%; }
  .result-item { padding: .75rem 0; }
  .result-title { font-size: 1rem; }
  .result-url { font-size: .75rem; }
  .search-filters { gap: .3rem; }
  .filter-chip { font-size: .75rem; padding: .2rem .55rem; }
  /* Home page */
  .home-wrap { padding: 1.5rem 1rem; }
  .logo-large { font-size: 2.2rem; }
  .search-box { flex-direction: row; }
  .search-box input { font-size: 16px; }
  /* Pagination */
  .pagination { flex-wrap: wrap; gap: .3rem; justify-content: center; }
}

@media (max-width: 480px) {
  .logo-large { font-size: 1.8rem; }
  .results-header { padding: .5rem .75rem; }
  .results-main { padding: .5rem .75rem; }
  .biz-listing-row { flex-direction: column; align-items: flex-start; }
  .biz-listing-btns { width: 100%; }
  .biz-listing-btns a { flex: 1; text-align: center; }
}

/* ============================================
   admin.css additions
   ============================================ */

@media (max-width: 768px) {
  /* Collapse sidebar to top nav on mobile */
  .admin-layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    overflow-y: visible;
    padding: .5rem;
  }
  .sidebar-logo { padding: .5rem .75rem; border-bottom: none; flex: 0 0 auto; }
  .sidebar-nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: .25rem; padding: .25rem; width: 100%; }
  .sidebar-nav a { padding: .35rem .7rem; font-size: .78rem; border-radius: 6px; }
  .sidebar-footer { display: none; }
  .admin-main { padding: 1rem; min-height: auto; }
  .admin-topbar { flex-wrap: wrap; gap: .5rem; padding: .75rem 1rem; }
  /* Stats grid */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .stat-card { padding: .75rem; }
  .stat-num { font-size: 1.5rem; }
  /* Tables */
  .users-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .users th, .users td { padding: .4rem .5rem; font-size: .78rem; white-space: nowrap; }
  /* Tab nav */
  .tab-nav { gap: .25rem; }
  .tab-link { padding: .3rem .6rem; font-size: .75rem; }
  /* Search bar */
  .admin-search-form { flex-wrap: wrap; }
  .admin-search-form input { width: 100%; }
  /* Crawl activity */
  .crawl-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  /* Action buttons */
  .actions { flex-wrap: wrap; gap: .25rem; }
  .act-btn { padding: .25rem .5rem; font-size: .72rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-main { padding: .75rem; }
  .sidebar-nav a { font-size: .72rem; padding: .3rem .5rem; }
}

/* ============================================
   user.css additions
   ============================================ */

@media (max-width: 768px) {
  /* Dashboard header */
  .dash-header { flex-wrap: wrap; gap: .5rem; padding: .75rem 1rem; }
  .dash-nav { gap: .5rem; }
  .dash-nav a { font-size: .82rem; }
  /* Welcome section */
  .dash-welcome { padding: 1rem; }
  .dash-container { padding: 1rem; }
  /* Grid */
  .dash-grid { grid-template-columns: 1fr; gap: .75rem; }
  .dash-card { padding: 1rem; }
  .dash-card-wide { grid-column: 1; }
  /* Business listing */
  .biz-listing-row { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .biz-listing-btns { width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); }
  .biz-listing-btns a { text-align: center; }
  /* Auth forms */
  .auth-card { padding: 1.5rem 1rem; margin: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  /* Buttons */
  .btn-primary, .btn-secondary { width: 100%; text-align: center; padding: .65rem 1rem; }
}

@media (max-width: 480px) {
  .dash-header { padding: .5rem .75rem; }
  .dash-container { padding: .75rem; }
  .dash-welcome h1 { font-size: 1.25rem; }
  .biz-listing-btns { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   business.css additions
   ============================================ */

@media (max-width: 768px) {
  /* Knowledge panel */
  .biz-panel { padding: 1rem; }
  .biz-panel-header { flex-direction: column; gap: .5rem; }
  .biz-map-links { flex-wrap: wrap; gap: .4rem; }
  .biz-map-btn { flex: 1; text-align: center; min-width: 100px; }
  /* Hours table */
  .biz-hours-table { font-size: .82rem; }
  .biz-hours-table td, .biz-hours-table th { padding: .3rem .4rem; }
  /* OSM map */
  .biz-osm-wrap iframe { height: 160px; }
  /* Submit/manage forms */
  .biz-submit-wrap { padding: 1rem; }
  .biz-form label { font-size: .88rem; }
  .field-row { flex-direction: column; gap: .5rem; }
  /* Hours grid */
  .hours-header { grid-template-columns: 80px 50px 1fr 1fr 70px; font-size: .72rem; }
  .hours-row    { grid-template-columns: 80px 50px 1fr 1fr 70px; }
  .copy-hours-btn { font-size: .65rem; padding: .15rem .3rem; }
  /* Category grid */
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  /* Nearby grid */
  .nearby-grid { grid-template-columns: 1fr 1fr; }
  /* Reviews */
  .review-header { flex-wrap: wrap; gap: .3rem; }
  .star-picker label { font-size: 1.6rem; }
  /* Nearby controls */
  .nearby-controls { flex-direction: column; align-items: stretch; }
  .nearby-controls select { width: 100%; }
}

@media (max-width: 480px) {
  .biz-panel { padding: .75rem; }
  .biz-map-links { flex-direction: column; }
  .biz-map-btn, .biz-website-btn { width: 100%; text-align: center; }
  .hours-header { display: none; } /* hide header, labels on inputs instead */
  .hours-row { grid-template-columns: 1fr 40px 1fr 1fr; gap: .25rem; }
  .copy-hours-btn { display: none; } /* too small, use copy all buttons instead */
  .category-grid { grid-template-columns: 1fr; }
  .nearby-grid { grid-template-columns: 1fr; }
  .biz-category-list .biz-list-card { flex-direction: column; align-items: flex-start; }
}

/* ============================================
   search_enhancements.css additions
   ============================================ */

@media (max-width: 768px) {
  #suggest-box { border-radius: 0 0 8px 8px; }
  #suggest-box li { padding: .7rem 1rem; font-size: .88rem; }
  .related-searches { padding: .75rem 1rem; margin: 1rem 0; }
  .related-chip { font-size: .78rem; padding: .25rem .65rem; }
  .search-filters { padding: 0 .25rem; }
}

/* ============================================
   Global mobile utilities
   ============================================ */

/* Prevent horizontal scroll */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  img { max-width: 100%; height: auto; }
  table { max-width: 100%; }

  /* Touch-friendly tap targets */
  button, a, input[type="checkbox"], input[type="radio"] { min-height: 36px; }
  input[type="checkbox"], input[type="radio"] { min-height: auto; width: 18px; height: 18px; }

  /* Prevent iOS font size adjustment */
  * { -webkit-text-size-adjust: 100%; }

  /* Better scrollable tables */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
}
