:root {
    --bg: #020617;
    --bg-elevated: #0b1120;
    --bg-soft: #111827;
    --bg-hover: #172033;

    --text: #f9fafb;
    --muted: #9ca3af;
    --border: #1f2937;
    --border-strong: rgba(148, 163, 184, 0.18);

    --label-bg: rgba(255, 255, 255, 0.04);
    --label-fg: #cbd5e1;

    --primary: #38bdf8;
    --primary-strong: #0ea5e9;

    --orange: #f97316;
    --orange-strong: #ea580c;

    --sps-green: #22c55e;

    --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.45);
    --shadow-strong: 0 24px 60px rgba(15, 23, 42, 0.8);
}

html,
body {
    height: 100%;
    margin: 0;

    background-color: #020617;
    background-image:
        radial-gradient(circle at top, #1f2937 0, #020617 55%),
        radial-gradient(circle at bottom, #020617 0, #020617 55%);
    background-repeat: no-repeat, no-repeat;
    background-attachment: fixed, fixed;
    background-size: 140% 140%, 140% 140%;

    overscroll-behavior-y: none;
    overflow-x: hidden;
}

body {
    font-family: Arial, sans-serif;
    color: var(--text);
    /* padding: 2rem 1rem; */
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page-container {
    max-width: 600px;
    margin: 0 auto;      /* center on wide screens */
    width: 100%;
    padding-top: 2rem;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text);
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}


li.row {
    display: flex;
    gap: 0.4rem;
    margin: 0.5rem 0;
    padding: 0;
    border: 0;
    background: transparent;
    align-items: stretch;
}

.box {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(11, 17, 32, 0.98));
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.06s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.box:hover {
    background: linear-gradient(180deg, rgba(23, 32, 51, 0.98), rgba(11, 17, 32, 1));
    border-color: rgba(209, 213, 219, 0.28);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.5);
}

.box:active {
    transform: scale(0.99);
}

.box.sds {
    padding: 1.25rem 1rem 0.75rem 1rem;
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
}

.box.sps {
    width: 64px;
    padding: 1.1rem 0 0.65rem 0;
    flex: 0 0 64px;
}

.box.empty {
    border: 1px dashed rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.02);
    cursor: default;
    box-shadow: none;
}

.box.empty:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(148, 163, 184, 0.22);
    box-shadow: none;
}

/* Floating labels */
.label-sds,
.label-sps {
    position: absolute;
    top: 6px;
    left: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--label-fg);
    background: var(--label-bg);
    padding: 2px 6px;
    border-radius: 999px;
    pointer-events: none;
    user-select: none;
    border: 1px solid rgba(148, 163, 184, 0.14);
    backdrop-filter: blur(4px);
}

.label-sps {
    left: 50%;
    transform: translateX(-50%);
    color: #86efac;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.24);
}

.doc-title {
    font-size: 0.95rem;
    line-height: 1.2;
    word-break: break-word;
    color: var(--text);
}

.icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    color: #e5e7eb;
}

/* Logo Section - Clickable with hover feedback   */

.logo-container {
    height: 10vh;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
}

.logo {
    max-height: 100%;
    max-width: 80%;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.15s ease;

    filter:
        drop-shadow(0 0 4px rgba(56, 189, 248, 0.55))
        drop-shadow(0 0 10px rgba(56, 189, 248, 0.35));

    animation: logoGlowSoft 4s ease-in-out infinite;
}

.logo:hover {
    transform: scale(1.03);
}

@keyframes logoGlowSoft {
    0% {
        filter:
            drop-shadow(0 0 3px rgba(56, 189, 248, 0.45))
            drop-shadow(0 0 8px rgba(56, 189, 248, 0.25));
    }
    50% {
        filter:
            drop-shadow(0 0 6px rgba(56, 189, 248, 0.8))
            drop-shadow(0 0 14px rgba(56, 189, 248, 0.5));
    }
    100% {
        filter:
            drop-shadow(0 0 3px rgba(56, 189, 248, 0.45))
            drop-shadow(0 0 8px rgba(56, 189, 248, 0.25));
    }
}



/* page spacing: keep some room on the sides but allow full-width content */
body {
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
}

#selectors {
    display: none;
    gap: 12px;
    /* padding: 12px; */
    width: 100%;
    box-sizing: border-box;
}

/* let the card take the whole available width */


.tree {
    list-style: none;
    padding-left: 0;
    margin: 0;
    width: 100%;
}

/* full width rows; padding increased for more breathing room */
.selector-card {
    background: transparent;
    border-radius: 18px;
    padding: 14px;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.tree-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;

    padding: 14px 14px;
    border-radius: 12px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-sizing: border-box;
    width: 100%;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.tree-item .left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tree-item.expandable:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(148, 163, 184, 0.2);
}


