/* ============================================================================
   FillPure portal theme — carries over the legacy palette and card style,
   modernized for a responsive top-navbar layout.
   Palette: light blue #6ED9ED · primary #4BA1C6 · dark blue #26559C
   ============================================================================ */

:root {
    --fp-primary: #4BA1C6;
    --fp-primary-light: #6ED9ED;
    --fp-primary-dark: #26559C;
    --fp-accent: #06b6d4;
    --fp-row-hover: #d9f2fa;

    --bs-primary: #4BA1C6;
    --bs-primary-rgb: 75, 161, 198;
    --bs-link-color: #2c7fa3;
    --bs-link-hover-color: #26559C;
    --bs-border-radius: 6px;
}

html, body {
    height: 100%;
}

body {
    font-family: "Segoe UI", Verdana, Helvetica, Arial, sans-serif;
    color: #1f2933;
    background: linear-gradient(135deg, #eef6fb 0%, #e3f4fa 100%);
    min-height: 100vh;
}

/* ---- App shell -------------------------------------------------------------- */
.fp-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.fp-main {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3.5rem;
}

/* ---- Navbar ---------------------------------------------------------------- */
.fp-navbar {
    background: var(--fp-primary); /* flat FillPure brand blue */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.fp-navbar .navbar-brand {
    display: flex;
    align-items: center;
    padding: 0;
}

.fp-navbar-logo {
    height: 42px;
    width: auto;
    display: block;
}

.fp-navbar .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 600;
    border-radius: 6px;
    padding: 0.4rem 0.8rem !important;
    white-space: nowrap;
}

    .fp-navbar .nav-link:hover,
    .fp-navbar .nav-link:focus {
        color: #fff !important;
        background: rgba(255, 255, 255, 0.15);
    }

    .fp-navbar .nav-link.active {
        color: #fff !important;
        background: rgba(255, 255, 255, 0.25);
    }

.fp-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.4);
}

.fp-navbar .dropdown-menu {
    --bs-dropdown-min-width: 14rem;
}

/* ---- Page header ----------------------------------------------------------- */
.fp-page-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--fp-primary-dark);
    font-weight: 700;
    margin-bottom: 1rem;
}

    .fp-page-title .material-icons {
        font-size: 1.8rem;
        color: var(--fp-primary);
    }

/* ---- Cards ----------------------------------------------------------------- */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 14px rgba(38, 85, 156, 0.08);
    margin-bottom: 1rem;
}

.card-header {
    background: #fff;
    border-bottom: 2px solid var(--fp-primary-light);
    font-weight: 700;
    color: var(--fp-primary-dark);
    border-radius: 10px 10px 0 0 !important;
    letter-spacing: 0.02em;
}

/* KPI stat number */
.fp-stat {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--fp-primary-dark);
    line-height: 1.1;
    text-align: center;
}

