html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

/* Dashboard layout (templates/dashboard/home.html): sidebar (trip list +
   activity filters) at ~1/4 width, map filling the rest, side by side
   below the navbar. min-height: 0 lets #trip-sidebar scroll its own
   overflow instead of growing the whole page past the viewport. */
#dashboard-layout {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}

#trip-sidebar {
    flex: 0 0 25%;
    max-width: 25%;
    overflow-y: auto;
    border-right: 1px solid var(--bs-border-color);
}

.filter-type-icon {
    width: 16px;
    height: 16px;
}

/* Full-height map pages: #map must get an explicit flex-grow, or it
   collapses to 0 height (its own content is empty) and Leaflet silently
   renders nothing into a 0x0 container -- no JS error, just a blank page. */
#map {
    flex: 1 1 auto;
}

/* Dashboard: wraps #map so an overlay (e.g. the empty-state welcome card)
   can be positioned over the map area only, not the sidebar. */
#map-pane {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
}

.map-overlay {
    position: absolute;
    inset: 0;
    z-index: 1000; /* above Leaflet's panes and controls */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.35);
}

.map-overlay .card {
    max-width: 480px;
}

@media (max-width: 767.98px) {
    /* Stack sidebar above map on narrow screens -- 1/4 width there would
       be too cramped for the trip list and filters to be usable. */
    #dashboard-layout {
        flex-direction: column;
    }

    #trip-sidebar {
        flex: 0 0 auto;
        max-width: none;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--bs-border-color);
    }

    #map {
        min-height: 50vh;
    }
}

/* Bootstrap's global `img { max-width: 100% }` reset squashes Leaflet's
   tile/marker images -- undo it inside the map. */
.leaflet-container img {
    max-width: none;
}

/* Activity map markers (see apps/dashboard/home.html): strip Leaflet's
   default divIcon box (white background + border square) so only the
   Material Symbols icon itself shows, with a drop shadow standing in for
   a background since the vendored SVGs are plain black on transparent. */
.activity-marker {
    background: transparent;
    border: none;
}

.activity-marker img {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

/* Auth/onboarding pages (templates/allauth/layouts/entrance.html): one
   centered card on a soft gradient filling the space below the navbar. */
.auth-backdrop {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(circle at 15% 20%, rgba(13, 110, 253, 0.14), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(25, 135, 84, 0.14), transparent 45%),
        var(--bs-tertiary-bg);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    border: none;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 1.25rem;
}

/* Little map-pin mark next to the brand name. */
.auth-brand-mark {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: linear-gradient(135deg, var(--bs-primary), var(--bs-success));
    box-shadow: inset 0 0 0 0.4rem rgba(255, 255, 255, 0.85);
}

.auth-form ul {
    padding-left: 1.1rem;
    margin-bottom: 0;
}

#home-map {
    height: 70vh;
    min-height: 360px;
}

/* Import flow (templates/imports/import_start.html, import_upload.html). */
.import-source-card {
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.import-source-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--bs-box-shadow) !important;
}

.import-steps li {
    margin-bottom: 0.5rem;
}

.import-dropzone {
    display: block;
    padding: 2.5rem 1rem;
    text-align: center;
    border: 2px dashed var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: var(--bs-tertiary-bg);
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease;
    word-break: break-all;
}

.import-dropzone:hover,
.import-dropzone.dragover {
    border-color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
}

.import-dropzone.has-file {
    border-style: solid;
    border-color: var(--bs-success);
    background: var(--bs-success-bg-subtle);
}

.import-stat {
    padding: 0.75rem 0.5rem;
    border-radius: var(--bs-border-radius-lg);
    background: var(--bs-tertiary-bg);
}

.import-stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.import-stat-label {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

/* Source messages are multi-line plain text (summary + per-item errors). */
.import-log {
    white-space: pre-wrap;
    font-size: 0.85rem;
    max-height: 20rem;
    overflow-y: auto;
    padding: 0.75rem;
    border-radius: var(--bs-border-radius);
    background: var(--bs-tertiary-bg);
}

#candidate-map {
    height: 260px;
}
