/* ============================================================ *
 *  Site-wide typography (Inter)                                  *
 * ============================================================ */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --bs-font-monospace: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}
body {
    font-family: var(--bs-body-font-family);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11"; /* Inter's nicer alternates */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
code, pre, kbd, samp, .font-monospace {
    font-family: var(--bs-font-monospace);
}

main > .container {
    padding: 70px 15px 20px;
}

/* Normalize buttons across Materia (light) and Darkly (dark).
 * Materia overrides Bootstrap with bigger padding + uppercase text, which
 * makes light-mode buttons look noticeably bigger than dark-mode ones.
 * Force the standard Bootstrap 5 sizing in both themes. */
.btn {
    text-transform: none !important;
    --bs-btn-padding-y: 0.375rem;
    --bs-btn-padding-x: 0.75rem;
    --bs-btn-font-size: 1rem;
    --bs-btn-line-height: 1.5;
    --bs-btn-border-radius: 0.375rem;
    font-weight: 500;
    letter-spacing: 0;
}
.btn-sm {
    --bs-btn-padding-y: 0.25rem;
    --bs-btn-padding-x: 0.5rem;
    --bs-btn-font-size: 0.875rem;
    --bs-btn-border-radius: 0.25rem;
}
.btn-lg {
    --bs-btn-padding-y: 0.5rem;
    --bs-btn-padding-x: 1rem;
    --bs-btn-font-size: 1.25rem;
}

/* ============================================================ *
 *  Theme toggle button (Material-style icon button on navbar)   *
 * ============================================================ */

.theme-toggle-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.theme-toggle-btn:hover,
.theme-toggle-btn:focus {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-emphasis-color);
    color: var(--bs-emphasis-color);
    outline: none;
}

.theme-toggle-btn:active {
    transform: scale(0.94);
}

.theme-toggle-btn i {
    line-height: 1;
}

/* Force white nav text/links in dark mode (Darkly's defaults can be too dim
 * against bg-body-tertiary). Light mode stays untouched. */
[data-bs-theme="dark"] .navbar .navbar-brand,
[data-bs-theme="dark"] .navbar .nav-link,
[data-bs-theme="dark"] .navbar .navbar-text,
[data-bs-theme="dark"] .navbar .dropdown-toggle {
    color: #fff !important;
}
[data-bs-theme="dark"] .navbar .nav-link:hover,
[data-bs-theme="dark"] .navbar .nav-link:focus,
[data-bs-theme="dark"] .navbar .dropdown-toggle:hover {
    color: rgba(255, 255, 255, 0.85) !important;
}
[data-bs-theme="dark"] .theme-toggle-btn {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.10);
}
[data-bs-theme="dark"] .theme-toggle-btn:hover,
[data-bs-theme="dark"] .theme-toggle-btn:focus {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.22);
}

/* ============================================================ *
 *  Navbar: button-as-nav-link + active state                    *
 * ============================================================ */

.navbar .nav-link-button {
    background: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.navbar .nav-link.active {
    font-weight: 600;
    position: relative;
}

.navbar .nav-link.active::after {
    content: '';
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.15rem;
    height: 2px;
    background: var(--bs-primary);
    border-radius: 2px;
}

[data-bs-theme="dark"] .navbar .nav-link.active::after {
    background: #fff;
}

/* ============================================================ *
 *  Parking Sites offcanvas tiles                                *
 * ============================================================ */

.parking-tile {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1rem;
    border-radius: 10px;
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .15s ease, border-color .15s ease, transform .12s ease;
}

.parking-tile:hover,
.parking-tile:focus {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-primary-border-subtle);
    color: var(--bs-body-color);
    transform: translateX(2px);
}

.parking-tile-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.parking-tile-body {
    flex: 1 1 auto;
    min-width: 0;
}

.parking-tile-title {
    font-weight: 600;
    line-height: 1.2;
}

.parking-tile-sub {
    line-height: 1.2;
    margin-top: .15rem;
}

.parking-tile-all .parking-tile-icon {
    background: var(--bs-primary);
    color: #fff;
}

/* Icon-only action buttons in tables: equal-size square buttons */
.device-action-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.device-action-btn i {
    font-size: 0.95rem;
    line-height: 1;
}

/* ============================================================ *
 *  Shared UI primitives — KPI strip, events list, empty state.   *
 *  Lifted out of parking.css so they apply on spot/device too.   *
 * ============================================================ */

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
}

.kpi-stat {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    padding: .9rem 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
    border-left: 4px solid var(--bs-border-color);
    transition: border-color .15s ease, background .15s ease;
}

.kpi-stat-value {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--bs-emphasis-color);
    line-height: 1.1;
}

.kpi-stat-label {
    font-size: .78rem;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: .15rem;
}

.kpi-stat.is-warning {
    border-left-color: var(--bs-warning);
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
}
.kpi-stat.is-warning .kpi-stat-value {
    color: var(--bs-warning-text-emphasis);
}
.kpi-stat.is-alert {
    border-left-color: var(--bs-danger);
    background: var(--bs-danger-bg-subtle);
    color: var(--bs-danger-text-emphasis);
}
.kpi-stat.is-alert .kpi-stat-value {
    color: var(--bs-danger-text-emphasis);
}
.kpi-stat-meta {
    background: var(--bs-tertiary-bg);
}

