/* v4.4.17 - Gjestehavn map and public booking pages */

.gh-correct-map {
    position: relative;
    width: 100%;
    aspect-ratio: var(--gh-map-aspect, 1920 / 1080);
    border-radius: 18px;
    overflow: hidden;
    background-color: #173451;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 20px 60px rgba(0,0,0,.24);
}

    .gh-correct-map::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        background: linear-gradient(90deg, rgba(3,14,25,.10), rgba(3,14,25,0), rgba(3,14,25,.12));
        z-index: 1;
    }

.gh-map-canvas-imgmode {
    position: relative !important;
    overflow: hidden !important;
    background-image: none !important;
    background-color: #173451 !important;
}

    .gh-map-canvas-imgmode .gh-map-bg-img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center center;
        display: block;
        z-index: 0;
        pointer-events: none;
        user-select: none;
    }

    .gh-map-canvas-imgmode .gh-map-berth,
    .gh-correct-map .berth-marker {
        position: absolute !important;
        z-index: 5 !important;
        transform-origin: center center;
    }

.gh-map-viewport-tight {
    overflow: hidden;
}

.gh-layout-grid-fixed {
    grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
    align-items: start;
}

.gh-layout-map {
    max-width: 1080px;
    margin: 0 auto;
    border: 1px solid rgba(255,255,255,.14);
}

.berth-marker,
.gh-map-berth {
    touch-action: none;
    user-select: none;
    border-radius: 11px;
    border: 2px solid rgba(255,255,255,.38);
    color: #fff;
    font-weight: 900;
    font-size: clamp(11px, 1.25vw, 18px);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0,0,0,.33), inset 0 1px 0 rgba(255,255,255,.22);
    text-shadow: 0 2px 5px rgba(0,0,0,.45);
}

    .gh-map-berth.is-free,
    .berth-marker--available {
        background: linear-gradient(180deg, rgba(74,190,112,.96), rgba(37,132,77,.96));
    }

    .gh-map-berth.is-busy,
    .berth-marker--busy,
    .berth-marker--occupied {
        background: linear-gradient(180deg, rgba(226,76,74,.96), rgba(143,38,38,.96));
    }

    .gh-map-berth.is-reserved,
    .berth-marker--reserved {
        background: linear-gradient(180deg, rgba(244,200,106,.98), rgba(205,144,28,.98));
        color: #071624;
        text-shadow: none;
    }

    .gh-map-berth.is-disabled,
    .berth-marker--disabled {
        background: linear-gradient(180deg, rgba(123,134,144,.92), rgba(76,86,95,.92));
        color: rgba(255,255,255,.78);
    }

    .berth-marker--layout-selected,
    .gh-map-berth.is-selected {
        outline: 3px solid #f4c86a !important;
        outline-offset: 2px;
        box-shadow: 0 0 0 6px rgba(244,200,106,.24), 0 10px 26px rgba(0,0,0,.35) !important;
    }

.gh-dot.reserved {
    background: #f4c86a;
}

/* Compact booking view */
.gh-booking-topbar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto auto;
    gap: 18px;
    align-items: end;
    padding: 18px 24px;
    margin-bottom: 14px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 22px;
    background: rgba(12, 39, 63, .88);
}

.gh-booking-title h1 {
    margin: 0;
    font-size: clamp(34px, 4vw, 58px);
    line-height: .95;
}

.gh-booking-title p {
    margin: 8px 0 0;
    color: rgba(220,240,255,.85);
}

.gh-booking-filters {
    display: grid;
    grid-template-columns: 150px 90px 120px 160px;
    gap: 10px;
    align-items: end;
}

    .gh-booking-filters .form-label {
        margin-bottom: 4px;
        font-size: 12px;
        opacity: .9;
    }

    .gh-booking-filters .form-control,
    .gh-booking-filters .form-select {
        min-height: 34px;
        height: 34px;
        padding: 5px 10px;
        font-size: 14px;
    }

.gh-booking-mini-stats {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 8px 14px;
    align-self: center;
    color: rgba(220,240,255,.86);
    font-size: 13px;
    white-space: nowrap;
}

    .gh-booking-mini-stats strong {
        color: #fff;
        font-size: 18px;
        margin-right: 4px;
    }

.gh-map-shell-fit {
    margin-top: 0;
    padding: 18px 20px;
    min-height: 0;
}

    .gh-map-shell-fit .gh-map-header {
        margin-bottom: 10px;
    }

        .gh-map-shell-fit .gh-map-header h2 {
            margin: 0;
            font-size: 28px;
        }

        .gh-map-shell-fit .gh-map-header p {
            margin: 4px 0 0;
            font-size: 13px;
        }

.gh-visual-grid-fit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 16px;
    align-items: stretch;
}

    .gh-visual-grid-fit .gh-map-viewport,
    .gh-map-shell-fit .gh-map-viewport {
        position: relative;
        display: block;
        width: 100%;
        height: clamp(430px, calc(100vh - 330px), 640px);
        min-height: 430px;
        max-height: 640px;
        overflow: hidden;
        border-radius: 20px;
        background: #0b2033;
    }

    .gh-visual-grid-fit .gh-map-canvas,
    .gh-map-shell-fit .gh-map-canvas {
        position: relative;
        display: block;
        width: 100%;
        height: 100%;
        min-height: 430px;
        aspect-ratio: auto !important;
        border-radius: 18px;
    }

    .gh-visual-grid-fit .gh-selected-card {
        align-self: stretch;
        max-height: 640px;
        overflow: auto;
    }

