/* ============================================================
   Envibin brand theme (franchisor admin) — www.envibin.co.za
   Charcoal header variant to distinguish internal tooling.
   Palette : orange #faa639 (hover #f99007), charcoal #4c4c4c,
             ink #222, body text #6e6e6e, canvas #f2f2f2
   Type    : Oswald (display), Poppins (body)
   ============================================================ */

:root {
    --eb-orange: #faa639;
    --eb-orange-dark: #f99007;
    --eb-orange-soft: #fdeed8;
    --eb-charcoal: #4c4c4c;
    --eb-ink: #222222;
    --eb-text: #6e6e6e;
    --eb-canvas: #f2f2f2;
    --eb-card: #ffffff;
    --eb-line: #e4e4e4;
    --eb-success: #28a745;
    --eb-success-soft: #e8f6ec;
    --eb-danger: #dc3545;
    --eb-danger-soft: #fdeaec;
    --eb-radius: 8px;
    --eb-shadow: 0 2px 8px rgba(34, 34, 34, 0.08);
    --eb-display: 'Oswald', 'Arial Narrow', sans-serif;
    --eb-body: 'Poppins', 'Segoe UI', system-ui, sans-serif;
}

html, body {
    font-family: var(--eb-body);
    margin: 0;
    background: var(--eb-canvas);
    color: var(--eb-text);
    font-size: 15px;
    line-height: 1.6;
}

h1, h2, h3, h4, h5 {
    font-family: var(--eb-display);
    color: var(--eb-charcoal);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.2;
    margin: 0 0 0.75rem;
}

h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.4rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }

a {
    color: var(--eb-orange-dark);
    text-decoration: none;
}

a:hover {
    color: var(--eb-orange);
    text-decoration: underline;
}

.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Header (charcoal, franchisor admin) ---------- */

.top-row {
    background: var(--eb-charcoal);
    color: #fff;
    padding: 0.65rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    border-bottom: 3px solid var(--eb-orange);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    line-height: 1;
}

.brand-mark {
    width: 30px;
    height: 34px;
    flex: none;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.brand-name {
    font-family: var(--eb-display);
    font-size: 1.35rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #fff;
}

.brand-name .brand-accent {
    color: var(--eb-orange);
    font-weight: 700;
    font-style: italic;
}

.brand-tag {
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #cfcfcf;
}

.top-row nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.top-row nav a {
    font-family: var(--eb-display);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #e8e8e8;
    text-decoration: none;
    padding: 0.35rem 0.7rem;
    border-radius: 4px;
    border-bottom: 2px solid transparent;
}

.top-row nav a:hover {
    color: var(--eb-orange);
    border-bottom-color: var(--eb-orange);
    text-decoration: none;
}

/* ---------- Account strip ---------- */

.account-strip {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: #cfcfcf;
}

.account-strip a,
.account-strip__link {
    color: var(--eb-orange);
    text-decoration: none;
    font-weight: 600;
}

.account-strip a:hover,
.account-strip__link:hover {
    color: var(--eb-orange-dark);
    text-decoration: underline;
}

.account-strip .account-name {
    color: #fff;
    font-weight: 600;
}

.account-strip__form {
    display: inline;
    margin: 0;
}

.account-strip__link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

/* ---------- Main content ---------- */

main {
    flex: 1;
    padding: 1.75rem 1.5rem 3rem;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;          /* centre the content instead of left-dumping the whitespace */
    box-sizing: border-box;
}

/* Dense admin pages (franchisee list / details / provisioning) opt into a wider shell by
   rendering an element with .eb-wide; simple form/text pages keep the narrow reading width. */
main:has(.eb-wide) {
    max-width: 1320px;
}

.content {
    background: var(--eb-card);
    border-radius: var(--eb-radius);
    box-shadow: var(--eb-shadow);
    padding: 1.5rem 1.75rem 2rem;
}

/* ---------- Forms ---------- */

.form-row {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.form-row label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--eb-charcoal);
}

.form-row input,
.form-row select,
.form-row textarea {
    font-family: var(--eb-body);
    font-size: 0.95rem;
    color: var(--eb-charcoal);
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--eb-line);
    border-radius: 6px;
    min-width: 16rem;
    background: var(--eb-card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--eb-orange);
    box-shadow: 0 0 0 3px rgba(250, 166, 57, 0.25);
}

/* ---------- Buttons ---------- */

button[type="submit"],
button[type="button"] {
    font-family: var(--eb-display);
    font-size: 0.88rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    background: var(--eb-orange);
    color: #fff;
    border: none;
    padding: 0.6rem 1.35rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

button[type="submit"]:hover,
button[type="button"]:hover {
    background: var(--eb-orange-dark);
}

button[type="submit"]:disabled,
button[type="button"]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ---------- Results ---------- */

.result {
    margin-top: 1.5rem;
    padding: 0.9rem 1.1rem;
    border-radius: 6px;
    font-weight: 500;
}

.result.success {
    background: var(--eb-success-soft);
    border: 1px solid var(--eb-success);
    color: #1e7e34;
}

.result.failure {
    background: var(--eb-danger-soft);
    border: 1px solid var(--eb-danger);
    color: #bd2130;
}

/* ---------- Admin tables ---------- */

.eb-table-wrap {
    overflow-x: auto;
    margin-top: 1rem;
}

.eb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.eb-table th,
.eb-table td {
    text-align: left;
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--eb-line);
    vertical-align: middle;
    white-space: nowrap;
}

