/* ---------------------------------------------------------------------
   Design tokens (theme-agnostic). Theme-specific colors (gradients,
   primary accents, derived soft/border tints) live in theme.css and are
   consumed here via var() — load order between the two files does not
   matter for custom-property resolution.
   --------------------------------------------------------------------- */
:root {
    --surface-0: #ffffff;
    --surface-1: #f2f0fb;
    --surface-2: #e9e5f9;
    --border-subtle: rgba(76, 61, 145, 0.10);
    --border-strong: rgba(76, 61, 145, 0.22);
    --text-primary: #211f36;
    --text-muted: #6f6b90;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-pill: 999px;
    --shadow-sm: 0 2px 10px rgba(76, 61, 145, 0.07);
    --shadow-md: 0 10px 24px rgba(76, 61, 145, 0.11);
    --shadow-lg: 0 20px 48px rgba(76, 61, 145, 0.18);
    --font-sans: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --tap-min: 44px;

    /* Pastel icon-badge accents — theme-agnostic, cycled across cards/tiles
       so the UI reads as colorful the way a product dashboard does, without
       being tied to the selected brand theme. */
    --accent-1-bg: #fce7f3; --accent-1-fg: #db2777;
    --accent-2-bg: #dbeafe; --accent-2-fg: #2563eb;
    --accent-3-bg: #d1fae5; --accent-3-fg: #059669;
    --accent-4-bg: #fef3c7; --accent-4-fg: #d97706;
    --accent-5-bg: #ede9fe; --accent-5-fg: #7c3aed;
    --accent-6-bg: #ffe4e6; --accent-6-fg: #e11d48;
    --accent-7-bg: #ccfbf1; --accent-7-fg: #0d9488;
}

html, body {
    font-family: var(--font-sans);
    background: var(--surface-1);
    color: var(--text-primary);
}

body {
    min-height: 100vh;
}

main {
    background: var(--theme-page-wash, var(--surface-1));
    background-repeat: no-repeat;
    min-height: 100vh;
}

article.content {
    max-width: 1180px;
    margin: 0 auto;
    width: 100%;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

/* Themed page-header banner: applies to a lone top-level <h1> (most pages)
   or, when a page needs extra content next to the title (a status badge,
   e.g. WorkOrderDetail/GuestWorkOrder), to a wrapping .page-title-row —
   both get identical treatment so every page opens on a themed band. */
article.content > h1:first-of-type,
article.content > .page-title-row,
.guest-content > h1:first-of-type,
.guest-content > .page-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 1.1rem 1.5rem;
    margin: 0 0 1.75rem;
    border-radius: var(--radius-lg);
    background: var(--theme-header-banner);
    border: 1px solid var(--theme-primary-border);
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--theme-primary);
}

article.content > .page-title-row h1,
.guest-content > .page-title-row h1 {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
}

/* Section headings (h3/h5) get a small themed marker instead of relying on
   color alone, so the theme shows up every time a page breaks into a new
   section (Assign / Status / Checklists / Costs / Attachments / ...). */
h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h3::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--theme-primary);
}

.text-muted {
    color: var(--text-muted) !important;
}

a, .btn-link {
    color: var(--theme-primary, #006bb7);
    text-decoration: none;
}

a:hover, .btn-link:hover {
    color: var(--theme-primary-hover, #005694);
    text-decoration: underline;
}

/* ---- Buttons ---- */
.btn {
    border-radius: var(--radius-pill);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    min-height: var(--tap-min);
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease, filter .15s ease;
}

.btn-sm {
    border-radius: var(--radius-pill);
    padding: 0.3rem 0.85rem;
    min-height: 38px;
}

.btn-primary {
    background-image: linear-gradient(135deg, var(--theme-gradient-start), var(--theme-gradient-end));
    border: none;
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled), .btn-primary:focus:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    filter: brightness(1.05);
}

.btn-secondary {
    background: var(--theme-primary-softer);
    border-color: var(--theme-primary-border);
    color: var(--theme-primary-hover);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--theme-primary-soft);
    border-color: var(--theme-primary);
    transform: translateY(-1px);
}

.btn-outline-secondary {
    border-color: var(--theme-primary-border);
    color: var(--theme-primary-hover);
}

.btn-outline-secondary:hover:not(:disabled) {
    background: var(--theme-primary-softer);
    border-color: var(--theme-primary);
    color: var(--theme-primary-hover);
}

.btn:disabled {
    transform: none;
    box-shadow: none;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem var(--theme-primary-soft, rgba(37, 140, 251, 0.35));
}

/* ---- Forms ---- */
.form-control, .form-select {
    border-radius: var(--radius-md);
    border-color: var(--border-strong);
    padding: 0.5rem 0.75rem;
    background-color: var(--surface-0);
    min-height: var(--tap-min);
}

