/* The listing-preferences form (js/listing-prefs-form.js) and the one-time
 * question's dialog (js/listing-prefs-prompt.js).
 *
 * Four very different hosts load this: signup.html (public.css), the app's
 * index.html (styles.css), billing.html and
 * account.html (each self-styled, with page-wide element rules such as
 * billing.html's `button { width: 100% }` and account.html's teal
 * `button`). So every rule here is a class rule that states what it needs —
 * width, padding, colors — instead of inheriting it, and every var() carries
 * the brand value as a fallback, exactly as css/contact.css does for the
 * contact dialog.
 *
 * Elements the script shows and hides with the `hidden` attribute get a
 * `[hidden]` rule of their own below, one class more specific than the rule
 * that gives them a display: `[hidden]` loses to ANY author display rule.
 */

.nc-lp { display: flex; flex-direction: column; gap: 1rem; text-align: left; }

.nc-lp-group { border: 0; margin: 0; padding: 0; min-width: 0; }

.nc-lp-legend {
    display: block;
    padding: 0;
    margin: 0 0 0.45rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text, #111827);
}

.nc-lp-scopes { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; margin-bottom: 0.55rem; }

.nc-lp-choice,
.nc-lp-check,
.nc-lp-county {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.9rem;
    line-height: 1.35;
    color: var(--color-text, #111827);
    cursor: pointer;
    font-weight: 400;
    margin: 0;
}

.nc-lp-choice input,
.nc-lp-check input,
.nc-lp-county input {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0.1rem 0 0;
    flex: 0 0 auto;
    accent-color: var(--color-primary, #0f766e);
}

.nc-lp-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--border-radius-lg, 10px);
    padding: 0.7rem;
    background: var(--color-bg-secondary, #ffffff);
}
.nc-lp-picker[hidden] { display: none; }

.nc-lp-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.nc-lp-chips[hidden] { display: none; }

.nc-lp-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    width: auto;
    margin: 0;
    padding: 0.2rem 0.55rem;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    /* Fixed colours, the same on every page that loads this file (the
       sign-up page has none of the app's tokens). Teal-800 on teal-100 is
       6.7:1; the pair below (.nc-lp-on-dark) is 7.5:1. */
    color: #115e59;
    background: #ccfbf1;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
}
.nc-lp-chip:hover { border-color: #0f766e; }

.nc-lp-search,
.nc-lp-select {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0.6rem 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--color-text, #111827);
    background: var(--color-bg-secondary, #ffffff);
    border: 1.5px solid var(--color-border, #d1d5db);
    border-radius: var(--border-radius-md, 10px);
}
.nc-lp-search:focus,
.nc-lp-select:focus {
    outline: none;
    border-color: var(--color-primary-light, #0d9488);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.16);
}

.nc-lp-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.2rem 0.75rem;
    max-height: 13.5rem;
    overflow-y: auto;
    padding: 0.15rem 0.1rem;
    overscroll-behavior: contain;
}
.nc-lp-county { padding: 0.2rem 0; }
.nc-lp-county[hidden] { display: none; }

.nc-lp-empty,
.nc-lp-count,
.nc-lp-hint {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--color-text-muted, #5f6673);
}
.nc-lp-empty[hidden] { display: none; }
.nc-lp-hint { margin-top: 0.4rem; }

/* ---- the sign-up form's section (signup.html) ---- */

.signup-prefs {
    margin: 0.25rem 0 0;
    padding: 1rem 0 0;
    border-top: 1px solid var(--color-border, #e5e7eb);
}
.signup-prefs-title {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
    line-height: 1.3;
}
.signup-prefs .hint { margin: 0 0 0.85rem; }

/* ---- the one-time question's dialog (js/listing-prefs-prompt.js) ---- */

.nc-lp-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(17, 24, 39, 0.55);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nc-lp-dialog {
    background: var(--color-bg-secondary, #ffffff);
    color: var(--color-text, #111827);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.06), 0 8px 24px rgba(17, 24, 39, 0.06), 0 20px 50px rgba(17, 24, 39, 0.18);
    width: 100%;
    max-width: 36rem;
    margin: auto;
    padding: 1.25rem 1.5rem 1.5rem;
    box-sizing: border-box;
}

.nc-lp-dialog h2 {
    margin: 0 0 0.35rem;
    font-family: "Newsreader", Georgia, "Times New Roman", serif;
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--color-text, #111827);
}

.nc-lp-intro {
    margin: 0 0 1rem;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--color-text-secondary, #374151);
}

.nc-lp-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.1rem;
}

.nc-lp-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin: 0;
    padding: 0.65rem 1.1rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: var(--border-radius-md, 10px);
    cursor: pointer;
    /* Fixed brand teal-700, the same value as --color-primary: this file also
       loads on pages that define no tokens. White on it is 5.5:1. */
    color: #ffffff;
    background: #0f766e;
    border: 1px solid #0f766e;
}
.nc-lp-button:hover { background: #134e4a; border-color: #134e4a; }
.nc-lp-button:disabled { opacity: 0.6; cursor: default; }

.nc-lp-button.nc-lp-secondary {
    color: var(--color-text, #111827);
    background: var(--color-bg-secondary, #ffffff);
    border-color: var(--color-border, #d1d5db);
}
.nc-lp-button.nc-lp-secondary:hover { background: var(--color-bg-tertiary, #f3f2ee); }

.nc-lp-status {
    margin: 0.75rem 0 0;
    min-height: 1.2em;
    font-size: 0.85rem;
    color: var(--color-text-muted, #5f6673);
}
.nc-lp-status.error { color: #b91c1c; }
.nc-lp-status.ok { color: #15803d; }

/* The dialog on a dark surface: the prompt script adds the class only if it
   measures the dialog's own background as dark, which the app's light pages
   never produce. */
.nc-lp-on-dark .nc-lp-chip { color: #99f6e4; background: #134e4a; }
.nc-lp-on-dark .nc-lp-chip:hover { border-color: #5eead4; }
.nc-lp-on-dark .nc-lp-status.error { color: #fca5a5; }
.nc-lp-on-dark .nc-lp-status.ok { color: #86efac; }

@media (max-width: 480px) {
    .nc-lp-overlay { padding: 0.75rem 0.5rem; }
    .nc-lp-dialog { padding: 1rem 1rem 1.25rem; }
    .nc-lp-list { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
}
