/* Import custom CSS files */
@import url('css/dark-mode.css');
@import url('css/quick-stats.css');
@import url('css/keyboard-shortcuts.css');
@import url('css/files.css');
@import url('css/search.css');
@import url('css/advanced-search.css');
@import url('css/notifications.css');
@import url('css/analytics.css');
@import url('css/checkins.css');
@import url('css/email-digests.css');
@import url('css/folder-browser.css');
@import url('css/file-version-history.css');
@import url('css/file-comments.css');
@import url('css/file-tags.css');
@import url('css/recent-files.css');
@import url('css/file-activity.css');
@import url('css/bulk-operations.css');
@import url('css/file-share.css');
@import url('css/share-page.css');
@import url('css/time-tracking.css');
@import url('css/pwa-install.css');
@import url('css/documents.css');
@import url('css/offline-status.css');

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* TeamFizz brand blue (logo #0097d6) drives Bootstrap's primary colour. Text-sized blue uses the deeper
   #0077b0, which keeps 4.5:1 contrast on white. */
:root {
    --bs-primary: #0097d6;
    --bs-primary-rgb: 0, 151, 214;
    --bs-primary-text-emphasis: #005f8d;
    --bs-primary-bg-subtle: #cceaf7;
    --bs-primary-border-subtle: #99d5ef;
    --bs-link-color: #0077b0;
    --bs-link-color-rgb: 0, 119, 176;
    --bs-link-hover-color: #005f8d;
    --bs-link-hover-color-rgb: 0, 95, 141;
    --bs-focus-ring-color: rgba(0, 151, 214, 0.25);
}

a, .btn-link {
    color: #0077b0;
}

.btn-primary {
    --bs-btn-bg: #0097d6;
    --bs-btn-border-color: #0097d6;
    --bs-btn-hover-bg: #0086c0;
    --bs-btn-hover-border-color: #0077b0;
    --bs-btn-active-bg: #0077b0;
    --bs-btn-active-border-color: #006a9d;
    --bs-btn-disabled-bg: #0097d6;
    --bs-btn-disabled-border-color: #0097d6;
    --bs-btn-focus-shadow-rgb: 0, 151, 214;
    color: #fff;
    background-color: #0097d6;
    border-color: #0097d6;
}

.btn-outline-primary {
    --bs-btn-color: #0077b0;
    --bs-btn-border-color: #0097d6;
    --bs-btn-hover-bg: #0097d6;
    --bs-btn-hover-border-color: #0097d6;
    --bs-btn-active-bg: #0086c0;
    --bs-btn-active-border-color: #0086c0;
    --bs-btn-disabled-color: #0097d6;
    --bs-btn-disabled-border-color: #0097d6;
    --bs-btn-focus-shadow-rgb: 0, 151, 214;
}

.form-check-input:checked {
    background-color: #0097d6;
    border-color: #0097d6;
}

/* Dark mode: the deeper text blue is too dark on dark surfaces, and some page styles hard-code dark label
   and heading colours */
[data-theme="dark"] :where(a:not(.btn):not(.alert-link), .btn-link) {
    color: #33b5ec;
}

/* Bootstrap's light surface utilities and the upgrade banner's tint stay light otherwise, under light text */
[data-theme="dark"] .bg-light {
    background-color: var(--bs-tertiary-bg) !important;
}

[data-theme="dark"] .bg-white {
    background-color: var(--bs-body-bg) !important;
}

[data-theme="dark"] .bg-light.text-dark,
[data-theme="dark"] .badge.bg-light {
    color: var(--bs-body-color) !important;
}

[data-theme="dark"] .upgrade-banner {
    background: var(--bs-tertiary-bg);
}

[data-theme="dark"] .btn-outline-primary {
    --bs-btn-color: #33b5ec;
    --bs-btn-border-color: #33b5ec;
    color: #33b5ec;
    border-color: #33b5ec;
}

[data-theme="dark"] .btn-outline-primary:hover {
    color: #fff;
}

[data-theme="dark"] .form-label,
[data-theme="dark"] .card :where(h1, h2, h3, h4, h5, h6, .card-title) {
    color: var(--text-primary);
}

/* Syncfusion primary buttons follow the brand blue too */
.e-btn.e-primary, .e-css.e-btn.e-primary {
    background-color: #0097d6;
    border-color: #0097d6;
    color: #fff;
}

.e-btn.e-primary:hover, .e-css.e-btn.e-primary:hover,
.e-btn.e-primary:focus, .e-css.e-btn.e-primary:focus {
    background-color: #0086c0;
    border-color: #0077b0;
    color: #fff;
}

.e-btn.e-primary:active, .e-css.e-btn.e-primary:active, .e-btn.e-primary.e-active {
    background-color: #0077b0;
    border-color: #006a9d;
    color: #fff;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #33b5ec;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

/* Global checkbox styling - prevent them from stretching wide */
.form-check-input {
    width: 1.25rem !important;
    height: 1.25rem !important;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-label {
    margin-bottom: 0;
    cursor: pointer;
}

.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+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* App-wide modal look (was set by timesheet.css and email-digests.css, which every page loads). Headers that pick
   their own colour, e.g. a red delete confirmation, keep it. */
.modal.show.d-block {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.show {
    opacity: 0.5;
}

.modal-content {
    border-radius: 12px;
    overflow: hidden;
}

.modal-header:not([class*="bg-"]) {
    background: linear-gradient(135deg, #0097d6 0%, #0077b0 100%);
    color: white;
    border: none;
}

.modal-header:not([class*="bg-"]) .btn-close {
    filter: brightness(0) invert(1);
}

.modal-footer {
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color);
}

/* Layout safety nets (found by a layout scan of the internal pages) */

/* A .card-body that is also a .row inherits the row's negative margins and pokes out of its card */
.card-body.row {
    margin-left: 0;
    margin-right: 0;
}

/* Page headers (title on one side, actions on the other): keep each button's label on one line and let the row
   wrap when the actions do not fit beside the title */
@media (min-width: 768px) {
    .page-header .btn {
        white-space: nowrap;
    }
}

.page-header > .d-flex.justify-content-between,
.page-header.d-flex.justify-content-between {
    flex-wrap: wrap;
    row-gap: 0.75rem;
}

/* Syncfusion pie/donut charts render at height: 100%; in an equal-height (h-100) card that takes the whole card body
   and pushes whatever follows the chart out of the card. Let the chart's own Height decide instead. */
.card.h-100 > .card-body > .e-accumulationchart {
    height: auto !important;
}

@media (max-width: 767.98px) {
    /* Wide tables scroll inside their card instead of pushing the whole page sideways */
    .card:has(> .table),
    .card-body:has(> .table),
    .tab-pane:has(> .table) {
        overflow-x: auto;
    }

    /* Page and card headers (title on one side, buttons on the other) wrap instead of overflowing */
    .d-flex.justify-content-between {
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }

    .nav.flex-nowrap {
        overflow-x: auto;
    }

    /* Tables outside cards, toggle groups and rows of action buttons: same idea */
    .app-content div:has(> table.table) {
        overflow-x: auto;
    }

    .btn-group:not(.btn-group-vertical),
    .d-flex:is(.gap-1, .gap-2, .gap-3) {
        flex-wrap: wrap;
    }
}