.tree-item .label {
    flex: 1;
    min-width: 0;
    font-size: 16px;
    line-height: 1.3;
    color: var(--text);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.tree-item.expandable {
    cursor: pointer;
}

.tree-item.expandable .left,
.tree-item.expandable .label {
    cursor: pointer;
}

.tree-children {
    padding-left: 12px;
    margin-top: 6px;
}

.muted {
    color: var(--muted);
    font-size: 14px;
    padding: 8px;
}

/* Outlined visit button (instead of filled) */
.visit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--orange), var(--orange-strong));
    color: #fff;
    border: none;
    padding: 10px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 14px 30px rgba(248, 113, 22, 0.28);
    transition: transform .08s ease, box-shadow .12s ease, filter .12s ease;
    min-width: 44px;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
}

.visit-btn:hover {
    filter: brightness(1.05);
    box-shadow: 0 16px 40px rgba(248, 113, 22, 0.4);
}

.visit-btn:active {
    transform: translateY(1px) scale(0.997);
}

.visit-btn .vis-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    color: currentColor;
}

.expand-toggle {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    flex: 0 0 34px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.expand-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(148, 163, 184, 0.2);
}


/* smaller paddings on very small screens */
@media (max-width:480px) {
    .tree-item {
        padding: 10px 10px;
    }

    .tree-item .label {
        font-size: 14px;
    }

    body {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}


@media (max-width: 480px) {
    .box.preview {
        width: 60px;
        height: 60px;
        flex: 0 0 60px;
    }

    .box.sps {
        width: 56px;
        flex: 0 0 56px;
    }

    .box.sds {
        padding: 1rem 0.6rem 0.55rem 0.6rem;
    }

    .doc-title {
        font-size: 0.82rem;
        line-height: 1.1;
    }

    .icon {
        width: 16px;
        height: 16px;
        flex: 0 0 16px;
    }
}

/* TREE ITEMS SPACING*/

/* Base tree item spacing (locations) */
.tree > li > .tree-item {
    margin: 10px 0; /* a bit more space between locations */
    padding: 14px 12px; /* can stay the same for larger clickable area */
}

/* Rooms under locations */
.tree > li > .tree-children > ul > li > .tree-item {
    margin: 5px 0; /* less space than locations */
    padding: 10px 12px; /* slightly smaller padding */
}

/* Storage units under rooms */
.tree > li > .tree-children > ul > li > .tree-children > ul > li > .tree-item {
    margin: 0px 0; /* very tight spacing */
    padding: 6px 12px; /* compact padding */
}


/* Back button */
.topbar{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  padding: 0.25rem 0;
}

.back-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .08s ease, box-shadow .12s ease, background .12s;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.36);
}

.back-btn:active {
    transform: translateY(1px) scale(0.997);
}

.back-icon {
    width: 22px;
    height: 22px;
}



/* image */
.box.preview {
    width: 72px;
    height: 72px;
    padding: 0;
    flex: 0 0 72px;
    overflow: hidden;
    justify-content: center;
    align-items: center;
    background: #0f172a;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-placeholder {
    font-size: 0.65rem;
    color: var(--muted);
    text-align: center;
    padding: 0.25rem;
}

.image-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.image-preview-modal.hidden {
    display: none;
}

.image-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.82);
    backdrop-filter: blur(4px);
}

.image-preview-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, 88vw);
    max-height: 80vh;
    background: radial-gradient(circle at top left, #111827 0, #020617 65%);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-full {
    max-width: 100%;
    max-height: calc(80vh - 2rem);
    object-fit: contain;
    display: block;
    border-radius: 10px;
}

.image-preview-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.15s ease;
}

.image-preview-close:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: scale(1.06);
}

.box.preview.clickable {
    cursor: zoom-in;
}


/* breadcrumbs to illustrate where the user is */
.breadcrumb {
    margin: 0 0 8px 0;
    padding: 2px 2px 6px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 0.82rem;
    line-height: 1.4;
    box-shadow: none;
    opacity: 0.95;
}

.breadcrumb::before {
    content: "Physical Location";
    display: block;
    margin-bottom: 2px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.breadcrumb.hidden {
    display: none;
}



/* Searchbar */
/* Accessible hidden label */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Search bar under breadcrumb */
.results-search {
    /* margin: 0 0 14px 0; */
    margin: 0;
}

.results-search.hidden {
    display: none;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.search-input-wrap:focus-within {
    border-color: rgba(56, 189, 248, 0.45);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.search-icon {
    width: 18px;
    height: 18px;
    color: var(--muted);
    flex: 0 0 18px;
    margin-left: 12px;
}

.search-input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 0.95rem;
    padding: 12px 12px 12px 10px;
}

.search-input::placeholder {
    color: var(--muted);
}

.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-results-button,
.search-input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.search-input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
}

.clear-search {
    border: 0;
    background: transparent;
    color: var(--muted);
    width: 38px;
    height: 38px;
    margin-right: 4px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.clear-search:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.clear-search.hidden {
    display: none;
}


.results-sticky-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.35rem 0;
    margin-bottom: 14px;
    /* background: rgba(2, 6, 23, 0.82); */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.results-sticky-bar.hidden {
    display: none;
}