.fp-stat-label {
    text-align: center;
    color: #6c757d;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* US choropleth (GeoChart) — reserve space so the tile doesn't jump while the map loads. */
.fp-usmap {
    width: 100%;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fp-usmap svg {
    max-width: 100%;
    height: auto;
}

/* ---- Step accordion (Work Orders flow) ------------------------------------- */
.fp-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fp-acc-item {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 14px rgba(38, 85, 156, 0.08);
    overflow: hidden;
}

.fp-acc-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: #fff;
    border: none;
    border-left: 4px solid transparent;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

    .fp-acc-header:hover:not(:disabled) { background: #f4fafc; }
    .fp-acc-header:disabled { opacity: 0.5; cursor: not-allowed; }

.fp-acc-item.active > .fp-acc-header {
    border-left-color: var(--fp-primary);
    background: #f4fafc;
}

.fp-acc-step {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--fp-primary-light);
    color: #0b3d52;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fp-acc-item.done .fp-acc-step { background: var(--fp-primary); color: #fff; }

.fp-acc-titles { flex: 1 1 auto; min-width: 0; }

.fp-acc-title { font-weight: 700; color: var(--fp-primary-dark); line-height: 1.2; }

.fp-acc-sub {
    font-size: 0.8rem;
    color: #6c757d;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fp-acc-chev { transition: transform 0.3s ease; color: #9aa5b1; }
.fp-acc-chev.open { transform: rotate(180deg); }

/* animate auto height with grid-template-rows 0fr → 1fr */
.fp-acc-body-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease;
}

    .fp-acc-body-wrap.open { grid-template-rows: 1fr; }

.fp-acc-body-inner { overflow: hidden; }
.fp-acc-body { padding: 0 1rem 1rem; }

.fp-fade-in { animation: fp-fadein 0.25s ease; }

@keyframes fp-fadein {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

/* segmented Work Orders / Cases switch */
.fp-seg {
    display: inline-flex;
    background: #eef2f5;
    border-radius: 999px;
    padding: 3px;
    gap: 3px;
}

    .fp-seg button {
        border: none;
        background: transparent;
        border-radius: 999px;
        padding: 0.3rem 0.9rem;
        font-weight: 600;
        font-size: 0.9rem;
        color: #5b6b78;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .fp-seg button.active {
        background: var(--fp-primary);
        color: #fff;
        box-shadow: 0 1px 4px rgba(38, 85, 156, 0.25);
    }

@media (prefers-reduced-motion: reduce) {
    .fp-acc-body-wrap, .fp-acc-chev, .fp-fade-in { transition: none; animation: none; }
}

/* ---- Loading: branded GIF loaders + skeleton shimmer ----------------------- */
.fp-loader-gif {
    display: block;
    user-select: none;
}

/* Square (circular) loader — the main block indicator. */
.fp-loader-square { width: 64px; height: 64px; }
.fp-loader-square-sm { width: 34px; height: 34px; }

/* Flat (horizontal dots) loader — inline indicator beside text/in table cells. */
.fp-loader-flat { height: 16px; width: auto; }
.fp-loader-flat-sm { height: 11px; width: auto; }

.fp-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 2.5rem 1rem;
    color: var(--fp-primary-dark);
}

/* Inline variant: loader and caption on one row (compact, no big padding). */
.fp-loading.fp-loading-inline {
    flex-direction: row;
    gap: 0.5rem;
    padding: 0;
}

    .fp-loading .fp-loading-text {
        font-weight: 600;
        letter-spacing: 0.02em;
        animation: fp-pulse 1.4s ease-in-out infinite;
    }

@keyframes fp-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.fp-skeleton {
    background: linear-gradient(90deg, #e9eef2 25%, #f6fafc 37%, #e9eef2 63%);
    background-size: 400% 100%;
    animation: fp-shimmer 1.4s ease infinite;
    border-radius: 6px;
}

@keyframes fp-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.fp-skel-line { height: 14px; margin-bottom: 0.6rem; }
.fp-skel-chart { height: 160px; }
.fp-skel-stat { height: 96px; }
.fp-skel-circle { width: 110px; height: 110px; border-radius: 50%; }

@media (prefers-reduced-motion: reduce) {
    .fp-skeleton, .fp-loading .fp-loading-text { animation: none; }
}

/* Admin tiles */
.fp-admin-tile {
    color: var(--fp-primary-dark);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

    .fp-admin-tile:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 18px rgba(38, 85, 156, 0.18);
        color: var(--fp-primary-dark);
    }

    .fp-admin-tile .fa-2x {
        color: var(--fp-primary);
    }

/* Chart bits (donut legend + bar list) */
.fp-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 6px;
}

.fp-bar-row {
    margin-bottom: 0.5rem;
}

.fp-bar-track {
    background: #eef2f5;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.fp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--fp-primary), var(--fp-primary-dark));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.fp-chart-placeholder {
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa5b1;
    background: repeating-linear-gradient(45deg, #f6fafc, #f6fafc 12px, #eef4f8 12px, #eef4f8 24px);
    border-radius: 8px;
}

/* ---- Buttons --------------------------------------------------------------- */
.btn-primary {
    --bs-btn-bg: var(--fp-primary);
    --bs-btn-border-color: var(--fp-primary);
    --bs-btn-hover-bg: var(--fp-primary-dark);
    --bs-btn-hover-border-color: var(--fp-primary-dark);
    --bs-btn-active-bg: var(--fp-primary-dark);
}

.btn-info {
    --bs-btn-bg: var(--fp-primary);
    --bs-btn-border-color: var(--fp-primary);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--fp-primary-dark);
    --bs-btn-hover-color: #fff;
}

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

/* ---- Tables ---------------------------------------------------------------- */
.table {
    --bs-table-hover-bg: var(--fp-row-hover);
}

.table > thead {
    background: var(--fp-primary);
    color: #fff;
}

    .table > thead th {
        border-color: var(--fp-primary);
        white-space: nowrap;
    }

/* ---- Survey "case field" tiles (carried from legacy) ----------------------- */
.case-field {
    background: #f8f9fa;
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    height: 100%;
    border: 1px solid #e3e6ea;
    transition: all 0.15s ease;
}

    .case-field:hover {
        background: #fff;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }

.case-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: #6c757d;
    margin-bottom: 3px;
    word-break: break-word;
}

.case-value {
    font-size: 1.1rem;
    font-weight: 500;
    color: #212529;
    word-break: break-word;
}

/* ---- Footer ---------------------------------------------------------------- */
.fp-footer {
    flex-shrink: 0;
    background: #fff;
    border-top: 2px solid var(--fp-primary-light);
    color: #6c757d;
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
    text-align: right;
}

.fp-env-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---- Image lightbox -------------------------------------------------------- */
.fp-photo {
    cursor: pointer;
    border-radius: 8px;
    max-height: 160px;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* ---- Home / landing -------------------------------------------------------- */
.fp-home {
    display: flex;
    justify-content: center;
    padding-top: 2rem;
}

.fp-home-card {
    max-width: 540px;
    width: 100%;
}

.fp-home-logo {
    max-width: 320px;
    width: 80%;
    margin-bottom: 1.5rem;
}

/* ---- Print page background ------------------------------------------------- */
.fp-print-page {
    background: #f3f6f9;
    min-height: 100vh;
}

/* ---- Blazor framework UI (carried from the default template app.css) -------- */
.validation-message { color: var(--bs-danger); }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

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

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: #fff;
}

/* ---- Responsive tweaks ----------------------------------------------------- */
@media (max-width: 575.98px) {
    .fp-stat { font-size: 1.9rem; }
    .fp-page-title { font-size: 1.4rem; }
    .fp-navbar-logo { height: 34px; }
}
