/* ===========================================================================
   My Community — admin panel component layer
   ===========================================================================

   The palette, type scale, radii and shadows are set in the Tailwind theme in
   brand-head.php, so most existing utility classes already land on brand
   values without a page being touched. THIS file does the rest: the treatments
   that a utility class cannot express — serif headings, letterspaced table
   headers, the gold rule under a card heading, one badge shape, one field
   shape.

   Two rules for anything added here:

   1. No hex literals. Every colour is a custom property from brand-head.php.
      That is what makes a future per-agent accent one edit in one function.
   2. Selectors are scoped under `.eb-app` (set on <body>). A utility class has
      specificity (0,1,0); `.eb-app h2` has (0,1,1) and therefore wins, which is
      how a global treatment can override a per-page utility without !important
      and without restructuring the page.

   New pages should use the classes below rather than inventing sizes. See the
   "Design tokens" section of CLAUDE.md.
   ========================================================================= */

/* ---------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------ */
.eb-app {
    font-family: var(--eb-sans);
    font-size: 13px;
    line-height: 1.55;
    color: var(--eb-ink);
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------------------
   Type
   ------------------------------------------------------------------------ */

/* Headings are the serif. This single rule is most of what makes the panel
   read as the same product as the app. It outranks the `font-bold` /
   `font-semibold` utilities the pages already carry, which is deliberate:
   Noto Serif at 500 is the heading weight, and 700 everywhere would be shouty. */
.eb-app h1,
.eb-app h2,
.eb-app h3 {
    font-family: var(--eb-serif);
    font-weight: 500;
    color: var(--eb-navy);
    letter-spacing: -0.01em;
}
.eb-app h1 { font-size: 24px; line-height: 1.25; }
.eb-app h2 { font-size: 15px; line-height: 1.4; }
.eb-app h3 { font-size: 14px; line-height: 1.4; }

/* The uppercase letterspaced label, lifted straight off the printed flyer.
   Used for the area eyebrow, stat labels, table column headers, badge text and
   the "Managing area" label — everywhere a small label sits above something. */
.eb-eyebrow,
.eb-label,
.eb-app .eb-label {
    display: block;
    font-family: var(--eb-sans);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--eb-gold-label);
}
.eb-eyebrow { color: var(--eb-gold); }
.eb-app .eb-label { margin-bottom: 0.3rem; }

.eb-meta,
.eb-app .eb-meta { font-size: 11px; color: var(--eb-ink-faint); }

.eb-help,
.eb-app .eb-help { margin-top: 0.3rem; font-size: 11px; color: var(--eb-ink-faint); }

/* ---------------------------------------------------------------------------
   Page header — eyebrow / serif title / one-line summary
   Rendered once in header.php, so every page gets the same shape.
   ------------------------------------------------------------------------ */
.eb-page-head {
    background: var(--eb-surface);
    border-bottom: 1px solid var(--eb-line);
    padding: 1.1rem 2rem 1.15rem;
}
.eb-page-head .eb-eyebrow { margin-bottom: 0.3rem; }
.eb-page-title {
    font-family: var(--eb-serif);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--eb-navy);
    letter-spacing: -0.01em;
}
.eb-page-summary {
    margin-top: 0.2rem;
    font-size: 13px;
    color: var(--eb-ink-soft);
}

/* ---------------------------------------------------------------------------
   Cards
   White, hairline border, 10px radius, no shadow — all from the Tailwind theme.
   What is left is the gold rule beneath a card's heading row.
   ------------------------------------------------------------------------ */

/* A card that opens with its own header row: recolour that row's existing
   hairline to gold rather than adding a second rule next to it. */
.eb-app .bg-white > div:first-child[class*="border-b"] {
    border-bottom-color: var(--eb-gold-rule);
}

/* A card whose heading sits directly inside the padding, with no header row. */
.eb-app .bg-white > h2 {
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--eb-gold-rule);
}

/* ---------------------------------------------------------------------------
   Stat figures
   Large serif numeral. Something needing attention is gold rather than navy; a
   zero recedes into grey instead of shouting. Set via eb_stat_class().
   ------------------------------------------------------------------------ */
.eb-app .eb-stat {
    font-family: var(--eb-serif);
    font-size: 26px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--eb-navy);
    letter-spacing: -0.02em;
}
.eb-app .eb-stat.is-attention { color: var(--eb-gold); }
.eb-app .eb-stat.is-zero      { color: var(--eb-ink-faint); opacity: 0.55; }

/* ---------------------------------------------------------------------------
   Status badges
   One treatment for every status in the panel. Tinted background, same-family
   darker text, never a saturated fill. Emitted by status_badge() / eb_badge().
   ------------------------------------------------------------------------ */
