/* ============================================================
   TrellisSearch User Account Styles
   ============================================================ */

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f0f4f8;
  color: #2d3748;
  line-height: 1.6;
}

a { color: #3182ce; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Auth pages (login, register, etc.) ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  color: #1a365d;
  margin-bottom: 1.5rem;
  text-decoration: none;
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #1a365d;
}

.auth-sub {
  color: #718096;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.auth-form label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: #4a5568;
}

.auth-form input {
  display: block;
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font: inherit;
  font-size: 1rem;
  margin-top: 0.3rem;
  transition: border-color 0.15s;
}

.auth-form input:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49,130,206,0.15);
}

.hint {
  display: block;
  font-size: 0.78rem;
  color: #718096;
  font-weight: 400;
  margin-top: 0.25rem;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 0.75rem;
  background: #3182ce;
  color: white;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.15s;
}

.btn-primary:hover { background: #2b6cb0; }

.auth-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: #718096;
}

/* ---- Alerts ---- */
.alert {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error   { background: #fff5f5; color: #c53030; border: 1px solid #feb2b2; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }

/* ---- Dashboard ---- */
.dash-header {
  background: #1a365d;
  color: white;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.dash-logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  text-decoration: none;
}

.dash-nav {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
}

.dash-nav a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.9rem;
}

.dash-nav a.active,
.dash-nav a:hover { color: white; }

.dash-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.dash-welcome {
  margin-bottom: 1.5rem;
}

.dash-welcome h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a365d;
  margin-bottom: 0.75rem;
}

.dash-email-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: white;
  border: 1.5px solid #bee3f8;
  border-radius: 10px;
  padding: 0.6rem 1rem;
}

.badge-icon { font-size: 1.2rem; }

.dash-email-badge strong { display: block; color: #2b6cb0; }

.webmail-link {
  font-size: 0.8rem;
  color: #3182ce;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.dash-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.dash-card-wide { grid-column: 1 / -1; }

.dash-card h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #1a365d;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.view-all { font-size: 0.8rem; font-weight: 400; }

.dash-card label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 0.75rem;
}

.dash-card input[type="url"],
.dash-card select {
  display: block;
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  margin-top: 0.3rem;
}

.dash-card .btn-primary {
  margin-top: 1rem;
  width: auto;
  padding: 0.55rem 1.2rem;
  display: inline-block;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600 !important;
}

.checkbox-label input { width: auto !important; }

/* Bookmarks */
.bookmark-list { display: flex; flex-direction: column; gap: 0.5rem; }

.bookmark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  border-radius: 6px;
  background: #f7fafc;
  gap: 0.5rem;
}

.bookmark-item a { font-size: 0.9rem; font-weight: 500; }

.bm-domain {
  display: block;
  font-size: 0.75rem;
  color: #718096;
}

.btn-icon {
  background: none;
  border: none;
  color: #a0aec0;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

.btn-icon:hover { color: #e53e3e; background: #fff5f5; }

.btn-text {
  background: none;
  border: none;
  color: #e53e3e;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
}

/* History */
.history-list { display: flex; flex-direction: column; gap: 0.25rem; }

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}

.history-item:hover { background: #ebf8ff; }
.hist-query { font-size: 0.9rem; }
.hist-meta  { font-size: 0.78rem; color: #718096; }

/* Submissions */
.submission-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.4rem; }

.submission-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.3rem 0;
  border-top: 1px solid #f0f4f8;
}

.sub-url { color: #4a5568; }

.sub-status {
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.status-pending  { background: #fefcbf; color: #744210; }
.status-approved { background: #c6f6d5; color: #276749; }
.status-rejected { background: #fed7d7; color: #c53030; }

.empty-msg { color: #718096; font-size: 0.9rem; }

@media (max-width: 640px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card-wide { grid-column: 1; }
}

/* ---- Register page layout ---- */
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
@media(max-width:500px){ .form-row { grid-template-columns:1fr; } }
.auth-card { max-width:520px; }

/* Business listings in dashboard */
.biz-listing-list { display:flex; flex-direction:column; gap:.5rem; margin-top:.75rem; }
.biz-listing-row { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.85rem 1.25rem; background:#fff; border:1px solid #e5e7eb; border-radius:10px; flex-wrap:wrap; }
.biz-listing-meta { display:flex; flex-direction:column; gap:.25rem; }
.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; font-size:.78rem; }
.biz-listing-btns { display:flex; gap:.4rem; flex-wrap:wrap; }
.biz-listing-btns a { padding:.35rem .8rem; border-radius:6px; font-size:.8rem; font-weight:600; text-decoration:none; background:#f3f4f6; color:#374151; border:1px solid #e5e7eb; transition:background .15s; }
.biz-listing-btns a:hover { background:#e5e7eb; }
.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; }
}
