/*
 * Force light mode regardless of browser/OS dark mode preference.
 * PSCareFlow is a clinical app — consistent color presentation is required.
 * Bootstrap 5.3+ respects data-bs-theme="light" on <html> (set in App.razor),
 * but this media query override ensures no browser default dark styles leak through.
 */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: light !important;
    }
    html, body {
        background-color: #ffffff !important;
        color: #212529 !important;
    }
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color-scheme: light; /* Tells browser: this page is always light */
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.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 #258cfb;
}

.content {
    padding-top: 1.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+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcu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Q3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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;
}

.rz-tooltip {
    z-index: 9999 !important;
    opacity: 1 !important;
    display: block !important;
    background: rgba(0, 0, 0, 0.9); /* Dark tooltip background */
    color: white !important;
    padding: 10px;
    border-radius: 6px;
    max-width: 300px;
    font-size: 14px;
}

/* Adjust for smaller screens */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .container {
        padding: 10px;
    }
}



/*legend*/
.legend-box {
    width: 20px;
    height: 20px;
    display: inline-block;
    margin-right: 8px;
    border-radius: 3px;
}

.legend-text {
    margin-right: 20px;
    font-weight: bold;
    font-size: 14px;
    color: #333;
}



.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background-color: rgba(255, 255, 255, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}


/* Fullscreen video */
.login-bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -10;
}

/* Dark overlay on top of video */
.login-bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    z-index: -5;
}

/* Ensures login card stays above video */
.login-wrapper {
    position: relative;
    z-index: 10;
}

.login-card-foreground {
    backdrop-filter: blur(6px);
    background: rgba(255, 255, 255, 0.88) !important;
}


/* Fullscreen video */
.home-bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -10;
}

/* Dark overlay on top of video */
.home-bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    z-index: -5;
}

/* Keep all content above video */
.header,
.container,
.footer {
    position: relative;
    z-index: 10;
}



.glass-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 18px;
    padding: 1.5rem;
}

/* =============================================
   SIDEBAR NAV STYLES
   ============================================= */
.sidebar-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: #0f1c2e;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.01em;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.nav-section {
    margin-bottom: 4px;
    padding: 0 8px;
}
.nav-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    padding: 10px 10px 4px;
    margin: 0;
}
/* Top-level direct links */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #ffffff !important;
    text-decoration: none;
    transition: background 0.15s;
    margin-bottom: 2px;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.1);
    color: #ffffff !important;
}
.sidebar-link.active {
    background: rgba(255,255,255,0.15);
    color: #ffffff !important;
}
.sidebar-link i { font-size: 1rem; flex-shrink: 0; }
/* Group toggle buttons */
.sidebar-group { margin-bottom: 2px; }
.sidebar-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 12px;
    background: rgba(255,255,255,0.07);
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}
.sidebar-group-toggle:hover { background: rgba(255,255,255,0.13); }
.sidebar-group-toggle.open { background: rgba(255,255,255,0.12); }
.group-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.group-left i { font-size: 1rem; }
.toggle-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
    opacity: 0.7;
}
.sidebar-group-toggle.open .toggle-arrow { transform: rotate(90deg); }
/* Sub-menu items */
.sidebar-group-items {
    display: none;
    padding: 3px 0 3px 10px;
}
.sidebar-group-items.show { display: block; }
.sidebar-sub-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 0.86rem;
    font-weight: 500;
    color: rgba(255,255,255,0.88) !important;
    text-decoration: none;
    transition: background 0.13s, color 0.13s;
    margin-bottom: 1px;
    white-space: nowrap;
}
.sidebar-sub-link:hover {
    background: rgba(255,255,255,0.1);
    color: #ffffff !important;
}
.sidebar-sub-link.active {
    background: rgba(99,179,237,0.2);
    color: #93c5fd !important;
    font-weight: 600;
}
.sidebar-sub-link i { font-size: 0.9rem; flex-shrink: 0; }
/* Footer */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 10px 8px;
    flex-shrink: 0;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
}
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center;
    color: #ffffff; font-size: 1.1rem; flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tenant-id { font-size: 0.7rem; color: rgba(255,255,255,0.45); }
.logout-form { margin: 0; }
.logout-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 12px;
    background: rgba(220,38,38,0.15);
    border: 1px solid rgba(220,38,38,0.25);
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 600;
    color: #fca5a5;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}
.logout-btn:hover { background: rgba(220,38,38,0.28); color: #ffffff; }

/* =============================================
   GLOBAL MOBILE RESPONSIVE
   ============================================= */

/* MudTable horizontal scroll on mobile */
@media (max-width: 768px) {
    .mud-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .mud-table-cell {
        padding: 8px 8px !important;
        font-size: 0.8rem !important;
    }
    .mud-table-head .mud-table-cell {
        font-size: 0.75rem !important;
        white-space: nowrap;
    }
    .mud-table-cell .mud-button-root {
        min-width: unset !important;
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
    }
    h2, .sa-title, .tm-title { font-size: 1.2rem !important; }
    .sa-header, .tm-header, .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }
    .sa-quick-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.75rem !important;
    }
    .qa-card { min-width: unset !important; padding: 1rem !important; }
    .tm-body.with-form { flex-direction: column !important; }
    .tm-body.with-form .tm-form-panel { width: 100% !important; max-height: 60vh; overflow-y: auto; }
    .sa-dashboard, .tm-page { padding: 0.75rem !important; }
    .mud-chip { font-size: 0.7rem !important; height: 22px !important; }
    .col-hide-mobile { display: none !important; }
    .mud-paper { padding: 0.75rem !important; }
}

@media (max-width: 480px) {
    .kpi-card { padding: 0.85rem 1rem !important; }
    .kpi-value { font-size: 1.4rem !important; }
    .kpi-icon { font-size: 1.5rem !important; }
    .qa-card i { font-size: 1.3rem !important; }
    .qa-card span { font-size: 0.78rem !important; }
    .sa-dashboard, .tm-page { padding: 0.5rem !important; }
    .mud-table-cell { padding: 6px 4px !important; font-size: 0.75rem !important; }
    .col-hide-sm { display: none !important; }
    .sa-section-title { font-size: 0.9rem !important; }
    .admin-stats-row { grid-template-columns: 1fr 1fr !important; }
    .form-grid-2col, .form-grid-3col { grid-template-columns: 1fr !important; }
}

/* ── Recert section UX (breadcrumb + sticky nav) ── */
.recert-breadcrumb { font-size: 0.8rem; margin-bottom: 10px; color: #666; }
.recert-breadcrumb a { color: #1565c0; text-decoration: none; font-weight: 500; }
.recert-breadcrumb a:hover { text-decoration: underline; }
.recert-nav-sticky { position: sticky; bottom: 0; background: #fff; padding: 12px 0 8px; margin-top: 16px; border-top: 1px solid #e0e0e0; box-shadow: 0 -2px 8px rgba(0,0,0,0.06); }

/* ── Progress To Goals panel (ptg) — used in RecertOrders, RecertMedications ── */
.ptg-hdr { background: #eff6ff; color: #1d4ed8; padding: 10px 14px; font-weight: 700; font-size: 0.8125rem; border-bottom: 1px solid #bfdbfe; border-radius: 4px 4px 0 0; }
.ptg-body { padding: 12px 14px; }