.eb-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-family: var(--eb-sans);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1.4;
}
.eb-badge-good  { background: var(--eb-good-bg);  color: var(--eb-good-fg); }
.eb-badge-warn  { background: var(--eb-warn-bg);  color: var(--eb-warn-fg); }
.eb-badge-muted { background: var(--eb-muted-bg); color: var(--eb-muted-fg); }
.eb-badge-bad   { background: var(--eb-bad-bg);   color: var(--eb-bad-fg); }
.eb-badge-info  { background: var(--eb-info-bg);  color: var(--eb-info-fg); }

/* Rating stars — gold is exactly the small accent this colour is for. */
.eb-stars       { color: var(--eb-gold); }
.eb-stars-empty { color: var(--eb-line); }

/* ---------------------------------------------------------------------------
   Buttons — three tiers, and only three.
     primary   crimson fill, one per screen maximum
     secondary navy fill
     tertiary  grey outline, navy text
   Semantic colour never appears on a button: the badge says what state
   something is in, the button says what will happen.
   ------------------------------------------------------------------------ */
.eb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    font-family: var(--eb-sans);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
    white-space: nowrap;
}
.eb-btn-primary   { background: var(--eb-crimson); color: #fff; }
.eb-btn-primary:hover   { background: color-mix(in srgb, var(--eb-crimson) 88%, #000); }
.eb-btn-secondary { background: var(--eb-navy); color: #fff; font-weight: 500; }
.eb-btn-secondary:hover { background: color-mix(in srgb, var(--eb-navy) 86%, #fff); }
.eb-btn-tertiary  { background: #fff; color: var(--eb-navy); border-color: var(--eb-line); font-weight: 500; }
.eb-btn-tertiary:hover  { background: var(--eb-canvas); border-color: var(--eb-ink-faint); }
.eb-btn-sm { padding: 0.3rem 0.6rem; font-size: 12px; border-radius: 6px; }

/* ---------------------------------------------------------------------------
   Tables
   Letterspaced column headers, hairline separators, generous padding, no zebra.
   ------------------------------------------------------------------------ */
.eb-app thead th {
    background: transparent;
    padding: 0.7rem 1rem;
    font-family: var(--eb-sans);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--eb-gold-label);
    text-align: left;
    border-bottom: 1px solid var(--eb-gold-rule);
}
.eb-app tbody td {
    padding: 0.8rem 1rem;
    font-size: 13px;
    border-top: 1px solid var(--eb-line);
}
.eb-app tbody tr:first-child td { border-top: 0; }
.eb-app tbody tr:hover { background: var(--eb-canvas); }

/* ---------------------------------------------------------------------------
   Form fields
   One height, one border, one focus treatment — gold, not the Tailwind blue.
   Scoped to the content column and the login card so the navy sidebar's own
   controls keep their inverted styling.
   ------------------------------------------------------------------------ */
.eb-app main input[type="text"],
.eb-app main input[type="email"],
.eb-app main input[type="password"],
.eb-app main input[type="number"],
.eb-app main input[type="url"],
.eb-app main input[type="tel"],
.eb-app main input[type="date"],
.eb-app main input[type="time"],
.eb-app main input[type="search"],
.eb-app main select,
.eb-app main textarea,
.eb-auth input {
    width: 100%;
    min-height: 36px;
    padding: 0.45rem 0.7rem;
    border: 0.5px solid var(--eb-line);
    border-radius: 8px;
    background: #fff;
    font-family: var(--eb-sans);
    font-size: 13px;
    color: var(--eb-ink);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.eb-app main textarea { min-height: auto; line-height: 1.6; }

.eb-app main input:focus,
.eb-app main select:focus,
.eb-app main textarea:focus,
.eb-auth input:focus {
    border-color: var(--eb-gold);
    box-shadow: 0 0 0 3px rgba(184, 146, 74, 0.18);
}
.eb-app main ::placeholder,
.eb-auth ::placeholder { color: var(--eb-ink-faint); }

/* .eb-input predates the token layer and is still used by ~16 pages. It is now
   just an alias — the rules above already cover it. Kept so those pages keep
   working, and so a page can mark a field explicitly. */
.eb-input { width: 100%; }

/* File picker used by image_upload_field() */
.eb-file {
    display: block;
    width: 100%;
    font-size: 11px;
    color: var(--eb-ink-soft);
}
.eb-file::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.35rem 0.7rem;
    border: 0;
    border-radius: 6px;
    font-family: var(--eb-sans);
    font-size: 11px;
    font-weight: 500;
    background: rgba(15, 29, 54, 0.06);
    color: var(--eb-navy);
    cursor: pointer;
}
.eb-file::file-selector-button:hover { background: rgba(15, 29, 54, 0.12); }

/* ---------------------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------------------ */
aside::-webkit-scrollbar { width: 6px; }
aside::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 3px; }

.eb-brand-rule { border-bottom: 1px solid var(--eb-gold-rule); }

/* Nav item: hover shows a 2px gold left border, active is a crimson fill. The
   border is always present and transparent so nothing shifts on hover. */
.eb-nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    border-left: 2px solid transparent;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.72);
    transition: background-color .15s, color .15s, border-color .15s;
}
.eb-nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    border-left-color: var(--eb-gold);
}
.eb-nav-item.is-active {
    background: var(--eb-crimson);
    color: #fff;
    border-left-color: var(--eb-crimson);
}
.eb-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Divider above a global nav section. */
.eb-nav-group {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--eb-gold-rule);
}
.eb-nav-group-label {
    padding: 0 0.7rem 0.4rem;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--eb-gold);
}

