/*
 * Application styles on top of Bootstrap 5.3.
 * Colors use Bootstrap's CSS variables, so light and dark mode both work.
 */

:root {
    --app-sidebar-width: 250px;
    --app-sidebar-bg: #1d2433;
    --app-sidebar-color: rgba(255, 255, 255, 0.72);
}

body {
    min-height: 100vh;
}

/* ---- Layout: sidebar + main column ---- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    --bs-offcanvas-width: var(--app-sidebar-width);
    --bs-offcanvas-bg: var(--app-sidebar-bg);
    color: var(--app-sidebar-color);
}

/* Bootstrap makes .offcanvas-lg transparent on large screens; keep the dark menu. */
.app-sidebar.offcanvas-lg,
.app-sidebar.offcanvas-lg .offcanvas-body {
    background-color: var(--app-sidebar-bg) !important;
}

@media (min-width: 992px) {
    .app-sidebar {
        width: var(--app-sidebar-width);
        flex-shrink: 0;
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }

    .app-sidebar .offcanvas-body {
        flex-grow: 1 !important;
    }
}

.app-brand {
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-brand .bi {
    font-size: 1.35rem;
    color: #6ea8fe;
}

.app-nav-heading {
    padding: 1rem 1.5rem 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42);
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 1px 0.6rem;
    padding: 0.4rem 0.8rem;
    border-radius: 0.4rem;
    color: var(--app-sidebar-color);
    font-size: 0.925rem;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
}

.app-sidebar .nav-link.active {
    color: #fff;
    background: var(--bs-primary);
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
}

.app-search {
    flex: 1 1 auto;
    max-width: 440px;
}

.app-content {
    flex: 1 1 auto;
    padding: 1.25rem 1.5rem 2.5rem;
}

@media (max-width: 575.98px) {
    .app-content {
        padding: 1rem 0.75rem 2rem;
    }
}

/* ---- Login and other guest pages ---- */

.app-guest {
    background: var(--bs-tertiary-bg);
}

.guest-card {
    width: 100%;
    max-width: 410px;
}

.guest-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    font-size: 1.75rem;
    color: #fff;
    background: var(--bs-primary);
}

/* ---- Page header ---- */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 600;
}

.page-header .page-subtitle {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

.page-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.6rem;
    font-size: 1.2rem;
    color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
}

/* ---- Cards with key figures ---- */

.stat-card {
    height: 100%;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color);
}

.stat-card .stat-value {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.3;
}

.stat-card .stat-icon {
    font-size: 1.6rem;
    opacity: 0.35;
}

/* ---- Tables ---- */

.table-app {
    margin-bottom: 0;
}

.table-app th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.table-app th a {
    color: inherit;
    text-decoration: none;
}

.table-app td {
    vertical-align: middle;
}

.table-app .col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: end;
}

.table-app tfoot td {
    font-weight: 600;
}

/* ---- Detail pages ---- */

.detail-grid dt {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
}

.detail-grid dd {
    margin-bottom: 0.9rem;
    overflow-wrap: anywhere;
}

.detail-section-title {
    margin: 0.5rem 0 0.9rem;
    padding-bottom: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color);
    border-bottom: 1px solid var(--bs-border-color);
}

/* Many tabs: they wrap on large screens and scroll sideways on phones. */
.nav-tabs-scroll .nav-link {
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .nav-tabs-scroll {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
    }
}

.form-section-title {
    margin: 1.25rem 0 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color);
}

.form-section-title:first-child {
    margin-top: 0;
}

/* ---- Photos ---- */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.9rem;
}

.photo-grid figure {
    margin: 0;
}

.photo-grid img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 0.5rem;
    cursor: zoom-in;
    background: var(--bs-tertiary-bg);
}

/* ---- Notes, timeline ---- */

.note-item + .note-item,
.timeline-item + .timeline-item {
    border-top: 1px solid var(--bs-border-color-translucent);
}

.note-pinned {
    border-left: 3px solid var(--bs-warning);
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
}

.tag-badge form {
    display: inline;
}

.tag-badge button {
    padding: 0;
    border: 0;
    line-height: 1;
    background: none;
    color: inherit;
    opacity: 0.6;
}

.tag-badge button:hover {
    opacity: 1;
}

/* ---- Misc ---- */

.text-pre {
    white-space: pre-wrap;
}

.min-w-0 {
    min-width: 0;
}

.btn-icon {
    --bs-btn-padding-x: 0.45rem;
    --bs-btn-padding-y: 0.15rem;
}

.card-header .nav-tabs {
    margin-bottom: calc(-1 * var(--bs-card-cap-padding-y));
    border-bottom: 0;
}

.list-group-item .small.text-body-secondary {
    line-height: 1.35;
}

/* On wide screens the filter dropdowns of list pages take the width of their content, within limits. */
@media (min-width: 1200px) {
    .list-filter-select {
        min-width: 9rem;
        max-width: 16rem;
    }
}