.form-select {
    padding-right: 2.25rem;
}

.form-select-sm, .form-control-sm {
    min-height: 38px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 0.2rem var(--theme-primary-soft);
}

label, .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    display: inline-block;
}

input[type="checkbox"], input[type="radio"] {
    accent-color: var(--theme-primary);
}

.form-check-input:checked {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
}

/* ---- Cards ---- */
.card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--surface-0);
    transition: box-shadow .15s ease, transform .15s ease;
}

/* ---- Tables ---- */
.table {
    background: var(--surface-0);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    margin-bottom: 0;
}

.table thead th {
    background: var(--theme-table-header);
    color: var(--text-primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.045em;
    font-weight: 700;
    border-bottom: 1px solid var(--theme-primary-border);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.table td {
    padding: 0.8rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-subtle);
    border-top: none;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: background-color .12s ease;
}

.table tbody tr:hover {
    background-color: var(--theme-primary-softer);
}

.table-responsive {
    margin-bottom: 1rem;
}

.table-responsive .table {
    margin-bottom: 0;
}

/* ---- Responsive "card" tables: a normal table >=768px, stacked
   label/value rows below that. Add data-label="..." (matching the <th>
   text) to every <td> and class="table table-cards" on the <table>. ---- */
@media (max-width: 767.98px) {
    .table-cards thead {
        display: none;
    }

    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td {
        display: block;
        width: 100%;
    }

    .table-cards {
        border: none;
        box-shadow: none;
        background: none;
    }

    .table-cards tbody tr {
        margin-bottom: 0.85rem;
        border: 1px solid var(--border-subtle);
        border-left: 3px solid var(--theme-primary);
        border-radius: var(--radius-lg);
        background: var(--surface-0);
        box-shadow: var(--shadow-sm);
        overflow: hidden;
    }

    .table-cards tbody tr:last-child {
        margin-bottom: 0;
    }

    .table-cards tbody tr:hover {
        background-color: var(--surface-0);
    }

    .table-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        text-align: right;
        border-bottom: 1px solid var(--border-subtle);
    }

    .table-cards td:last-child {
        border-bottom: none;
    }

    .table-cards td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
        text-align: left;
        margin-right: auto;
    }

    .table-cards td:not([data-label]) {
        justify-content: flex-start;
        text-align: left;
    }
}

/* ---- Sortable table headers + filter row (SortableTable component) ---- */
.sortable-table thead th.sortable-header {
    cursor: pointer;
    user-select: none;
}

.sortable-table thead th.sortable-header:hover {
    color: var(--theme-primary);
}

.sortable-table .sort-indicator {
    display: inline-block;
    margin-left: 0.35em;
    font-size: 0.7em;
    color: var(--theme-primary);
}

.sortable-table thead tr.filter-row th {
    padding: 0.4rem 0.6rem;
    background: var(--surface-0);
}

.sortable-table thead tr.filter-row input {
    width: 100%;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.85rem;
}

.table-pagination-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ---- Icons: inline Material Symbols, tinted via currentColor so they
   pick up the same hover/active/badge coloring the text around them uses. ---- */
.icon {
    fill: currentColor;
    display: block;
    flex-shrink: 0;
}

/* ---- Badges ---- */
.badge {
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.4em 0.75em;
    border-radius: 999px;
}

/* ---- Form card: wraps "create new X" forms so they read as a distinct
   step instead of loose fields sitting on the page background. ---- */
.form-card {
    background: var(--surface-0);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem 1.5rem;
    margin-bottom: 1.5rem;
}

.form-card > h3:first-child,
.form-card > h5:first-child {
    margin-top: 0;
}

@media (max-width: 480px) {
    .form-card {
        padding: 1rem;
    }

    .form-card button[type="submit"] {
        width: 100%;
    }
}

/* ---- Tab strip: used to split long pages (Property/Work Order detail)
   into scannable sections instead of one long scroll. ---- */
.tabstrip {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--border-subtle);
}

.tabstrip-btn {
    appearance: none;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 0.65rem 1rem;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
    min-height: var(--tap-min);
    transition: color .15s ease, border-color .15s ease;
}

.tabstrip-btn:hover {
    color: var(--theme-primary);
}

.tabstrip-btn.active {
    color: var(--theme-primary);
    border-bottom-color: var(--theme-primary);
}

/* ---- Small themed touches so the palette shows up in the details too ---- */
::selection {
    background: var(--theme-primary-soft);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--surface-2);
}

::-webkit-scrollbar-thumb {
    background: var(--theme-primary-border);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--theme-primary);
}

progress, meter {
    accent-color: var(--theme-primary);
}

/* ---- Misc content wrappers ---- */
.content {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
}

.login-container {
    max-width: 360px;
    margin: 4rem auto;
    padding: 1rem;
}

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: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5N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8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--radius-md);
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}
