:root {
  /* Ink / neutrals */
  --ink: #221b16;          /* primary text, dark surfaces */
  --ink-soft: #6b5d51;     /* secondary / muted text */
  --paper: #faf6f0;        /* page background */
  --paper-alt: #f1e7d8;    /* card / alt surface background */
  --line: #e3d5c1;         /* hairline borders */

  /* Brand accent — warm copper/amber ("dive bar, elevated") */
  --amber: #b8560d;
  --amber-dark: #8c3f09;
  --amber-tint: #f7e6cf;   /* light accent background (pills, hovers) */

  /* Status colors */
  --green: #2f6b45;
  --green-tint: #e4f0e6;
  --red: #a3372b;
  --red-tint: #f7e5e2;

  /* Admin portal accent — deep steel blue, distinct from the public brand */
  --admin-accent: #2f5f7a;
  --admin-accent-dark: #1f4356;
  --admin-accent-tint: #e2edf1;
  --admin-surface: #1c2b36;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(34, 27, 22, 0.06), 0 1px 3px rgba(34, 27, 22, 0.08);
  --shadow-md: 0 4px 10px rgba(34, 27, 22, 0.08), 0 2px 4px rgba(34, 27, 22, 0.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.01em; }
h1 { font-weight: 800; }
h2 { font-weight: 700; }
a { color: var(--amber-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --- Header / Nav ------------------------------------------------------ */
.site-header, .portal-header {
  background: var(--ink);
  color: #fff;
  padding: 14px 0;
}
.admin-header { background: var(--admin-surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; position: relative; }
.brand {
  color: #fff; font-size: 1.3rem; font-weight: 700; display: inline-flex; align-items: center;
  gap: 8px; min-width: 0; flex-wrap: wrap; row-gap: 4px;
}
.brand img { display: block; flex-shrink: 0; }
.badge-portal { font-size: 0.7rem; background: var(--amber); padding: 2px 8px; border-radius: 20px; vertical-align: middle; }
.admin-portal .badge-portal { background: var(--admin-accent); }

.main-nav { display: flex; flex-wrap: wrap; align-items: center; }
.main-nav a { color: #f5ede1; margin-left: 18px; font-size: 0.95rem; padding: 4px 0; }
.main-nav a:first-child { margin-left: 0; }
.btn-small { background: var(--amber); color: #fff !important; padding: 6px 12px; border-radius: 20px; }
.admin-portal .btn-small { background: var(--admin-accent); }

/* Hamburger toggle button — hidden until JS confirms + narrow viewport */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  padding: 0;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  cursor: pointer;
}
.nav-toggle-bar { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; }

main.container { padding-top: 28px; padding-bottom: 60px; min-height: 60vh; }

/* --- Flash / status ----------------------------------------------------- */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 0.95rem; }
.flash-success { background: var(--green-tint); color: var(--green); border: 1px solid #c3e0c9; }
.flash-error { background: var(--red-tint); color: var(--red); border: 1px solid #ecc4bc; }

/* --- Buttons ------------------------------------------------------------ */
.btn, button.btn {
  display: inline-block;
  background: var(--amber);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  line-height: 1.3;
}
.btn:hover { background: var(--amber-dark); text-decoration: none; }
.btn-outline { background: transparent; border: 1px solid var(--amber); color: var(--amber-dark) !important; box-shadow: none; }
.btn-outline:hover { background: var(--amber-tint); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #7f2a20; }
.btn-link { background: none; border: none; color: var(--red); cursor: pointer; padding: 6px 0; font-size: 0.85rem; text-decoration: underline; box-shadow: none; }
.btn-link-danger { color: var(--red); }

.admin-portal .btn, .admin-portal button.btn { background: var(--admin-accent); }
.admin-portal .btn:hover { background: var(--admin-accent-dark); }
.admin-portal .btn-outline { border-color: var(--admin-accent); color: var(--admin-accent-dark) !important; }
.admin-portal .btn-outline:hover { background: var(--admin-accent-tint); }

/* --- Hero ---------------------------------------------------------------- */
.hero { text-align: center; padding: 40px 0 20px; }
.hero h1 { font-size: 2.2rem; }
.hero p { color: var(--ink-soft); max-width: 560px; margin: 0 auto 20px; }
.hero-search { display: flex; gap: 8px; max-width: 480px; margin: 0 auto 16px; }
.hero-search input { flex: 1; padding: 11px 14px; border-radius: var(--radius); border: 1px solid var(--line); font-size: 1rem; }
.hero-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0 40px; }
.tag-pill {
  background: var(--paper-alt); border: 1px solid var(--line); border-radius: 20px;
  padding: 6px 14px; font-size: 0.85rem; color: var(--ink);
}
.tag-pill:hover { background: var(--amber-tint); text-decoration: none; }
.tag-pill-static { cursor: default; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }

/* --- Bar cards / grid ----------------------------------------------------- */
.bar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; margin-top: 16px; }
.bar-card {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; color: var(--ink); box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.bar-card:hover { border-color: var(--amber); text-decoration: none; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.bar-card-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 6px 8px; }
.bar-card h3 { font-size: 1.1rem; margin-bottom: 4px; min-width: 0; overflow-wrap: break-word; }
.bar-card-location { color: var(--ink-soft); font-size: 0.85rem; margin: 4px 0; }
.price-range { color: var(--ink-soft); font-size: 0.85rem; margin-left: 8px; }
.stars { color: var(--amber); letter-spacing: 1px; }
.stars-empty { color: var(--ink-soft); font-size: 0.85rem; }

.empty-state { color: var(--ink-soft); padding: 30px 0; text-align: center; }

/* --- Location / distance --------------------------------------------------- */
.location-status { color: var(--ink-soft); font-size: 0.9rem; margin: -6px 0 16px; }
.distance-badge { color: var(--amber-dark); font-weight: 600; }
.nearby-badge {
  display: inline-block; margin-left: 8px; font-size: 0.75rem; font-weight: 600;
  color: var(--green); background: var(--green-tint); padding: 2px 8px; border-radius: 20px;
  white-space: nowrap;
}
.nearby-filter { display: inline-flex; align-items: center; }
.bars-map {
  height: 360px; width: 100%; border-radius: var(--radius); overflow: hidden;
  margin-bottom: 20px; border: 1px solid var(--line); background: var(--paper-alt);
}
.visitor-marker span {
  display: block; width: 14px; height: 14px; border-radius: 50%;
  background: var(--admin-accent, #2f5f7a); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--admin-accent, #2f5f7a);
}
@media (max-width: 640px) {
  .bars-map { height: 260px; }
}

/* --- Filter bar ------------------------------------------------------------ */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.filter-bar input, .filter-bar select { padding: 9px 10px; border-radius: var(--radius); border: 1px solid var(--line); font-size: 1rem; flex: 1; min-width: 130px; }
.filter-bar .nearby-filter { flex: 1 1 auto; min-width: 130px; }

/* --- Bar detail ------------------------------------------------------------ */
.bar-detail-header { display: flex; justify-content: space-between; align-items: start; gap: 20px; flex-wrap: wrap; }
.bar-detail-location { color: var(--ink-soft); }
.bar-detail-rating { text-align: right; }
.overall-number { display: block; color: var(--ink-soft); font-size: 0.85rem; }
.bar-hero-photo { margin: 16px 0; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); }
.bar-hero-photo img { width: 100%; max-height: 360px; object-fit: cover; }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 20px; padding-bottom: 4px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.photo-strip img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; flex-shrink: 0; scroll-snap-align: start; }

.bar-detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; margin-top: 20px; }
.bar-detail-grid section { margin-bottom: 26px; }
.editorial-review { background: var(--paper-alt); padding: 18px; border-radius: var(--radius); }
.rating-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 14px 0; }
.rating-breakdown span { display: block; font-size: 0.8rem; color: var(--ink-soft); }

.list-cards { list-style: none; padding: 0; margin: 0; }
.list-cards li { border-bottom: 1px solid var(--line); padding: 10px 0; }
.list-cards li:last-child { border-bottom: none; }
.schedule-text { color: var(--ink-soft); font-size: 0.85rem; margin-left: 8px; }

.visitor-review-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.visitor-review-list { margin-bottom: 20px; }
.visitor-review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.review-form { background: var(--paper-alt); padding: 16px; border-radius: var(--radius); max-width: 420px; }
.review-form select, .review-form textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 1rem; font-family: inherit; color: var(--ink); background: #fff;
}

.info-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.hours-table { width: 100%; font-size: 0.9rem; }
.hours-table td { padding: 4px 0; }
.hours-table td:first-child { color: var(--ink-soft); width: 90px; }

/* --- Auth / forms ----------------------------------------------------------- */
.auth-form { max-width: 420px; margin: 20px auto; background: #fff; border: 1px solid var(--line); padding: 26px; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
label { display: block; margin-bottom: 14px; font-size: 0.9rem; color: var(--ink-soft); }
label input, label select, label textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 11px; border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 1rem; font-family: inherit; color: var(--ink); background: #fff;
}
label input:focus, label select:focus, label textarea:focus,
.filter-bar input:focus, .filter-bar select:focus,
.hero-search input:focus,
.inline-add-form input:focus,
.reject-form textarea:focus {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
  border-color: var(--amber);
}
.admin-portal label input:focus, .admin-portal label select:focus, .admin-portal label textarea:focus,
.admin-portal .inline-add-form input:focus,
.admin-portal .reject-form textarea:focus {
  outline-color: var(--admin-accent);
  border-color: var(--admin-accent);
}
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.hint { color: var(--ink-soft); font-size: 0.85rem; }

/* --- Portal (owner/admin) --------------------------------------------------- */
.portal-body { background: var(--paper-alt); }
.portal-page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.portal-section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.status-banner { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ink-soft); padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.status-banner-approved { border-left-color: var(--green); }
.status-banner-pending { border-left-color: var(--amber); }
.status-banner-rejected { border-left-color: var(--red); }
.rejection-note { color: var(--red); font-size: 0.9rem; margin-top: 6px; }
.submit-form { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.data-table { width: 100%; min-width: 480px; border-collapse: collapse; background: #fff; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.status-pill { font-size: 0.75rem; padding: 3px 10px; border-radius: 20px; background: var(--paper-alt); white-space: nowrap; }
.status-approved { background: var(--green-tint); color: var(--green); }
.status-pending { background: var(--amber-tint); color: var(--amber-dark); }
.status-rejected { background: var(--red-tint); color: var(--red); }
.status-draft { background: #ece7e1; color: var(--ink-soft); }

.status-filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.status-filter-tabs a { padding: 7px 14px; border-radius: 20px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: 0.85rem; }
.status-filter-tabs a.active { background: var(--amber); color: #fff; border-color: var(--amber); }
.admin-portal .status-filter-tabs a.active { background: var(--admin-accent); border-color: var(--admin-accent); }

.hours-edit-table { width: 100%; margin-bottom: 14px; table-layout: fixed; }
.hours-edit-table th, .hours-edit-table td { padding: 6px 8px; text-align: left; font-size: 0.9rem; }
.hours-edit-table th:first-child, .hours-edit-table td:first-child { width: 24%; }
.hours-edit-table th:nth-child(2), .hours-edit-table td:nth-child(2) { width: 18%; }
.hours-edit-table input[type="time"] { width: 100%; font-size: 1rem; padding: 4px; border: 1px solid var(--line); border-radius: 6px; }
.hours-edit-table input[type="checkbox"] { width: 20px; height: 20px; }

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-bottom: 14px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--ink); padding: 4px 0; min-height: 28px; }
.checkbox-label input { width: 18px; height: 18px; margin: 0; flex-shrink: 0; }

.manage-list { list-style: none; padding: 0; margin: 0 0 16px; }
.manage-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.inline-add-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-add-form input:not([type=file]) { padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius); flex: 1; min-width: 140px; font-size: 1rem; }
.inline-add-form select { padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius); flex: 1; min-width: 140px; font-size: 1rem; background: #fff; }

.photo-manage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.photo-manage-item img { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }

.stat-row { display: flex; gap: 16px; margin-bottom: 30px; flex-wrap: wrap; }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 26px; text-align: center; min-width: 140px; flex: 1; box-shadow: var(--shadow-sm); }
.stat-number { display: block; font-size: 2rem; font-weight: 700; color: var(--amber-dark); }
.admin-portal .stat-number { color: var(--admin-accent-dark); }

.approval-controls .approval-buttons { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.reject-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.reject-form textarea { flex: 1; min-width: 200px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius); font-family: inherit; font-size: 1rem; }

/* --- Footer ------------------------------------------------------------------ */
.site-footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--ink-soft); font-size: 0.85rem; }

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