/* ---------------------------------------------------------------------------
   Flash messages
   ------------------------------------------------------------------------ */
.eb-flash {
    margin-bottom: 1rem;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    border: 0.5px solid transparent;
    font-size: 13px;
}
.eb-flash-good { background: var(--eb-good-bg);  color: var(--eb-good-fg);  border-color: var(--eb-good-fg); }
.eb-flash-warn { background: var(--eb-warn-bg);  color: var(--eb-warn-fg);  border-color: var(--eb-warn-fg); }
.eb-flash-bad  { background: var(--eb-bad-bg);   color: var(--eb-bad-fg);   border-color: var(--eb-bad-fg); }
.eb-flash-info { background: var(--eb-info-bg);  color: var(--eb-info-fg);  border-color: var(--eb-info-fg); }

/* ---------------------------------------------------------------------------
   Toasts (AJAX feedback)
   ------------------------------------------------------------------------ */
#eb-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.eb-toast-item {
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    font-family: var(--eb-sans);
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    background: var(--eb-navy);
    border-left: 2px solid var(--eb-gold);
    box-shadow: 0 8px 24px rgba(6, 12, 26, 0.22);
    animation: eb-slide-in 0.2s ease;
}
.eb-toast-success { border-left-color: var(--eb-good-fg); }
.eb-toast-error   { border-left-color: var(--eb-bad-fg); }
.eb-toast-info    { border-left-color: var(--eb-gold); }

@keyframes eb-slide-in {
    from { transform: translateX(1rem); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ---------------------------------------------------------------------------
   Modal
   ------------------------------------------------------------------------ */
.eb-modal-backdrop {
    position: fixed; inset: 0; background: rgba(15, 29, 54, 0.55);
    display: flex; align-items: center; justify-content: center; z-index: 40; padding: 1rem;
}

/* The confirmation a business gets when saving has put their listing in front
   of their local team. Rendered by PHP, not by script — it is the receipt for
   the only action on that page involving another person. */
.eb-app .eb-dialog {
    background: var(--eb-surface);
    border: 1px solid var(--eb-line);
    border-radius: 12px;
    padding: 1.75rem;
    max-width: 30rem;
    box-shadow: 0 24px 60px -20px rgba(15, 29, 54, 0.55);
}
.eb-app .eb-dialog-mark {
    width: 2.25rem; height: 2.25rem;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 0.9rem;
    border-radius: 999px;
    background: var(--eb-good-bg);
    color: var(--eb-good-fg);
    font-size: 16px;
}

/* A bigger primary button, for the one place a control carries more weight than
   "save": the button that also puts a listing in front of a person. */
.eb-app .eb-btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 14px;
}

/* The business's save bar is louder than an admin's, because it is doing more:
   a gold hairline above it and a lift, so it reads as the end of the job rather
   than as one more strip of chrome. */
.eb-app .eb-savebar-loud {
    border-top-color: var(--eb-gold);
    border-top-width: 2px;
    box-shadow: 0 -10px 24px -14px rgba(15, 29, 54, 0.6);
}

/* ---------------------------------------------------------------------------
   Login / password reset
   ------------------------------------------------------------------------ */
/* Prefixed with .eb-app so it outranks the global `.eb-app h1` colour — the
   wordmark sits on the navy field and must stay white. */
.eb-app .eb-auth-wordmark,
.eb-auth-wordmark {
    font-family: var(--eb-serif);
    font-size: 24px;
    font-weight: 500;
    color: #fff;
    letter-spacing: -0.01em;
}
.eb-auth-sub {
    margin-top: 0.35rem;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--eb-gold);
}
.eb-auth-foot { font-size: 11px; color: rgba(255, 255, 255, 0.4); }