/* Index map preview */
.gh-start-map {
    margin-top: 18px;
}

.gh-start-map-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.gh-start-map-preview {
    margin-top: 16px;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(0,0,0,.18);
    box-shadow: 0 24px 70px rgba(0,0,0,.22);
}

    .gh-start-map-preview .gh-map-canvas {
        height: clamp(320px, 46vh, 560px);
        min-height: 320px;
        aspect-ratio: auto !important;
    }

.gh-start-map-cta {
    display: inline-flex;
    margin-top: 12px;
    padding: 10px 18px;
    border-radius: 999px;
    background: #6bdcf4;
    color: #061624;
    font-weight: 900;
}

@media (max-width: 1300px) {
    .gh-booking-topbar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .gh-booking-filters {
        grid-template-columns: repeat(4, minmax(110px, 1fr));
    }

    .gh-booking-mini-stats {
        grid-template-columns: repeat(4, auto);
    }

    .gh-visual-grid-fit .gh-map-viewport,
    .gh-map-shell-fit .gh-map-viewport {
        height: clamp(360px, calc(100vh - 360px), 560px);
        min-height: 360px;
    }

    .gh-visual-grid-fit .gh-map-canvas,
    .gh-map-shell-fit .gh-map-canvas {
        min-height: 360px;
    }
}

@media (max-width: 900px) {
    .gh-layout-grid-fixed {
        grid-template-columns: 1fr;
    }

    .gh-booking-filters {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .gh-booking-mini-stats {
        grid-template-columns: repeat(2, auto);
    }

    .gh-visual-grid-fit {
        grid-template-columns: 1fr;
    }

        .gh-visual-grid-fit .gh-map-viewport,
        .gh-map-shell-fit .gh-map-viewport {
            height: 360px;
            min-height: 360px;
            max-height: none;
        }

    .gh-start-map-preview .gh-map-canvas {
        height: 300px;
        min-height: 300px;
    }

    .gh-correct-map {
        min-width: 0;
    }
}

/* =========================================================
   v4.4.20 - Gjestehavn: lås kart og plasser til samme koordinatsystem
   Problem: object-fit: cover / tvungen høyde cropper kartbildet, og da forskyves
   båtplassene fordi plassene bruker prosent/0-1000-koordinater på hele bildet.

   Legg dette HELT nederst i wwwroot/css/guestharbor-v4_4_12.css
   ========================================================= */

/* Selve viewporten skal ikke bestemme annen høyde enn bildet.
   Den skal bare ramme inn koordinatflaten. */
.gh-map-viewport,
.gh-map-viewport-tight,
.gh-visual-grid-fit .gh-map-viewport,
.gh-map-shell-fit .gh-map-viewport {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Kart-canvas er koordinatflaten.
   Den må alltid ha samme aspect-ratio som kartbildet.
   Plassene og bildet skaleres da likt. */
.gh-map-canvas,
.gh-map-canvas-imgmode,
.gh-visual-grid-fit .gh-map-canvas,
.gh-map-shell-fit .gh-map-canvas {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: var(--gh-map-aspect) !important;
    overflow: hidden !important;
    border-radius: 18px;
    background-color: #173451 !important;
}

    /* Ikke crop kartbildet.
   Fill er riktig her fordi selve canvas allerede har korrekt ratio.
   Cover/contain vil gi avvik eller luft som ødelegger koordinatene. */
    .gh-map-canvas-imgmode .gh-map-bg-img,
    .gh-map-canvas .gh-map-bg-img {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: fill !important;
        object-position: 0 0 !important;
        display: block !important;
        z-index: 0 !important;
        pointer-events: none !important;
        user-select: none !important;
    }

    /* Plassene ligger i samme koordinatflate som bildet. */
    .gh-map-canvas .gh-map-berth,
    .gh-map-canvas-imgmode .gh-map-berth,
    .gh-map-canvas .berth-marker,
    .gh-map-canvas-imgmode .berth-marker {
        position: absolute !important;
        z-index: 5 !important;
        transform-origin: center center !important;
    }

/* Kart + valgt plass-panel: behold sidepanel, men la kartet styres av ratio. */
.gh-visual-grid-fit {
    align-items: start !important;
}

.gh-selected-card {
    height: auto !important;
    max-height: none !important;
}

/* På små skjermer: behold samme prinsipp. Ingen cropping. */
@media (max-width: 900px) {
    .gh-visual-grid-fit {
        grid-template-columns: 1fr !important;
    }

        .gh-map-canvas,
        .gh-map-canvas-imgmode,
        .gh-visual-grid-fit .gh-map-canvas,
        .gh-map-shell-fit .gh-map-canvas {
            aspect-ratio: var(--gh-map-aspect) !important;
        }
}