.events-controls .btn-group .btn.active {
    z-index: 1;
}

.events-list {
    max-height: 460px;
    overflow-y: auto;
}

.event-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .65rem;
    align-items: start;
    padding: .55rem .25rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    transition: background .12s ease;
}
.event-row:hover {
    background: var(--bs-tertiary-bg);
}
.event-row:last-child {
    border-bottom: none;
}

.event-icon {
    font-size: 1.2rem;
    line-height: 1.4;
    width: 1.6rem;
    text-align: center;
}

.event-body { min-width: 0; }

.event-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .15rem;
}

.event-title {
    font-weight: 500;
    color: var(--bs-body-color);
}

.event-detail { flex-shrink: 0; }

.event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    font-size: .78rem;
}
.event-meta i {
    margin-right: .15rem;
    opacity: .7;
}

.event-skeleton {
    pointer-events: none;
    opacity: .85;
}

.empty-state {
    line-height: 1.4;
}

@media (max-width: 575.98px) {
    .kpi-strip {
        grid-template-columns: repeat(2, 1fr);
        gap: .5rem;
    }
    .kpi-stat {
        padding: .65rem .75rem;
    }
    .kpi-stat-value {
        font-size: 1.25rem;
    }
}

/* ============================================================ *
 *  Breadcrumb bar (rendered between navbar and main content)    *
 * ============================================================ */

.breadcrumb-bar {
    background: var(--bs-tertiary-bg);
    border-bottom: 1px solid var(--bs-border-color);
    padding: .55rem 0;
    margin-top: 56px; /* clear the fixed navbar */
}

.breadcrumb-bar .breadcrumb {
    margin: 0;
    flex-wrap: wrap;
    /* No overflow constraint here — overflow:auto/hidden on the breadcrumb
     * would clip the sibling-switcher dropdown menus, which use absolute
     * positioning and need to escape the bar. */
    --bs-breadcrumb-divider: '/';
}

.breadcrumb-bar .breadcrumb-item {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.breadcrumb-bar .breadcrumb-link {
    color: var(--bs-body-color);
    text-decoration: none;
    font-weight: 500;
}
.breadcrumb-bar .breadcrumb-link:hover {
    color: var(--bs-primary);
    text-decoration: underline;
}

.breadcrumb-bar .breadcrumb-item.active {
    color: var(--bs-secondary-color);
}

.sibling-dropdown { margin-left: .15rem; }
.sibling-caret {
    padding: 0 .25rem;
    line-height: 1;
    color: var(--bs-secondary-color);
    text-decoration: none;
}
.sibling-caret:hover,
.sibling-caret:focus {
    color: var(--bs-primary);
    text-decoration: none;
}
.sibling-menu {
    --bs-dropdown-padding-y: .35rem;
    --bs-dropdown-padding-x: .35rem;
    --bs-dropdown-item-padding-y: .5rem;
    --bs-dropdown-item-padding-x: .65rem;
    --bs-dropdown-border-width: 0;
    --bs-dropdown-border-radius: 12px;
    --bs-dropdown-inner-border-radius: 8px;

    max-height: 320px;
    overflow-y: auto;
    min-width: 240px;
    margin-top: .35rem !important;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .12),
                0 2px 6px  rgba(0, 0, 0, .06);
    z-index: 1080;  /* above the fixed-top navbar (1030) and modal backdrop (1050) */
}

.sibling-menu .dropdown-item {
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: .5rem;
    line-height: 1.25;
    transition: background .12s ease, color .12s ease;
}

.sibling-menu .dropdown-item:hover,
.sibling-menu .dropdown-item:focus {
    background: var(--bs-tertiary-bg);
    color: var(--bs-primary);
}

.sibling-menu .dropdown-item:active {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

.sibling-menu .dropdown-item-text {
    padding: .5rem .65rem;
    line-height: 1.25;
}

[data-bs-theme="dark"] .sibling-menu {
    box-shadow: 0 8px 28px rgba(0, 0, 0, .55),
                0 2px 8px  rgba(0, 0, 0, .35);
}

/* Pages with the breadcrumb bar don't need the fixed-top navbar
 * spacer — breadcrumb-bar already pushes content down. */
body:has(.breadcrumb-bar) main#main {
    padding-top: 0 !important;
}

/* Dark-mode contrast: outline-secondary actions need lighter color
 * (Darkly's default outline-secondary is too dim against the row bg). */
[data-bs-theme="dark"] .device-action-btn.btn-outline-secondary,
[data-bs-theme="dark"] .device-action-btn.btn-outline-info {
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.35);
}
[data-bs-theme="dark"] .device-action-btn.btn-outline-secondary:hover,
[data-bs-theme="dark"] .device-action-btn.btn-outline-info:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.55);
}

/* ============================================================ *
 *  Quick Launcher (Cmd-K) — navbar trigger + modal              *
 * ============================================================ */