/* ---------------------------------------------------------------------------
   Sticky save bar (business-edit.php)

   Nothing editable may sit below Save, and on a long form the button used to be
   a scroll away from wherever you were typing. This pins it to the bottom of
   the viewport instead.

   Scoped under .eb-app and built from tokens, like everything else here. The
   button inside it is outside the <form> and reaches it with form="biz-form",
   which is what lets the bar run the full width while the form stays in its
   column.
   --------------------------------------------------------------------------- */
.eb-app .eb-savebar {
    position: sticky;
    bottom: 0;
    z-index: 30;
    margin-top: 1.5rem;
    /* Bleed to the edges of the page padding so the bar reads as chrome rather
       than as one more card in the column. */
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding: 0.75rem 1.25rem;
    background: var(--eb-surface);
    border-top: 1px solid var(--eb-line);
    /* Lifts it off the content scrolling underneath. */
    box-shadow: 0 -6px 16px -12px rgba(15, 29, 54, 0.5);
}

@media (min-width: 640px) {
    .eb-app .eb-savebar {
        margin-left: -2rem;
        margin-right: -2rem;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

.eb-app .eb-savebar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Collapsible card (the Loyalty block on business-edit.php when it is switched
   off). The default disclosure triangle is dropped because the summary is a
   full card header with its own status badge — a marker in front of it reads as
   a bullet, not a control. The pointer and the hover on the heading are what
   say it opens. */
.eb-app details.eb-collapse > summary {
    cursor: pointer;
    list-style: none;
}
.eb-app details.eb-collapse > summary::-webkit-details-marker { display: none; }
.eb-app details.eb-collapse > summary::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-left: auto;
    border-right: 1.5px solid var(--eb-ink-faint);
    border-bottom: 1.5px solid var(--eb-ink-faint);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform 0.15s ease;
}
.eb-app details.eb-collapse[open] > summary::after {
    transform: rotate(-135deg) translate(-2px, -2px);
}
.eb-app details.eb-collapse > summary:hover h2 { color: var(--eb-crimson); }

/* Auto-upload in progress (business-edit.php). The whole control dims and stops
   accepting input, because a phone photo on a poor connection is slow enough
   that a silent page gets clicked twice. */
.eb-app .eb-autoform-busy { opacity: 0.6; pointer-events: none; }
.eb-app .eb-autoform-busy input[type="file"] { cursor: progress; }


/* ---------------------------------------------------------------------------
   Repeating list rows (business-edit.php: what you sell or do, and prices)

   PROGRESSIVE ENHANCEMENT, and the direction matters. The extra rows are hidden
   by SCRIPT on load, not by a class in the HTML — so with JavaScript off a
   business gets every box and a longer form, rather than four boxes and an Add
   button that does nothing. The no-JS case must degrade to more, never to less.
   --------------------------------------------------------------------------- */
.eb-app .eb-list-row.eb-list-pair {
    display: grid;
    grid-template-columns: 1fr 8rem;
    gap: 0.5rem;
}

/* An invisible second anchor for a guide section that has been renamed, so links
   already sent out in emails still land somewhere. Zero-height so it does not
   disturb the flow, with scroll-margin so the heading is not hidden under the
   sticky header when one is followed. */
.eb-guide-legacy-anchor {
    display: block;
    height: 0;
    scroll-margin-top: 5rem;
}

/* A line of copy that sits between sections rather than inside one — the "here's
   what happens" opener and the closing "any questions". Same measure and colour
   as body copy in a section, so it reads as part of the document rather than as
   chrome. */
.eb-app .eb-guide-lede {
    max-width: 42rem;
    margin: 0 0 1.75rem;
    font-size: 15px;
    line-height: 1.7;
    color: var(--eb-ink-soft, #4a5468);
}

/* The Common questions list. A definition list, because that is what it is —
   and it means a question and its answer cannot be separated by a page break in
   print, which businesses do put on the counter. */
.eb-app .eb-guide-faq dt {
    font-weight: 500;
    color: var(--eb-navy);
    margin-top: 1.1rem;
}
.eb-app .eb-guide-faq dd {
    margin: 0.3rem 0 0;
    color: var(--eb-ink-soft);
}
@media print {
    .eb-app .eb-guide-faq dt { break-after: avoid; }
    .eb-app .eb-guide-faq dd { break-before: avoid; }
}

/* Sub-headings inside a guide section (Your cover picture, Your PIN). Smaller
   than a section heading and without its gold rule, so the sticky contents stays
   a list of sections rather than of everything. */
.eb-app .eb-guide-section h3 {
    font-family: var(--eb-sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--eb-navy);
    margin: 1.6rem 0 0.4rem;
}
