/* STS Collection System — application shell styles (Milestone 01A).
   Bootstrap 5 provides the base; this file only adds the app chrome. */

:root {
    --sts-primary: #0d4d8c;
    --sts-primary-dark: #093a6b;
    --sts-sidebar-w: 264px;
    --sts-sidebar-w-collapsed: 72px;
    --sts-topbar-h: 60px;
    --sts-border: #e4e7ec;
    --sts-bg: #f5f7fa;
}

[x-cloak] { display: none !important; }

body {
    background: var(--sts-bg);
    color: #1d2939;
}

/* ---------------------------------------------------------------- topbar */
.sts-topbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--sts-topbar-h);
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 0 1rem;
    background: #fff;
    border-bottom: 1px solid var(--sts-border);
    z-index: 1030;
}
.sts-topbar__toggle {
    color: #475467;
    font-size: 1.25rem;
    padding: .25rem .5rem;
    text-decoration: none;
}
.sts-brand {
    display: flex;
    align-items: center;
    gap: .625rem;
    text-decoration: none;
    color: inherit;
}
.sts-brand__logo { height: 34px; width: auto; }
.sts-brand__mark {
    display: inline-grid;
    place-items: center;
    width: 38px; height: 38px;
    border-radius: 9px;
    background: var(--sts-primary);
    color: #fff;
    font-weight: 700;
    letter-spacing: .5px;
    font-size: .85rem;
}
.sts-brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.sts-brand__app { font-weight: 600; font-size: .95rem; }
.sts-brand__company { font-size: .72rem; color: #667085; }
.sts-usermenu { color: #344054; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }

/* ---------------------------------------------------------------- body + sidebar */
.sts-body { padding-top: var(--sts-topbar-h); }

.sts-sidebar {
    position: fixed;
    top: var(--sts-topbar-h);
    bottom: 0;
    left: 0;
    width: var(--sts-sidebar-w);
    background: #fff;
    border-right: 1px solid var(--sts-border);
    overflow-y: auto;
    transition: transform .2s ease, width .2s ease;
    z-index: 1025;
}
.sts-content {
    margin-left: var(--sts-sidebar-w);
    min-height: calc(100vh - var(--sts-topbar-h));
    transition: margin-left .2s ease;
}

.sts-nav { list-style: none; margin: 0; padding: .75rem .5rem; }
.sts-nav__item { margin-bottom: .125rem; }
.sts-nav__link {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    padding: .55rem .7rem;
    border: 0;
    background: transparent;
    border-radius: 8px;
    color: #475467;
    font-size: .9rem;
    text-decoration: none;
    text-align: left;
}
.sts-nav__link:hover { background: #f2f4f7; color: #1d2939; }
.sts-nav__link.is-active { background: rgba(13, 77, 140, .1); color: var(--sts-primary); font-weight: 600; }
.sts-nav__link i { font-size: 1.05rem; flex: none; }
.sts-nav__caret { margin-left: auto; font-size: .8rem; transition: transform .15s ease; }
.sts-nav__caret.rotate { transform: rotate(180deg); }
.sts-nav__sub { list-style: none; margin: .125rem 0 .25rem; padding-left: 1.6rem; }

.sts-backdrop {
    display: none;
    position: fixed;
    inset: var(--sts-topbar-h) 0 0 0;
    background: rgba(16, 24, 40, .45);
    z-index: 1024;
}

/* ---------------------------------------------------------------- collapsed (desktop) */
@media (min-width: 992px) {
    .sidebar-collapsed .sts-sidebar { width: var(--sts-sidebar-w-collapsed); }
    .sidebar-collapsed .sts-content { margin-left: var(--sts-sidebar-w-collapsed); }
    .sidebar-collapsed .sts-nav__text,
    .sidebar-collapsed .sts-nav__caret { display: none; }
    .sidebar-collapsed .sts-nav__link { justify-content: center; }
    .sidebar-collapsed .sts-nav__sub { display: none; }
}

/* ---------------------------------------------------------------- mobile off-canvas */
@media (max-width: 991.98px) {
    .sts-sidebar { transform: translateX(-100%); box-shadow: 0 12px 40px rgba(16,24,40,.18); }
    .sts-content { margin-left: 0; }
    .sidebar-open .sts-sidebar { transform: translateX(0); }
    .sidebar-open .sts-backdrop { display: block; }
}

/* ---------------------------------------------------------------- misc */
.sts-card { border: 1px solid var(--sts-border); border-radius: 12px; }

/* Clickable table rows — a whole <tr> that opens the record's detail (modal
   or page). Pairs with <x-data-row> + the delegated handler in app.js. The
   real per-row action buttons stay the accessible controls; the row click is
   a convenience layered on top. */
tr.sts-row-click { cursor: pointer; }
tr.sts-row-click:focus-visible { outline: 2px solid var(--sts-primary); outline-offset: -2px; }
.sts-row-hint { color: #667085; font-size: .8rem; margin-bottom: .5rem; }
.sts-empty__icon { font-size: 2.5rem; color: #98a2b3; }
.sts-empty__title { font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--sts-primary); --bs-btn-border-color: var(--sts-primary); --bs-btn-hover-bg: var(--sts-primary-dark); --bs-btn-hover-border-color: var(--sts-primary-dark); }

/* ---------------------------------------------------------------- auth screen */
.sts-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: linear-gradient(160deg, var(--sts-primary), var(--sts-primary-dark));
}
.sts-auth__card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 24px 60px rgba(9, 58, 107, .35);
}
.sts-auth__brand { text-align: center; margin-bottom: 1.5rem; }
.sts-auth__logo { height: 52px; margin-bottom: .75rem; }
.sts-auth__slogan { color: #667085; font-size: .82rem; }

/* ---------------------------------------------------------------- error pages */
.sts-error {
    min-height: 100vh;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 2rem;
}
.sts-error__code { font-size: 4rem; font-weight: 700; color: var(--sts-primary); line-height: 1; }
.sts-error__title { font-weight: 600; margin: .5rem 0; }

/* ---------------------------------------------------------------- photo viewer */
/* Shared photo modal (<x-photo-view-modal>). The image is centred absolutely so
   it can be rotated (view only) without breaking the layout; public/js/app.js
   sizes it and sets the stage height to the rotated box. Until it has been
   measured the image stays hidden, so it never flashes at its natural size. */
.sts-photo-stage {
    position: relative;
    min-height: 8rem;
    overflow: hidden;
}
.sts-photo-stage img {
    position: absolute;
    left: 50%;
    top: 50%;
    max-width: none;
    border-radius: var(--bs-border-radius);
    transform: translate(-50%, -50%);
    transition: transform .2s ease;
    visibility: hidden;
}
.sts-photo-stage img.is-fitted { visibility: visible; }
@media (prefers-reduced-motion: reduce) {
    .sts-photo-stage img { transition: none; }
}
