/**
 * Desktop / responsive app layouts — scales from phone to ultrawide.
 * Works with Tailwind breakpoints; complements brand-ui.css.
 */

:root {
    --app-content-max: 80rem;      /* 1280px */
    --app-content-wide: 90rem;     /* 1440px */
    --app-nav-height: 5rem;
    --app-sidebar-width: 20rem;
    --app-map-filter-width: min(22rem, 28vw);
}

/* ——— App shell pages (map, detail, profile, search) ——— */
.app-page-inner {
    width: 100%;
    max-width: var(--app-content-wide);
    margin-left: auto;
    margin-right: auto;
    padding-left: clamp(1rem, 3vw, 2rem);
    padding-right: clamp(1rem, 3vw, 2rem);
}

.detail-page-inner {
    padding-top: calc(var(--app-nav-height) + env(safe-area-inset-top, 0));
    background: linear-gradient(180deg, #f9fafb 0%, #fff 12rem);
    min-height: 100vh;
}

.detail-content-shell {
    max-width: var(--app-content-wide);
    margin-left: auto;
    margin-right: auto;
    padding-top: clamp(1.5rem, 3vh, 2.5rem);
    padding-bottom: clamp(2rem, 5vh, 4rem);
}

/* ——— Run detail: single column + sticky bottom actions ——— */
.run-detail-layout,
.run-detail-layout--stacked {
    display: block;
}

.run-detail-primary {
    min-width: 0;
}

.run-detail-sidebar {
    display: none !important;
}

.run-detail-actions-mobile {
    display: none !important;
}

.run-detail-fab {
    display: none !important;
}

.run-detail-reviews {
    margin-top: 0.75rem;
}

.run-detail-page-wrap {
    padding-bottom: 5.5rem;
}

@media (min-width: 1024px) {
    .run-detail-hero {
        min-height: 10rem;
    }

    .run-detail-hero h2 {
        font-size: 2rem;
    }

    .run-detail-bottom-bar-inner {
        flex-wrap: nowrap;
    }
}

/* ——— Resort detail ——— */
#resort-runs-section .flex-wrap.items-center.gap-2 {
    align-items: center;
}

@media (min-width: 1024px) {
    #resort-runs-section > .flex-wrap.items-center.gap-2.sm\\:gap-3 {
        flex-wrap: nowrap;
        gap: 1rem;
    }

    #resort-runs-section select {
        min-width: 9rem;
    }
}

.resort-detail-layout .resort-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .resort-detail-layout .resort-stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.resort-runs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .resort-runs-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .resort-runs-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }
}

/* ——— Review filters: compact grid on desktop ——— */
.review-filters-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .review-filters-panel {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem 1.25rem;
    }

    .review-filters-panel .review-filters-sort-row {
        grid-column: 1 / -1;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem 1rem;
    }

    .review-filters-panel .review-filters-chips-row {
        grid-column: 1 / -1;
    }

    .review-filters-panel .review-descriptor-filters-row {
        grid-column: 1 / -1;
    }

    #reviews-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (min-width: 1280px) {
    #reviews-list.reviews-list-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.25rem;
    }
}

.review-card-pro {
    height: 100%;
}

/* Map page layout: see map-page.css */

@media (min-width: 1024px) {
    #map-carousel-section .browse-resorts-track,
    #resort-carousel.map-carousel-track {
        min-height: 0;
    }

    #map-carousel-section {
        padding-bottom: 0.25rem;
    }
}

/* ——— Browse resorts (home) ——— */
.resort-browse-card {
    width: 17.5rem;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .resort-browse-card {
        width: 18.75rem;
    }
}

@media (min-width: 1024px) {
    .resort-browse-card {
        width: 20rem;
    }
}

@media (min-width: 1280px) {
    .resort-browse-card {
        width: 21.5rem;
    }
}

.browse-resorts-track {
    scroll-padding-inline: 1rem;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .browse-section-header {
        margin-bottom: 0.25rem;
    }
}

/* ——— Profile ——— */
@media (min-width: 1024px) {
    #profile-content .skibum-card:first-of-type .flex-col.lg\\:flex-row {
        align-items: center;
    }

    #profile-reviews-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.25rem;
    }
}

@media (min-width: 1280px) {
    #profile-reviews-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ——— Modals ——— */
@media (min-width: 768px) {
    #review-modal .modal-panel {
        max-width: 42rem;
    }

    #login-modal .modal-panel,
    #signup-modal .modal-panel {
        max-width: 28rem;
    }
}

@media (min-width: 1024px) {
    #review-modal .modal-panel {
        max-width: 44rem;
        padding: 2rem 2.25rem;
    }

    #review-descriptors {
        gap: 0.5rem;
    }
}

/* ——— Search results: stack sections; grids live inside each section ——— */
.search-results-stack {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.search-results-section .grid {
    width: 100%;
}

/* ——— Sticky detail headers span full content width ——— */
.detail-sticky-header-inner {
    max-width: var(--app-content-wide);
    margin-left: auto;
    margin-right: auto;
}

/* ——— Elevation chart taller on desktop ——— */
@media (min-width: 1024px) {
    .elevation-chart-wrap {
        min-height: 200px;
    }

    .elevation-chart-svg {
        min-height: 180px;
    }
}

/* ——— User location marker ——— */
.user-location-marker-dot {
    width: 14px;
    height: 14px;
    background: #2563eb;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.45);
}

.user-location-pulse {
    width: 28px;
    height: 28px;
    background: rgba(37, 99, 235, 0.25);
    border-radius: 50%;
    animation: skibum-pulse 2s ease-out infinite;
}

@keyframes skibum-pulse {
    0% { transform: scale(0.6); opacity: 0.8; }
    100% { transform: scale(1.8); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .user-location-pulse {
        animation: none;
        opacity: 0.4;
    }
}
