/* ============================================================================
   Device Portal — custom overrides on top of the Silicon UI Kit (Bootstrap 5).
   Kept intentionally small; Silicon provides the bulk of the styling.
   Template consumers append page-specific rules here.
   ============================================================================ */

/* --- Base font: Google Sans (applies globally via Bootstrap variable) ------ */
:root {
    --bs-body-font-family: "Google Sans", sans-serif;
}
body {
    font-family: "Google Sans", sans-serif;
    font-optical-sizing: auto;
    font-variation-settings: "GRAD" 0;
}

/* --- Authentication background (subtle) ----------------------------------- */
.authentication-bg {
    background-color: #f6f8fb;
    background-image: linear-gradient(135deg, #f6f8fb 0%, #eef2f7 100%);
}

/* Login card sits comfortably centered with a little breathing room. */
.authentication-bg .card {
    border: 0;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.06);
}

/* Bootstrap has no max-width utility; align the login-method column with the reference app. */
.login-methods {
    width: 100%;
    max-width: 400px;
}

#workos-google-login-form {
    width: 100%;
    max-width: 320px;
    margin-inline: auto;
}

/*
 * Preferred Google Identity control. This intentionally follows Google's
 * generated Material button rather than Silicon so provider branding,
 * typography, spacing, and interaction states remain accurate.
 */
.gsi-material-button {
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -webkit-appearance: none;
    background-color: #fff;
    background-image: none;
    border: 1px solid #747775;
    border-radius: 4px;
    box-sizing: border-box;
    color: #1f1f1f;
    cursor: pointer;
    font-family: "Roboto", Arial, sans-serif;
    font-size: 14px;
    height: 40px;
    letter-spacing: 0.25px;
    outline: none;
    overflow: hidden;
    padding: 0 12px;
    position: relative;
    text-align: center;
    transition: background-color 0.218s, border-color 0.218s, box-shadow 0.218s;
    vertical-align: middle;
    white-space: nowrap;
    width: 100%;
    max-width: 320px;
    min-width: min-content;
}

.gsi-material-button .gsi-material-button-icon {
    height: 20px;
    margin-right: 10px;
    min-width: 20px;
    width: 20px;
}

.gsi-material-button .gsi-material-button-content-wrapper {
    align-items: center;
    display: flex;
    flex-flow: row nowrap;
    height: 100%;
    justify-content: space-between;
    position: relative;
    width: 100%;
}

.gsi-material-button .gsi-material-button-contents {
    flex-grow: 1;
    font-family: "Roboto", Arial, sans-serif;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

.gsi-material-button .gsi-material-button-state {
    transition: opacity 0.218s;
    inset: 0;
    opacity: 0;
    position: absolute;
}

.gsi-material-button:disabled {
    cursor: default;
    background-color: #ffffff61;
    border-color: #1f1f1f1f;
}

.gsi-material-button:disabled .gsi-material-button-contents,
.gsi-material-button:disabled .gsi-material-button-icon {
    opacity: 38%;
}

.gsi-material-button:not(:disabled):active .gsi-material-button-state,
.gsi-material-button:not(:disabled):focus .gsi-material-button-state {
    background-color: #303030;
    opacity: 12%;
}

.gsi-material-button:not(:disabled):hover {
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3),
        0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

.gsi-material-button:not(:disabled):hover .gsi-material-button-state {
    background-color: #303030;
    opacity: 8%;
}

/* Left-aligned icon inside the auth inputs. */
.input-custom-icon .form-control {
    padding-left: 2.4rem;
}
.input-custom-icon .bx {
    font-size: 1.15rem;
    color: #9aa6b2;
}

/* --- Spinner utility ------------------------------------------------------ */
.spinner-portal {
    width: 3rem;
    height: 3rem;
}

/* ============================================================================
   Admin UI (Phase 8) — users + audit pages
   ============================================================================ */

/* Audit "Content" cell: long JSON should wrap rather than stretch the table. */
#audit-tbody code {
    word-break: break-all;
    white-space: normal;
}

/* Users table action column: keep the icon buttons on one row. */
#users-tbody .text-nowrap {
    column-gap: 0.15rem;
}

/* ============================================================================
   Mobile navigation drawer (offcanvas) — layout glue only.
   Makes the offcanvas a full-height flex column so the profile footer anchors
   to the bottom. The footer is a direct child of .offcanvas (outside the
   scrollable .offcanvas-body), so it is always pinned and does not need
   margin-top: auto. No colors/fonts/shadows are added here.
   ============================================================================ */
.offcanvas.offcanvas-end.portal-drawer {
    display: flex;
    flex-direction: column;
}
.portal-drawer .offcanvas-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.portal-drawer .portal-drawer-footer {
    flex-shrink: 0;
}

/* ============================================================================
   Device toolbar (VMM-style) — bare flex row, no card wrapper.
   Search sits left; group select + refresh hug the right edge. Mirrors the
   VMM Portal toolbar sizing so both portals read as one UI kit.
   ============================================================================ */
.device-toolbar {
    display: flex;
    align-items: end;
    gap: 1rem;
    width: 100%;
}
.device-toolbar__search {
    flex: 1 1 36rem;
    max-width: 36rem;
}

/* Group select + refresh grouped at the toolbar's right edge. */
.device-toolbar__controls {
    display: flex;
    align-items: end;
    gap: 1rem;
    flex: 0 0 auto;
    margin-left: auto;
}
.device-toolbar__group {
    flex: 0 0 18rem;
    max-width: 18rem;
}

@media (max-width: 767.98px) {
    .device-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .device-toolbar__search {
        flex-basis: auto;
        max-width: none;
        margin-left: 0;
    }
    .device-toolbar__controls {
        flex-direction: row;
        align-items: end;
        justify-content: space-between;
        gap: 1rem;
        width: 100%;
    }
    .device-toolbar__group {
        flex: 1 1 auto;
        max-width: none;
        margin-left: 0;
    }
}

/* ============================================================================
   Dashboard reference components
   ============================================================================ */
.dashboard-reference .dashboard-chart {
    width: 100%;
    height: 19rem;
}
.dashboard-reference .dashboard-heatmap {
    height: 18rem;
}

@media (max-width: 575.98px) {
    .dashboard-reference .dashboard-chart {
        height: 17rem;
    }
    .dashboard-reference .dashboard-heatmap {
        height: 20rem;
    }
}

/* ============================================================================
   Leaflet map fix
   ============================================================================ */
/* Fix Leaflet tile rendering: Silicon theme sets img{height:auto} globally,
   which collapses Leaflet's 256px tile images. Restore Leaflet's expected sizing. */
.leaflet-container img { height: auto; max-width: none; }
.leaflet-container .leaflet-tile { width: 256px; height: 256px; }
