/* ====== RH Lokationer ====== */

/* ---------- Kort ---------- */
.rh-map-wrap { position: relative; }
.rh-map {
    width: 100%;
    height: 800px;
    border: 1px solid #ccc;
    margin: 20px 0;
}
.rh-map-empty,
.rh-map-missing-key {
    padding: 24px;
    background: #fff3f3;
    border: 1px solid #e0b4b4;
    border-radius: 8px;
    color: #7a2e2e;
}

/* ---------- Afstandstabel ---------- */
.rh-distance-heading { margin: 16px 0 10px 0; font-weight: 400; }
.rh-distance-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0 0 16px 0;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #eceff4;
    box-shadow: 0 4px 16px rgba(2, 12, 27, 0.05);
}
.rh-distance-table th,
.rh-distance-table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid #edf0f5;
}
.rh-distance-table tr:last-child td { border-bottom: none; }
.rh-distance-table th { background-color: var(--rh-primary, #1c4378); color: #fff; }
.rh-distance-row { cursor: pointer; }
.rh-distance-row:hover td { background: #f2f6fc; }

.rh-status-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}
.rh-status-red { background-color: var(--rh-status-red, #F44336); }
.rh-status-green { background-color: var(--rh-status-green, #4CAF50); }
.rh-status-pos { background-color: var(--rh-status-pos, #2196F3); }

/* ---------- Infokort ---------- */
#rh-output-info {
    margin-top: 32px;
    clear: both;
    position: relative;
    z-index: 1;
    color: #1d2433;
}
.rh-output-placeholder {
    padding: 36px 28px;
    background: #f7f8fb;
    border: 1px dashed #d8dde6;
    border-radius: 18px;
    color: #6b7488;
    text-align: center;
}
.rh-location-card {
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eceff4;
    box-shadow: 0 8px 30px rgba(2, 12, 27, 0.07);
}

/* Billedkolonnen */
.rh-card-media {
    background: var(--rh-panel-bg, #223355);
    background: linear-gradient(165deg, var(--rh-panel-bg, #223355), color-mix(in srgb, var(--rh-panel-bg, #223355) 72%, #000));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 22px 20px;
    box-sizing: border-box;
}
.rh-media-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    transition: transform 0.25s ease;
}
.rh-media-img:hover { transform: scale(1.02); }
.rh-media-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    border: 1.5px dashed rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.92em;
    box-sizing: border-box;
}
.rh-media-caption {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.82em;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 6px;
}
.rh-media-caption .rh-empty { color: rgba(255, 255, 255, 0.45); }

/* Indholdskolonnen */
.rh-card-body {
    flex: 1 1 auto;
    padding: 24px 24px 26px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-sizing: border-box;
}
.rh-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}
.rh-card-title {
    font-size: 1.45em;
    font-weight: 800;
    letter-spacing: -0.015em;
    line-height: 1.15;
    color: var(--rh-accent, #204080);
    margin: 0 0 6px 0;
}
.rh-card-address {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6b7488;
    font-size: 0.95em;
}
.rh-card-address svg { width: 15px; height: 15px; flex: none; }

/* Status-badge */
.rh-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 700;
    white-space: nowrap;
}
.rh-badge .rh-status-dot { width: 9px; height: 9px; margin: 0; }
.rh-badge-red {
    color: var(--rh-status-red, #F44336);
    background: #fdecea;
    background: color-mix(in srgb, var(--rh-status-red, #F44336) 12%, #fff);
}
.rh-badge-green {
    color: var(--rh-status-green, #4CAF50);
    background: #eaf6eb;
    background: color-mix(in srgb, var(--rh-status-green, #4CAF50) 14%, #fff);
}

/* Nøgletal */
.rh-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}
.rh-stat {
    background: #f7f8fb;
    border-radius: 12px;
    padding: 12px 14px;
}
.rh-stat-label {
    display: block;
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a93a6;
    margin-bottom: 4px;
}
.rh-stat-value {
    font-size: 1em;
    font-weight: 600;
    color: #1d2433;
    overflow-wrap: anywhere;
}

/* Lange tekstfelter */
.rh-rich-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}
.rh-rich {
    background: #f7f8fb;
    border-radius: 12px;
    padding: 13px 15px;
}
.rh-rich-value { font-size: 0.95em; line-height: 1.55; }
.rh-rich-value p { margin: 0 0 6px 0; }
.rh-rich-value p:last-child { margin-bottom: 0; }

.rh-empty { color: #b6bdc9; font-style: italic; font-weight: 400; }

/* Ekstra billeder */
.rh-extra-images {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px;
}
.rh-extra-thumb {
    width: 86px;
    height: 86px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid #e4e8ef;
    border-radius: 12px;
    background: #f6f8fc;
    flex: 0 0 auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.rh-extra-thumb:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(2, 12, 27, 0.12);
}

/* Knapper */
.rh-card-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 2px;
}
.rh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--rh-primary, #1c4378);
    color: #fff !important;
    border: none;
    border-radius: 12px;
    padding: 11px 20px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    line-height: 1.2;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.rh-btn:hover {
    background: var(--rh-primary-hover, #2a5aa0);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(2, 12, 27, 0.18);
}
.rh-btn svg { width: 16px; height: 16px; flex: none; }
.rh-btn-secondary {
    background: transparent;
    color: var(--rh-secondary, #66718a) !important;
    border: 1.5px solid #d6dbe4;
    padding: 9.5px 18.5px;
}
.rh-btn-secondary:hover {
    background: #f7f8fb;
    color: var(--rh-secondary, #66718a) !important;
    border-color: currentColor;
    box-shadow: none;
}

.rh-user-card { justify-content: center; align-items: center; min-height: 220px; }
.rh-user-card-inner {
    font-size: 1.6em;
    color: var(--rh-accent, #204080);
    font-weight: 700;
    margin: auto;
    text-align: center;
    padding: 30px;
}

/* ---------- Ruteplanlægger ---------- */
#rh-routes-canvas {
    width: 100%;
    min-height: 60px;
    margin: 20px 0;
}
.rh-routes-map {
    width: 100%;
    height: 500px;
    border: 1px solid #ccc;
}
.rh-routes-send { margin: 0 0 14px 0; background: var(--rh-route-btn, #1e87f0); }
.rh-routes-send:hover { background: var(--rh-route-btn, #1e87f0); filter: brightness(1.12); }
.rh-routes-send:disabled { opacity: 0.6; cursor: wait; }
.rh-routes-summary {
    color: #000;
    background: #fff;
    padding: 8px 12px;
    margin: 10px;
    border-radius: 7px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.13);
    display: inline-block;
}
.rh-routes-summary span { color: var(--rh-primary, #1c4378); }

/* ---------- QR-modal ---------- */
#rh-qr-modal {
    display: none;
    position: fixed;
    z-index: 99990;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.53);
}
#rh-qr-modal-inner {
    background: #fff;
    max-width: 340px;
    margin: 8vh auto;
    padding: 32px 24px 24px 24px;
    border-radius: 15px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    text-align: center;
}
#rh-qr-modal-heading { margin: 10px 0 18px 0; font-size: 18px; color: #000; }
#rh-qr-code { display: flex; justify-content: center; margin-bottom: 12px; }
#rh-qr-link a {
    color: var(--rh-primary, #1c4378);
    font-weight: 500;
    text-decoration: underline;
    display: block;
    margin-top: 10px;
}
#rh-qr-modal-close {
    position: absolute;
    right: 10px;
    top: 10px;
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: var(--rh-primary, #1c4378);
    cursor: pointer;
}

/* ---------- Frontend-redigering ---------- */
#rh-edit-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(20, 40, 80, 0.28);
    z-index: 99980;
    touch-action: none;
}
#rh-edit-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 14px;
    min-width: 420px;
    max-width: 96vw;
    max-height: 94vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(28, 44, 76, 0.27);
    z-index: 99985;
    padding: 32px 28px 28px 28px;
    color: #223355;
}
.rh-edit-title { margin: 0 0 14px 0; color: var(--rh-accent, #204080); }
.rh-edit-wrap { display: flex; gap: 32px; }
.rh-edit-col-left {
    flex: 0 0 200px;
    min-width: 170px;
    text-align: center;
    padding-top: 10px;
}
.rh-edit-img {
    width: 170px;
    height: 130px;
    object-fit: cover;
    border-radius: 10px;
    background: #f7f7fc;
    margin: 0 auto 6px auto;
    display: block;
}
.rh-edit-img-empty { background: #eef0fa; }
.rh-edit-img-block { margin-bottom: 14px; }
.rh-edit-col-right { flex: 1 1 auto; min-width: 0; }
#rh-edit-modal label {
    font-weight: 500;
    margin: 13px 0 3px 0;
    display: block;
    color: #223355;
}
#rh-edit-modal .rh-radio { display: inline-block; margin-right: 18px; font-weight: 400; }
#rh-edit-modal input[type="text"],
#rh-edit-modal input[type="number"],
#rh-edit-modal textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ccd;
    border-radius: 5px;
    margin-bottom: 8px;
    font-size: 1em;
    background: #f8f8fd;
    color: #223355;
    box-sizing: border-box;
}
#rh-edit-modal input[type="file"] {
    display: block;
    margin: 0 auto 10px auto;
    max-width: 100%;
}
.rh-edit-submit {
    margin-top: 18px;
    background: var(--rh-primary, #1c4378);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 28px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
}
#rh-edit-close {
    position: absolute;
    right: 12px;
    top: 12px;
    font-size: 2em;
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    z-index: 2;
}

/* ---------- Lightbox ---------- */
.rh-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
}
.rh-lightbox.active { display: flex; }
.rh-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.rh-lightbox-img { max-width: 100%; max-height: 90vh; object-fit: contain; }
.rh-lightbox-close {
    position: fixed;
    top: 10px;
    right: 18px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100001;
    opacity: 0.8;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}
.rh-lightbox-close:hover { opacity: 1; }
.rh-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    z-index: 100001;
    padding: 20px 10px;
    opacity: 0.8;
    user-select: none;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.3);
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.rh-lightbox-nav:hover { opacity: 1; background: rgba(0, 0, 0, 0.5); }
.rh-lightbox-prev { left: 0; border-radius: 0 5px 5px 0; }
.rh-lightbox-next { right: 0; border-radius: 5px 0 0 5px; }
.rh-lightbox-caption {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    text-align: center;
    padding: 8px 15px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    max-width: 80%;
    z-index: 100001;
}

/* ---------- Desktop ---------- */
@media (min-width: 901px) {
    .rh-location-card { flex-direction: row; min-height: 380px; }
    .rh-card-media {
        flex: 0 0 280px;
        max-width: 280px;
        padding: 26px 22px;
    }
    .rh-card-body { padding: 30px 34px; }
    .rh-card-title { font-size: 1.7em; }
    .rh-extra-thumb { width: 104px; height: 104px; }
}

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
    .rh-map { height: 480px; }
}

@media (max-width: 600px) {
    .rh-card-media { padding: 16px 14px; }
    .rh-card-body { padding: 20px 16px; }

    #rh-edit-modal {
        top: 0;
        left: 0;
        transform: none;
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: 100dvh;
        border-radius: 0;
        padding: 7vw 3vw 90px 3vw;
        box-sizing: border-box;
        min-width: 0;
    }
    .rh-edit-wrap { flex-direction: column; gap: 0; }
    .rh-edit-col-left { flex: none; min-width: 0; padding: 0 0 24px 0; }
    .rh-edit-img { width: 90vw; max-width: 320px; height: auto; }
    .rh-edit-col-right { padding-bottom: 90px; }
    .rh-edit-submit {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        border-radius: 0;
        margin: 0;
        z-index: 99990;
        box-shadow: 0 -1px 6px rgba(34, 51, 85, 0.2);
        padding: 18px 0;
        font-size: 1.2em;
    }
    #rh-edit-close { right: 10px; top: 6px; font-size: 2.5em; }
}