/* Navbar trigger pill */
.launcher-trigger {
    display: inline-flex;
    align-items: center;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    border-radius: 8px;
    padding: .35rem .7rem;
    font-size: .85rem;
    line-height: 1.2;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    min-width: 240px;
}
.launcher-trigger:hover,
.launcher-trigger:focus {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-emphasis-color);
    color: var(--bs-body-color);
    outline: none;
}
.launcher-trigger-text {
    flex: 1;
    text-align: left;
}
.launcher-trigger-kbd {
    display: inline-flex;
    gap: .15rem;
    margin-left: .75rem;
    opacity: .75;
}
.launcher-trigger-kbd kbd {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    border-radius: 4px;
    font-size: .7rem;
    padding: 1px 5px;
    line-height: 1;
}

@media (max-width: 575.98px) {
    .launcher-trigger {
        min-width: 0;
    }
    .launcher-trigger-text,
    .launcher-trigger-kbd {
        display: none;
    }
}

/* Modal */
.launcher-modal {
    border-radius: 12px;
    overflow: hidden;
}

.launcher-search-wrap {
    display: flex;
    align-items: center;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    gap: .6rem;
}

.launcher-search-icon {
    font-size: 1.05rem;
    color: var(--bs-secondary-color);
}

.launcher-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--bs-body-color);
    font-size: 1.05rem;
    padding: .25rem 0;
}
.launcher-input::placeholder {
    color: var(--bs-secondary-color);
    opacity: .7;
}

.launcher-esc {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    border-radius: 4px;
    font-size: .7rem;
    padding: 2px 6px;
    line-height: 1;
}

.launcher-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: .5rem 0;
}

.launcher-section-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--bs-secondary-color);
    padding: .5rem 1rem .25rem;
    font-weight: 600;
}

.launcher-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 1rem;
    cursor: pointer;
    color: var(--bs-body-color);
    text-decoration: none;
    transition: background .1s;
    border-left: 3px solid transparent;
}
.launcher-item:hover,
.launcher-item.is-active {
    background: var(--bs-tertiary-bg);
    border-left-color: var(--bs-primary);
    color: var(--bs-body-color);
}

.launcher-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    flex-shrink: 0;
}

.launcher-item-body {
    flex: 1;
    min-width: 0;
}
.launcher-item-title {
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.launcher-item-sub {
    font-size: .78rem;
    color: var(--bs-secondary-color);
    line-height: 1.2;
}

.launcher-item-kbd {
    color: var(--bs-secondary-color);
    opacity: 0;
    transition: opacity .1s;
}
.launcher-item:hover .launcher-item-kbd,
.launcher-item.is-active .launcher-item-kbd {
    opacity: 1;
}

.launcher-empty {
    text-align: center;
    color: var(--bs-secondary-color);
    padding: 2rem 1rem;
}

.launcher-footer {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    padding: .55rem 1rem;
    border-top: 1px solid var(--bs-border-color);
    font-size: .75rem;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
}
.launcher-footer kbd {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    border-radius: 3px;
    font-size: .7rem;
    padding: 1px 5px;
    margin-right: .15rem;
    line-height: 1;
}

/* Prevent fixed-top navbar from covering page content */
body {
    padding-top: 56px; /* default Bootstrap navbar height */
}

@media (min-width: 767px) {
    body {
        padding-top: 56px;
    }
}

.footer {
    background-color: #f5f5f5;
    font-size: .9em;
    height: 60px;
}

.footer > .container {
    padding-right: 15px;
    padding-left: 15px;
}

.not-set {
    color: #c55;
    font-style: italic;
}

/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
    content: '';
    left: 3px;
    display: inline-block;
    width: 0;
    height: 0;
    border: solid 5px transparent;
    margin: 4px 4px 2px 4px;
    background: transparent;
}

a.asc:after {
    border-bottom: solid 7px #212529;
    border-top-width: 0;
}

a.desc:after {
    border-top: solid 7px #212529;
    border-bottom-width: 0;
}

.grid-view th {
    white-space: nowrap;
}

.hint-block {
    display: block;
    margin-top: 5px;
    color: #999;
}

.error-summary {
    color: #a94442;
    background: #fdf7f7;
    border-left: 3px solid #eed3d7;
    padding: 10px 20px;
    margin: 0 0 15px 0;
}

/* align the logout "link" (button in form) of the navbar */
.nav li > form > button.logout {
    padding-top: 7px;
    color: rgba(255, 255, 255, 0.5);
}

@media(max-width:767px) {
    .nav li > form > button.logout {
        display:block;
        text-align: left;
        width: 100%;
        padding: 10px 0;
    }
}

.nav > li > form > button.logout:focus,
.nav > li > form > button.logout:hover {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.75);
}

.nav > li > form > button.logout:focus {
    outline: none;
}

.form-group {
    margin-bottom: 1rem;
}

/* Navbar dropdown opens on hover (desktop). Click still works (mobile). */
/*@media (min-width: 992px) {*/
/*    .navbar .dropdown:hover > .dropdown-menu {*/
/*        display: block;*/
/*    }*/
/*    .navbar .dropdown-menu {*/
/*        margin-top: 0;*/
/*    }*/
/*}*/
