/* Greyhound Sales — theme layer
   Palette/fonts per BRANDING.md, extracted from harlequinsyndicates.co.uk (2026-08-03).
   Reference only until client signs off — kept as CSS variables so it's a one-file swap later. */

:root {
  --color-primary: #1e73be;
  --color-primary-dark: #16599459;
  --color-accent: #dd3333;
  --color-ink: #000000;
  --color-surface: #ffffff;
  --color-muted: #6b6b6b;
  --color-border: #dfe3e7;
  --color-bg: #f4f6f8;

  --font-body: "Roboto", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: "Open Sans", var(--font-body);

  --radius: 6px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --container-width: 1080px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-ink);
  background: var(--color-bg);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.25;
}

h1 { font-size: 1.9rem; margin: 0 0 1rem; }
h2 { font-size: 1.4rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 1.75rem 0 0.6rem; }

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* Layout */

.site-header {
  background: var(--color-surface);
  border-bottom: 3px solid var(--color-accent);
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}

.site-header .page-nav {
  margin: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand-logo {
  display: block;
  height: 76px;
  width: auto;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

main.container {
  background: var(--color-surface);
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.site-footer {
  text-align: center;
  padding: 1.5rem 1.25rem 2.5rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}
.site-footer a { color: var(--color-muted); text-decoration: underline; }

/* Admin nav — shown on every page (alongside the public nav above) while logged in as admin */
.admin-nav {
  background: #1c1c1c;
}
.admin-nav .container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: center;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  font-size: 0.9rem;
}
.admin-nav a { color: #fff; }
.admin-nav .sep { color: rgba(255, 255, 255, 0.35); }

/* Sub-nav — the "&middot;"-separated link rows under a page title */

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  align-items: center;
  margin: 0 0 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}
.page-nav .sep { color: var(--color-border); }

/* Homepage auction scroller (2026-08-12) — only rendered when an auction is active, sits
   below the main nav and above the category-tile box. A genuine moving ticker: the track's
   content is rendered twice in the template (see index.html) and animated -50% so the loop
   is seamless, rather than just a horizontally-scrollable static row. Paused on hover so a
   visitor can actually read/click an item, and disabled entirely for reduced-motion users. */
.auction-scroller {
  overflow: hidden;
  white-space: nowrap;
  padding: 0.6rem 0;
  margin: 0 0 1rem;
  background: var(--color-accent);
  border-radius: 6px;
}
.auction-scroller-track {
  display: inline-flex;
  gap: 3rem;
  padding-left: 1rem;
  animation: auction-scroll 25s linear infinite;
}
.auction-scroller:hover .auction-scroller-track { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .auction-scroller-track { animation: none; }
}
@keyframes auction-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.auction-scroller-item {
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
}
.auction-scroller-item:hover { text-decoration: underline; }
.auction-scroller-item strong { text-transform: uppercase; }

/* Homepage phone-help banner (2026-08-28) — sits alongside the auction scroller (does not
   replace it), for buyers/sellers who'd rather call than use the site. */
.phone-help-banner {
  padding: 0.7rem 1rem;
  margin: 0 0 1rem;
  background: var(--color-bg);
  border: 3px solid var(--color-primary);
  border-radius: 6px;
  font-size: 0.95rem;
}
.phone-help-banner a { font-weight: bold; }

/* Homepage buyer/seller registration call-to-action row */
.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
}
.cta-buttons .btn,
.cta-buttons .btn-secondary {
  font-size: 1.02rem;
  padding: 0.7rem 1.5rem;
  background: #c8f0d4;
  color: var(--color-ink);
  border-color: #7fcf99;
}
.cta-buttons .btn:hover,
.cta-buttons .btn-secondary:hover {
  background: #a8e6bb;
  color: var(--color-ink);
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--color-muted);
}

/* Flash messages */

.flash-messages {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}
.flash-messages li {
  background: #fff6e5;
  border: 1px solid #f0c46b;
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

/* Buttons */

button,
input[type="submit"],
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  border: 2px solid var(--color-ink);
  background: var(--color-accent);
  color: var(--color-surface);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

button:hover,
input[type="submit"]:hover,
.btn:hover {
  background: var(--color-ink);
  border-color: var(--color-accent);
  color: var(--color-surface);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Secondary/destructive buttons found in admin danger zones and small inline actions */
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-ink);
  border-color: var(--color-border);
}
.btn-secondary:hover {
  background: var(--color-bg);
  border-color: var(--color-ink);
  color: var(--color-ink);
}

/* Forms */

form {
  margin: 0 0 1rem;
}

label {
  display: block;
  margin-bottom: 0.9rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-ink);
}