.eb-table th {
    font-family: var(--eb-display);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--eb-charcoal);
    border-bottom-width: 2px;
}

.eb-table tbody tr:hover {
    background: var(--eb-orange-soft);
}

.eb-table .eb-sub {
    font-size: 0.75rem;
    color: var(--eb-text);
}

/* ---------- Cards ---------- */

.eb-card {
    background: var(--eb-card);
    border: 1px solid var(--eb-line);
    border-radius: var(--eb-radius);
    padding: 1.2rem 1.35rem 1.4rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--eb-shadow);
}

.eb-card > h2:first-child,
.eb-card > h3:first-child {
    margin-top: 0;
}

.eb-card p.eb-hint {
    font-size: 0.85rem;
    margin: 0 0 1rem;
}

/* ---------- Detail two-column layout ---------- */

.eb-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.eb-detail-grid > .eb-span-2 {
    grid-column: 1 / -1;
}

.eb-detail-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Inside the grid, spacing comes from the grid/flex gap — drop the stacked-card bottom margin. */
.eb-detail-grid > .eb-card,
.eb-detail-grid > .eb-danger-zone,
.eb-detail-col > .eb-card {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .eb-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Badges ---------- */

.eb-badge {
    display: inline-block;
    font-family: var(--eb-display);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: var(--eb-line);
    color: var(--eb-charcoal);
}

.eb-badge--active { background: var(--eb-success-soft); color: #1e7e34; }
.eb-badge--pending { background: var(--eb-orange-soft); color: var(--eb-orange-dark); }
.eb-badge--danger { background: var(--eb-danger-soft); color: #bd2130; }
.eb-badge--muted { background: #ededed; color: var(--eb-text); }

/* ---------- Alerts ---------- */

.eb-alert {
    padding: 0.8rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
}

.eb-alert--info { background: #eef4fb; border-color: #b6d4f2; color: #1c4e80; }
.eb-alert--success { background: var(--eb-success-soft); border-color: var(--eb-success); color: #1e7e34; }
.eb-alert--warning { background: var(--eb-orange-soft); border-color: var(--eb-orange); color: var(--eb-orange-dark); }
.eb-alert--danger { background: var(--eb-danger-soft); border-color: var(--eb-danger); color: #bd2130; }

/* ---------- Buttons (secondary / danger / small) ---------- */

button.eb-btn-secondary {
    background: #ffffff;
    color: var(--eb-charcoal);
    border: 1px solid var(--eb-line);
}

button.eb-btn-secondary:hover {
    background: #f6f6f6;
}

button.eb-btn-danger {
    background: var(--eb-danger);
}

button.eb-btn-danger:hover {
    background: #bd2130;
}

.eb-btn-small {
    font-size: 0.75rem !important;
    padding: 0.35rem 0.8rem !important;
}

a.eb-btn-link {
    display: inline-block;
    font-family: var(--eb-display);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--eb-line);
    color: var(--eb-charcoal);
    text-decoration: none;
}

a.eb-btn-link:hover {
    background: var(--eb-orange-soft);
    color: var(--eb-orange-dark);
    text-decoration: none;
}

.eb-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.4rem;
}

/* ---------- Definition list ---------- */

.eb-dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3rem 1rem;
    font-size: 0.9rem;
    margin: 0;
}

.eb-dl dt {
    font-weight: 600;
    color: var(--eb-charcoal);
}

.eb-dl dd {
    margin: 0;
}

/* ---------- Danger zone ---------- */

.eb-danger-zone {
    border: 1px solid var(--eb-danger);
    background: var(--eb-danger-soft);
    border-radius: var(--eb-radius);
    padding: 1.2rem 1.35rem 1.4rem;
    margin-bottom: 1.5rem;
}

.eb-danger-zone h2,
.eb-danger-zone h3 {
    color: #bd2130;
    margin-top: 0;
}

.eb-page-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
    background: var(--eb-orange-soft);
    color: var(--eb-charcoal);
    border-top: 3px solid var(--eb-orange);
    bottom: 0;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.15);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    box-sizing: border-box;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
    .top-row {
        gap: 0.75rem;
        padding: 0.6rem 1rem;
    }

    .account-strip {
        margin-left: 0;
        flex-basis: 100%;
    }

    main {
        padding: 1rem 0.75rem 2rem;
    }

    .content {
        padding: 1.1rem 1rem 1.5rem;
    }
}

/* A page heading takes focus after a page change so a screen reader says the page changed (#6125).
   It is not a control, so it shows no focus box. */
h1:focus { outline: none; }
