﻿:root {
    --ink: #16202e;
    --muted: #5b6b82;
    --border: #dbe2eb;
    --bg: #f5f7fa;
    --accent: #0f1a2e;
    --accent-2: #f2a63b;

    /* ACTION BLUE - ClientManager's OWN accent, not a blue chosen here.
       
       The palette had no blue at all (accent is near-black navy, accent-2 orange), so a button
       built from it read as dark and inert: "black is too boring ... BLUE for ACTION".
       
       These are lifted verbatim from ClientManager's app.css - --cm-accent and
       --cm-accent-border - because "like our SAVE and VIEW inside" and "even our OPEN inside is
       BLUE" means the same blue, not a similar one. A first attempt used #1763d6, picked by eye,
       which would have been a near-match that looks like a mistake beside the real thing.
       
       White on #1b6ec2 is about 4.9:1, which clears AA for this size and weight. */
    --action: #1b6ec2;
    --action-hover: #1861ac;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.page {
    /* Full width, like the rest of the REYESCO sites. The 900px cap left most of a desktop
       screen empty while the guide list wrapped into three narrow columns. Forms are not
       affected: .admin-form carries its own 520px cap. */
    margin: 0 auto;
    /* Roughly half an inch of breathing room at the edges on a desktop, shrinking on
       smaller screens. A fixed 20px was fine inside a 900px column and looks pinched now
       that the page runs the full width. */
    padding: 0 clamp(16px, 3vw, 48px) 60px;
}

.site-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 28px 0 20px;
    border-bottom: 1px solid var(--border);
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.brand-logo {
    height: 28px;
    width: auto;
    display: block;
}

.brand {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--accent);
    text-decoration: none;
}

.tagline {
    color: var(--muted);
    font-size: 0.9rem;
}

main {
    padding-top: 24px;
}

h1 {
    margin: 0 0 6px;
    font-size: 1.8rem;
}

p.sub {
    color: var(--muted);
    margin: 0 0 32px;
}

.app-group {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    scroll-margin-top: 20px;
}

.app-group:last-child {
    border-bottom: none;
}

.app-group h2 {
    margin: 0 0 4px;
    font-size: 1.25rem;
    color: var(--accent);
}

.app-desc {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0 0 12px;
}

.guide-list {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    column-count: 4;
    column-gap: 28px;
    column-rule: 1px solid var(--border);
}

/* Four columns need the room for it. Stepping down rather than squeezing keeps each guide
   title on one line instead of breaking mid-word. */
@media (max-width: 1400px) {
    .guide-list { column-count: 3; }
}

@media (max-width: 1000px) {
    .guide-list { column-count: 2; }
}

.guide-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    break-inside: avoid;
}

.guide-list a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.guide-list a:hover {
    text-decoration: underline;
}

.guide-desc {
    color: var(--muted);
    font-size: 0.9rem;
}

.empty {
    color: var(--muted);
}

/* Any image, anywhere (inline guide Body content and the attached-images strip alike) -
   never wider than its container, and never distorted, on any viewport. */
img {
    max-width: 100%;
    height: auto;
}

.back-link-inline {
    display: inline-block;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.back-link-inline:hover {
    color: var(--accent);
}

.guide-body {
    line-height: 1.65;
    max-width: 68ch;
}

.guide-body :first-child {
    margin-top: 0;
}

.guide-images {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.guide-images img {
    border: 1px solid var(--border);
    border-radius: 8px;
}

.site-footer {
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
}

/* Admin */
.admin-nav {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.admin-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.admin-nav a:hover {
    color: var(--accent);
}

.admin-nav .back-link {
    margin-left: auto;
}

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 0.9rem;
}

table.admin-table th, table.admin-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

table.admin-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-inactive {
    color: var(--muted);
    font-size: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
}

.admin-form {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    max-width: 520px;
    margin-bottom: 24px;
}

.admin-form label {
    display: block;
    font-size: 0.82rem;
    font-weight: 650;
    margin: 12px 0 4px;
    color: var(--ink);
}

.admin-form label:first-child {
    margin-top: 0;
}

.admin-form input[type=text], .admin-form input[type=number], .admin-form input[type=url], .admin-form textarea, .admin-form select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.9rem;
    box-sizing: border-box;
    font-family: inherit;
}

.admin-form .checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.admin-form .checkbox-row label {
    margin: 0;
}

.btn {
    display: inline-block;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: var(--bg);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-danger {
    color: #b3261e;
    border-color: #f0c9c6;
}

.btn-row {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.field-error {
    color: #b3261e;
    font-size: 0.8rem;
    margin-top: 4px;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1.2rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Responsive - phones and narrow tablets */
@media (max-width: 640px) {
    .page {
        padding: 0 14px 40px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .guide-list {
        /* Two hairline-separated columns are cramped on a phone width and force awkward
           mid-word wrapping - a single column reads far better and still uses the full width. */
        column-count: 1;
    }

    .guide-list li {
        padding: 10px 0;
    }

    .brand-row span[style] {
        margin-left: 0 !important;
        width: 100%;
        justify-content: flex-end;
    }

    /* Turns the table into a horizontally-scrollable strip instead of forcing the whole
       page body to scroll sideways - the columns themselves stay full-size and legible. */
    table.admin-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .admin-form {
        max-width: 100%;
    }

    .admin-nav {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .admin-nav .back-link {
        margin-left: 0;
    }
}

/* A category with ONE link is a door rather than a list, so it gets a real button. The old
   treatment - a blue title, an em-dash, then a sentence - read as a paragraph, and the thing
   people were meant to click looked like part of the description. */
.guide-action-wrap {
    margin: 4px 0 18px;
}

.guide-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--action);
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 6px;
    border: 1px solid var(--action);
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

/* DARKER on hover, not a different hue. An earlier version switched to the orange accent, which
   is a lot of colour for a hover and made the button look like it had changed meaning rather
   than just been pointed at. */
.guide-action:hover,
.guide-action:focus-visible {
    background: var(--action-hover);
    border-color: var(--action-hover);
    transform: translateY(-1px);
}

/* Keyboard users get a visible ring as well as the colour change - the colour alone is not a
   focus indicator. */
.guide-action:focus-visible {
    outline: 3px solid var(--action);
    outline-offset: 2px;
}

/* The arrow moves on hover - a small, cheap signal that this goes somewhere. */
.guide-action-arrow {
    transition: transform 120ms ease;
}

.guide-action:hover .guide-action-arrow {
    transform: translateX(3px);
}

/* The description drops BELOW the button instead of trailing after an em-dash, so the button is
   the thing the eye lands on and the sentence explains it afterwards. */
.guide-action-desc {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    max-width: 60ch;
}