input, select, textarea {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-top: 0.3rem;
  padding: 0.5rem 0.65rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 115, 190, 0.15);
}

input[type="number"] { max-width: 140px; }

/* Small inline forms (status toggles, confirm/cancel actions) shouldn't stretch inputs */
form[style*="display:inline"] {
  display: inline-block !important;
  margin: 0 0.4rem 0.4rem 0;
}

/* Tables */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1.5rem;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

th {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-bg);
}

tr:hover td {
  background: #fafbfc;
}

/* Status badges */

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--color-border);
  color: var(--color-ink);
}

.badge-coming_soon   { background: #e6e9ec; color: #4b4b4b; }
.badge-for_sale       { background: #e3f3e6; color: #1e7e34; }
.badge-pending        { background: #fff3cd; color: #8a6300; }
.badge-sold_stc       { background: #ffe3d6; color: #a13e00; }
.badge-sold           { background: #e9e9e9; color: #6b6b6b; }
.badge-pending_approval { background: #e2ecf9; color: var(--color-primary); }
.badge-rejected       { background: #fbe0e0; color: var(--color-accent); }
.badge-active         { background: #e3f3e6; color: #1e7e34; }
.badge-inactive       { background: #e9e9e9; color: #6b6b6b; }
.badge-paid           { background: #e3f3e6; color: #1e7e34; }
.badge-cancelled      { background: #e9e9e9; color: #6b6b6b; }
.badge-draft          { background: #e6e9ec; color: #4b4b4b; }
.badge-sent           { background: #e3f3e6; color: #1e7e34; }
.badge-featured        { background: #fff3cd; color: #8a6300; }

.newsletter-preview {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  background: #fff;
}

.newsletter-editor-toolbar {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.newsletter-editor-toolbar button {
  padding: 0.25rem 0.6rem;
}

.newsletter-editor {
  margin-top: 0.25rem;
  margin-bottom: 1rem;
  min-height: 200px;
  cursor: text;
}

.newsletter-editor:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Inline subscribe form, sits in the same row as the homepage Register buttons */
.newsletter-inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
}

.newsletter-inline input[type="email"] {
  min-width: 220px;
}

/* Subscribe button (2026-08-12) — was defaulting to the same red as the new auction
   scroller/CTA-adjacent elements, too visually similar. Darker green than the light-green
   Register buttons so the two are clearly distinct, not competing reds/greens. */
.newsletter-inline button {
  background: #1f6b3f;
  border-color: #164d2d;
  color: #fff;
}
.newsletter-inline button:hover {
  background: #164d2d;
  border-color: #0f3a21;
  color: #fff;
}

@media (max-width: 640px) {
  .newsletter-inline {
    margin-left: 0;
    width: 100%;
  }
  .newsletter-inline input[type="email"] {
    flex: 1;
    min-width: 0;
  }
}

/* Dog card grid — public listings */

.dog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.25rem;
  list-style: none;
  margin: 1rem 0;
  padding: 0;
}

.dog-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.1rem;
  background: var(--color-surface);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.dog-card:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}
.dog-card a {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
}
.dog-card .price {
  display: block;
  margin-top: 0.4rem;
  font-weight: 700;
  color: var(--color-ink);
}
.dog-card .badge {
  margin-top: 0.6rem;
}
.dog-card .thumb {
  margin-bottom: 0.7rem;
}

/* Homepage category frame — tiles surrounding a centre panel, added 2026-08-06, reworked
   2026-08-09 to support an admin-configurable, variably-sized set of categories (was a
   fixed 4-tile grid). Left/right columns each stack however many tiles they were given
   (app/main/routes.py splits an odd count with the extra tile on the left) and use flex so
   both columns fill the same total height regardless of tile count — a column with more
   tiles gets smaller tiles, not a taller column. Clicking a tile AJAX-loads that category's
   listings into #category-panel in place (app/static/js/category-panel.js); each tile is
   also a real link, so it degrades to a normal page visit without JS. */

.category-frame {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.category-tile-col {
  display: flex;
  flex-direction: row;
  gap: 1.25rem;
}
@media (min-width: 860px) {
  .category-frame {
    flex-direction: row;
    align-items: stretch;
  }
  .category-tile-col {
    flex: 0 0 160px;
    flex-direction: column;
  }
  .category-panel {
    flex: 1;
  }
}

.category-tile {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  padding: 1rem;
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-surface);
  background: var(--color-primary);
  border: 2px solid var(--color-ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}
.category-tile:hover {
  background: var(--color-ink);
  text-decoration: none;
  transform: translateY(-2px);
}
.category-tile.active {
  background: var(--color-accent);
  /* Grows within its column (flex-grow, not a fixed size) so the active tile reads as the
     biggest/most prominent button without breaking the "column fills equal total height"
     rule the other tiles rely on — it just takes a bigger share of that same height. */
  flex: 1.6;
  font-size: 1.25rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.category-panel {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  min-height: 220px;
}
.category-panel[aria-busy="true"] {
  opacity: 0.6;
}
.category-panel .panel-title {
  margin-top: 0;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  font-size: 0.92rem;
}
.pagination .page-info {
  color: var(--color-muted);
}

/* "List view" / "Browse by price" links on a category grid, pointing to the full
   directory page (main/category_list_view.html) in each grouping mode. */
.list-view-link {
  margin: -0.5rem 0 1.25rem;
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

/* A-Z directory page (main/category_list_view.html) — every visible listing in a
   category, grouped by first letter, with a name search. Added 2026-08-06, replacing an
   earlier attempt at an inline searchable list under the grid (kept to the current page
   only, which didn't cover "all available dogs" as intended). */
.dog-list-search input {
  max-width: 280px;
  margin-top: 0.4rem;
}
.list-view-toggle {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}
.list-view-toggle a {
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--color-ink);
}
.list-view-toggle a.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-surface);
}
.az-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1.25rem 0 0.5rem;
}
.az-index a,
.az-inactive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
}
.az-index a {
  background: var(--color-primary);
  color: var(--color-surface);
  text-decoration: none;
}
.az-index a:hover {
  background: var(--color-ink);
}
.az-inactive {
  color: var(--color-border);
  background: var(--color-bg);
}
.dog-list-block {
  margin-top: 1rem;
}
.az-heading {
  margin: 1.75rem 0 0.5rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--color-border);
}
.dog-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  columns: 2;
  column-gap: 1.5rem;
}
.dog-list li {
  padding: 0.3rem 0;
  break-inside: avoid;
  border-bottom: 1px solid var(--color-border);
}

/* Shared "frame" treatment for every dog photo on the site (listing thumbnails, profile
   galleries, admin edit page) — a thin border + light mat padding + soft shadow, restrained
   on purpose (no heavy border/deep shadow) so it reads as a subtle presentation touch rather
   than decoration competing with the dog photo itself. One class, used everywhere a photo
   appears, so photos "conform" visually no matter which page they're on. */
.photo-frame {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}
.photo-frame img {
  display: block;
  width: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
}
.dog-card .photo-frame img { height: 150px; }
.dog-photos .photo-frame img { height: 140px; }
.dog-photo-admin .photo-frame img { height: 140px; }

/* Dog photo gallery — profile pages (dog + stud advert detail) */

.dog-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

/* Photo thumbnails on the admin dog-edit page, with a remove action under each */

.dog-photo-admin {
  display: inline-block;
  text-align: center;
  margin: 0 0.75rem 0.75rem 0;
}
.dog-photo-admin .photo-frame {
  width: 140px;
}
.dog-photo-admin form {
  margin-top: 0.3rem;
}

/* Auth-style forms (login/register) — narrow centered card */

.auth-card {
  max-width: 380px;
  margin: 1rem auto 0;
}

/* Small helper */
.muted { color: var(--color-muted); font-size: 0.9rem; }

/* Chat widget trigger — the widget script itself renders the panel (#pa-panel);
   this button just opens it, matching the pattern already used on the Launchflow site.
   The widget script also injects its own circular launcher button (#pa-btn) — no config
   flag exists to suppress it server-side (phone.cloudassistant.uk is shared multi-tenant
   infra used by other live sites, not worth touching for one client's cosmetic
   preference) — so it's hidden here instead. Doesn't affect the panel itself, which
   .chat-trigger already opens independently via its own onclick handler. */
#pa-btn {
  display: none !important;
}

.chat-trigger {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 900;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

/* Admin dog list search + A-Z filter (dashboard.html) */
.dog-admin-filters {
  margin: 1rem 0;
}

#dog-search {
  width: 100%;
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--color-border, #ccc);
  border-radius: 6px;
  font-size: 1rem;
}

.az-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.az-btn {
  border: 1px solid var(--color-border, #ccc);
  background: #fff;
  color: var(--color-ink, #222);
  border-radius: 4px;
  padding: 0.25rem 0.55rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.az-btn:hover {
  background: #eee;
  color: var(--color-ink, #222);
  border-color: var(--color-border, #ccc);
}

.az-btn.active,
.az-btn.active:hover {
  background: var(--color-primary, #1e73be);
  color: #fff;
  border-color: var(--color-primary, #1e73be);
}

.dog-count-msg {
  font-size: 0.85rem;
  color: var(--color-muted, #666);
  margin: 0;
}
