/*
 * MDP Status - site styles on top of Bootstrap 5.3.
 * Light/dark mode uses Bootstrap's colour modes: <html data-bs-theme="light|dark">.
 * No inline styles anywhere (CSP style-src 'self'): widths come from the .w-pct-* classes at the end.
 */

/* ------------------------------------------------------------------ fonts */
@font-face { font-family: "Work Sans"; font-style: normal; font-weight: 300; font-display: swap; src: url("../fonts/work-sans-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/work-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/work-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/work-sans-latin-700-normal.woff2") format("woff2"); }

/* ------------------------------------------------------------------ theme tokens */
:root,
[data-bs-theme="light"] {
    /* Maeko Data Protect brand: pink #e74598, blue #47a2da, purple #5f2d88 */
    --mdp-pink: #e74598;
    --mdp-blue: #47a2da;
    --mdp-purple: #5f2d88;
    --mdp-deep: #24113a;              /* dark purple behind the white logo */
    --mdp-accent: var(--mdp-pink);
    --mdp-primary-dark: #4a2169;
    --mdp-navbar-bg: var(--mdp-deep);
    --mdp-footer-bg: var(--mdp-deep);
    --mdp-footer-color: #d9cbe8;
    --mdp-filter-bg: var(--bs-tertiary-bg);
    --bs-primary: #5f2d88;
    --bs-primary-rgb: 95, 45, 136;
    --bs-link-color: #1d6fa5;          /* brand blue, darkened to read on white */
    --bs-link-color-rgb: 29, 111, 165;
    --bs-link-hover-color: #5f2d88;
    --bs-body-bg: #f5f4f8;
    --bs-body-font-family: "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Site tokens are read from the page root only (the navbar carries its own data-bs-theme="dark"). */
:root[data-bs-theme="dark"] {
    --mdp-navbar-bg: #180b27;
    --mdp-footer-bg: #180b27;
    --mdp-footer-color: #bcaed0;
    --mdp-primary-dark: #2f8cc6;
}

[data-bs-theme="dark"] {
    --bs-primary: #47a2da;
    --bs-primary-rgb: 71, 162, 218;
    --bs-link-color: #7fc1ea;
    --bs-link-color-rgb: 127, 193, 234;
    --bs-link-hover-color: #f08cbf;
    --bs-body-bg: #110d17;
    --bs-body-color: #e2dee8;
    --bs-secondary-bg: #1d1727;
    --bs-tertiary-bg: #18121f;
    --bs-border-color: #342b40;
    color-scheme: dark;
}

body { font-family: var(--bs-body-font-family); }

/* Bootstrap's .btn-primary / outline use compiled colours; align them with the theme token. */
.btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: var(--mdp-primary-dark);
    --bs-btn-hover-border-color: var(--mdp-primary-dark);
    --bs-btn-active-bg: var(--mdp-primary-dark);
    --bs-btn-active-border-color: var(--mdp-primary-dark);
    --bs-btn-disabled-bg: var(--bs-primary);
    --bs-btn-disabled-border-color: var(--bs-primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: var(--bs-primary);
    --bs-btn-hover-border-color: var(--bs-primary);
    --bs-btn-active-bg: var(--bs-primary);
    --bs-btn-active-border-color: var(--bs-primary);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0b1a26; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-hover-color: #0b1a26; --bs-btn-active-color: #0b1a26; }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }
[data-bs-theme="dark"] .list-group { --bs-list-group-active-color: #0b1a26; }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }

/* ------------------------------------------------------------------ navbar & footer */
.app-navbar {
    background-color: var(--mdp-navbar-bg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
    border-bottom: 3px solid var(--mdp-accent);
}
.app-navbar .navbar-brand { font-weight: 600; font-size: 1.02rem; }
.app-navbar .brand-logo { height: 2.4rem; width: auto; }
.app-navbar .brand-name { letter-spacing: .02em; }
.app-navbar .brand-sub { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--mdp-pink); }
.app-navbar .nav-link { color: rgba(255, 255, 255, .85); background: none; border: 0; }
.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus-visible,
.app-navbar .nav-link.active { color: #fff; }
.app-navbar .nav-link.active { box-shadow: inset 0 -2px 0 var(--mdp-accent); }
.app-navbar .nav-admin { color: #ffd2d2; font-weight: 600; }
.app-navbar .dropdown-menu { --bs-dropdown-link-active-bg: var(--bs-primary); }

/* Show the moon in light mode and the sun in dark mode. */
.theme-icon-dark { display: none; }
/* :root only - the navbar has its own data-bs-theme="dark". */
:root[data-bs-theme="dark"] .theme-icon-light { display: none; }
:root[data-bs-theme="dark"] .theme-icon-dark { display: inline-block; }

.app-footer { background-color: var(--mdp-footer-bg); color: var(--mdp-footer-color); }

.signin-logo { width: 13rem; max-width: 70%; height: auto; }
/* Full-colour logo on light pages, white version on dark pages. */
.logo-on-dark { display: none; }
:root[data-bs-theme="dark"] .logo-on-light { display: none; }
:root[data-bs-theme="dark"] .logo-on-dark { display: inline-block; }
.signin-band { height: 4px; background: linear-gradient(90deg, var(--mdp-blue), var(--mdp-purple) 50%, var(--mdp-pink)); }

/* ------------------------------------------------------------------ general */
.filter-card { background-color: var(--mdp-filter-bg); }
.card { --bs-card-border-color: var(--bs-border-color-translucent); }
.card-header { background-color: var(--bs-tertiary-bg); }
.table thead th { white-space: nowrap; font-weight: 600; font-size: .8125rem; color: var(--bs-secondary-color); }
.form-switch-lg .form-check-input { width: 3.25rem; height: 1.75rem; cursor: pointer; }

/* Filter bar */
.flt-label { display: block; font-size: .75rem; color: var(--bs-secondary-color); margin-bottom: .15rem; }
.flt-md { width: 13rem; }
.flt-grow { flex: 1 1 14rem; min-width: 12rem; }
.flt-buttons { margin-left: auto; }

/* Clickable table rows */
tr.row-link { cursor: pointer; }

/* Admin lists */
.admin-list { max-height: 60vh; overflow-y: auto; }

/* ------------------------------------------------------------------ status */
.health-badge { font-weight: 600; letter-spacing: .01em; }
.status-badge { font-weight: 600; font-size: .72rem; letter-spacing: .02em; }
.health-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .45rem; vertical-align: .05rem; flex: 0 0 auto; }
.status-pip { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; margin-right: .3rem; vertical-align: .05rem; }
.issues-cell { min-width: 14rem; }
@media (min-width: 768px) { .text-nowrap-md { white-space: nowrap; } }
.storage-cell { min-width: 9rem; }
.storage-bar .progress { height: .45rem; margin-bottom: .2rem; }
.alert-open td { background-color: rgba(var(--bs-danger-rgb), .04); }

/* Overview tiles */
.stat-tile { transition: transform .1s ease, box-shadow .1s ease; border-width: 1px; }
.stat-tile:hover { transform: translateY(-1px); box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .08) !important; }
.stat-icon { font-size: 2rem; line-height: 1; }
.stat-value { font-size: 1.75rem; font-weight: 600; line-height: 1.1; color: var(--bs-body-color); font-variant-numeric: tabular-nums; }
.stat-label { font-size: .85rem; color: var(--bs-secondary-color); }

/* Report KPIs */
.kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); margin-bottom: .2rem; }
.kpi-value { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.table-scroll { max-height: 32rem; overflow-y: auto; }
.table-scroll thead.sticky-top th { background-color: var(--bs-body-bg); box-shadow: inset 0 -1px 0 var(--bs-border-color); }

/* ------------------------------------------------------------------ print */
@media print {
    .app-navbar, .app-footer, .filter-card, form, .btn { display: none !important; }
    .table-scroll { max-height: none; overflow: visible; }
}

/* ------------------------------------------------------------------ width helpers (progress bars) */
.w-pct-0 { width: 0%; }
.w-pct-1 { width: 1%; }
.w-pct-2 { width: 2%; }
.w-pct-3 { width: 3%; }
.w-pct-4 { width: 4%; }
.w-pct-5 { width: 5%; }
.w-pct-6 { width: 6%; }
.w-pct-7 { width: 7%; }
.w-pct-8 { width: 8%; }
.w-pct-9 { width: 9%; }
.w-pct-10 { width: 10%; }
.w-pct-11 { width: 11%; }
.w-pct-12 { width: 12%; }
.w-pct-13 { width: 13%; }
.w-pct-14 { width: 14%; }
.w-pct-15 { width: 15%; }
.w-pct-16 { width: 16%; }
.w-pct-17 { width: 17%; }
.w-pct-18 { width: 18%; }
.w-pct-19 { width: 19%; }
.w-pct-20 { width: 20%; }
.w-pct-21 { width: 21%; }
.w-pct-22 { width: 22%; }
.w-pct-23 { width: 23%; }
.w-pct-24 { width: 24%; }
.w-pct-25 { width: 25%; }
.w-pct-26 { width: 26%; }
.w-pct-27 { width: 27%; }
.w-pct-28 { width: 28%; }
.w-pct-29 { width: 29%; }
.w-pct-30 { width: 30%; }
.w-pct-31 { width: 31%; }
.w-pct-32 { width: 32%; }
.w-pct-33 { width: 33%; }
.w-pct-34 { width: 34%; }
.w-pct-35 { width: 35%; }
.w-pct-36 { width: 36%; }
.w-pct-37 { width: 37%; }
.w-pct-38 { width: 38%; }
.w-pct-39 { width: 39%; }
.w-pct-40 { width: 40%; }
.w-pct-41 { width: 41%; }
.w-pct-42 { width: 42%; }
.w-pct-43 { width: 43%; }
.w-pct-44 { width: 44%; }
.w-pct-45 { width: 45%; }
.w-pct-46 { width: 46%; }
.w-pct-47 { width: 47%; }
.w-pct-48 { width: 48%; }
.w-pct-49 { width: 49%; }
.w-pct-50 { width: 50%; }
.w-pct-51 { width: 51%; }
.w-pct-52 { width: 52%; }
.w-pct-53 { width: 53%; }
.w-pct-54 { width: 54%; }
.w-pct-55 { width: 55%; }
.w-pct-56 { width: 56%; }
.w-pct-57 { width: 57%; }
.w-pct-58 { width: 58%; }
.w-pct-59 { width: 59%; }
.w-pct-60 { width: 60%; }
.w-pct-61 { width: 61%; }
.w-pct-62 { width: 62%; }
.w-pct-63 { width: 63%; }
.w-pct-64 { width: 64%; }
.w-pct-65 { width: 65%; }
.w-pct-66 { width: 66%; }
.w-pct-67 { width: 67%; }
.w-pct-68 { width: 68%; }
.w-pct-69 { width: 69%; }
.w-pct-70 { width: 70%; }
.w-pct-71 { width: 71%; }
.w-pct-72 { width: 72%; }
.w-pct-73 { width: 73%; }
.w-pct-74 { width: 74%; }
.w-pct-75 { width: 75%; }
.w-pct-76 { width: 76%; }
.w-pct-77 { width: 77%; }
.w-pct-78 { width: 78%; }
.w-pct-79 { width: 79%; }
.w-pct-80 { width: 80%; }
.w-pct-81 { width: 81%; }
.w-pct-82 { width: 82%; }
.w-pct-83 { width: 83%; }
.w-pct-84 { width: 84%; }
.w-pct-85 { width: 85%; }
.w-pct-86 { width: 86%; }
.w-pct-87 { width: 87%; }
.w-pct-88 { width: 88%; }
.w-pct-89 { width: 89%; }
.w-pct-90 { width: 90%; }
.w-pct-91 { width: 91%; }
.w-pct-92 { width: 92%; }
.w-pct-93 { width: 93%; }
.w-pct-94 { width: 94%; }
.w-pct-95 { width: 95%; }
.w-pct-96 { width: 96%; }
.w-pct-97 { width: 97%; }
.w-pct-98 { width: 98%; }
.w-pct-99 { width: 99%; }
.w-pct-100 { width: 100%; }