/* Tablet and below */
@media (max-width: 900px) {
  .container { padding: 0 18px; }
  .bar-detail-grid { gap: 22px; }
}

/* Nav collapse breakpoint (progressive enhancement — see nav.js) */
@media (max-width: 760px) {
  .bar-detail-grid { grid-template-columns: 1fr; }

  .js .nav-toggle { display: inline-flex; }
  .js .main-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    margin-top: 12px;
    gap: 2px;
  }
  .js .main-nav.is-open { display: flex; }
  .js .main-nav a {
    margin-left: 0;
    padding: 12px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .js .main-nav .btn-small {
    display: block;
    text-align: center;
    margin: 8px 0 0;
    padding: 12px;
    border-top: none;
  }
}

/* Phones */
@media (max-width: 640px) {
  .hero { padding: 28px 0 16px; }
  .hero h1 { font-size: 1.7rem; }
  .hero-search { flex-direction: column; max-width: 100%; }
  .hero-search .btn { padding: 12px; }

  .bar-detail-header { flex-direction: column; align-items: flex-start; }
  .bar-detail-rating { text-align: left; margin-top: 4px; }

  .portal-page-header { flex-direction: column; align-items: flex-start; }
  .portal-page-header .btn { width: 100%; text-align: center; }

  .stat-box { min-width: calc(50% - 8px); }

  .auth-form { padding: 20px; margin: 12px auto; }
}

/* Small phones — stack dense form grids, force full-width tap targets */
@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
  .checkbox-grid { grid-template-columns: 1fr 1fr; }
  .inline-add-form input:not([type=file]),
  .inline-add-form select,
  .inline-add-form .btn { flex-basis: 100%; }
  .reject-form textarea, .reject-form .btn { flex-basis: 100%; }

  .filter-bar input, .filter-bar select, .filter-bar .nearby-filter, .filter-bar .btn { flex-basis: 100%; }

  .btn, button.btn { width: 100%; text-align: center; }
  .submit-form { flex-direction: column; align-items: flex-start; }
  .approval-buttons { flex-direction: column; align-items: stretch; }

  .manage-list li { flex-direction: column; }
  .manage-list li form { align-self: flex-end; }

  .hours-edit-table th, .hours-edit-table td { padding: 5px 4px; font-size: 0.8rem; }
  .hours-edit-table input[type="time"] { padding: 6px 2px; font-size: 0.85rem; }

  .stat-box { min-width: 100%; }
}
