/* ===========================================
   GALLERY.CSS — unified root + gallery design
=========================================== */

/* BASE */
body {
    background: #fff8e6 !important;
    font-family: "Segoe UI", Roboto, sans-serif;
    margin: 0;
}

/* VARIABLES */
:root {
    --frame-bg: #fff8e6;
    --frame-border: #d4a017;
    --tile-gap: 1.2rem;
    --theme-primary: #003366;
    --theme-secondary: #d4a017;
}

/* MAIN WRAPPER */
.gallery-main {
    max-width: 1100px;
    margin: 0.7rem auto;
}

/* ============================================================
   UNIVERSAL SECTION FRAME
============================================================ */
.gallery-frame,
.subgallery-section,
.photo-section,
.gallery-section {
    background: var(--frame-bg);
    border: 3px solid var(--frame-border);
    border-radius: 14px;
    padding: 1.4rem 1.2rem;
    margin: 1rem auto;
    max-width: 1100px;
    box-sizing: border-box;
}

/* GALLERY NAME HEADER */
.gallery-header {
    background: var(--frame-bg);
    border: 3px solid var(--frame-border);
    border-radius: 14px;
    padding: 0.5rem 1.0rem;
    text-align: center;
    position: relative;
}

/* Mindre afstand over/under galleriets header-ramme */
.gallery-header.gallery-frame {
    margin: 0.3rem auto;
}

/* VIGTIGT: slå sticky SEARCH-header fra (breadcrumb er sticky) */
.gallery-header.search-header {
    position: static !important;
    top: auto !important;
}

/* Gallerinavn – blå, "comic" og italic */
.gallery-title {
    color: #003366;
    font-family: var(--theme-heading-font) !important;
    font-weight: var(--theme-heading-weight) !important;
    font-style: var(--theme-heading-style) !important;
}


/* Selve H1-overskriften */
.gallery-header h1 {
    margin: 0 0 0.2rem 0;
    line-height: 1.15;
    font-family: var(--theme-heading-font) !important;
    font-weight: var(--theme-heading-weight) !important;
    font-style: var(--theme-heading-style) !important;
}

/* Beskrivelse lige under titel */
.gallery-description {
    margin-top: -1.0rem;
    margin-bottom: -0.7rem;
    line-height: 1.25;
    font-size: 0.95rem;
}

/* Admin-edit ikon i galleri-header */
.gal-admin-edit {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    text-decoration: none;
    background: #eee;
    border: 2px solid #005fa3;
    color: #005fa3;
    box-shadow: 0 4px 12px rgba(0,0,0,.10);
    z-index: 20;
}

.gal-admin-edit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,.14);
}

.gal-admin-edit i {
    font-size: 16px;
    line-height: 1;
}

/* UNDERGALLERIER / GALLERIER – 5 i bredden på desktop */
.subgallery-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--tile-gap);
}

/* Responsiv nedskalering */
@media (max-width: 1200px) {
    .subgallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    .subgallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

@media (max-width: 520px) {
    .subgallery-grid {
        grid-template-columns: 1fr;
    }
}

/* Undergallerier – titel og tekst mere kompakt */
.subgallery-section .tile-info h3 {
    margin: 0 0 0.15rem 0;
    line-height: 1.15;
}

.subgallery-section .tile-info p {
    margin: 0.1rem 0;
    line-height: 1.2;
    font-size: 0.9rem;
}

/* FOTO-GRID – 5 billeder i bredden på desktop */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--tile-gap);
}

/* Responsiv nedskalering */
@media (max-width: 1200px) {
    .photo-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    .photo-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

@media (max-width: 520px) {
    .photo-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   UNIVERSAL TILE (yellow)
============================================================ */
.tile-match {
    background: #fff8e6;
    border: 3px solid var(--frame-border);
    border-radius: 12px;
    text-decoration: none;
    color: #000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: .15s ease;
}

.tile-match:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0,0,0,.15);
}

/* ============================================================
   PHOTO TILES (blue frame)
============================================================ */
.photo-card {
    background: #fff8e6 !important;
    border: 3px solid #003366 !important;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

/* THUMBNAILS */
.tile-thumb {
    height: 190px;
    background: #fff2cc;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
}

/* Undergalleri-thumbs (som før) */
.tile-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Foto-thumbs i galleriet – alle samme højde */
.tile-img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    display: block;
}

/* Lås billed-rammen (samme ratio som 450x337) */
.tile-thumb,
.search-thumb {
    aspect-ratio: 450 / 337;
}

/* Browseren kan springe off-screen rendering over (hurtigere ved mange billeder) */
.photo-card,
.search-card,
.subgallery-tile {
    content-visibility: auto;
    contain-intrinsic-size: 480px 520px;
}

/* INFO BOX */
.tile-info,
.info-box {
    background: #fff8e6;
    text-align: center;
    padding: .8rem .6rem 1rem;
}

.tile-info h3 {
    margin: 0 0 .2rem;
    font-size: 1.1rem;
    color: #003366;
    font-weight: 700;
}

/* INFO LINES (date, gps, photographer) */
.info-line {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .3rem;
    color: #003366;
    margin: .18rem 0;
}

/* Kompakt tekst under fotos – samme størrelse som i Søgeresultater */
.photo-section .info-box {
    font-size: .80rem;
    line-height: 1.25;
}

.photo-section .info-box .info-line {
    margin: .12rem 0;
}

.photo-section .info-box span {
    font-size: .80rem;
}

/* GPS BUTTON */
.gps-button {
    cursor: pointer;
}

/* SELECTION OVERLAY */
.select-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: .2s;
    pointer-events: none;
}

.photo-card.selected .select-overlay {
    opacity: 1;
}

.select-check {
    font-size: 3rem;
    color: #a8ff9e;
    text-shadow: 0 0 8px #000;
}

/* MAP POPUP */
.map-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

.map-box {
    background: #fffdf5;
    border: 3px solid var(--frame-border);
    border-radius: 10px;
    width: 50%;
    height: 50%;
    position: relative;
    animation: scaleIn .25s ease;
}

.map-close {
    position: absolute;
    right: 12px;
    top: 8px;
    color: #003366;
    background: rgba(255,255,255,.85);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 22px;
    cursor: pointer;
    z-index: 10;
}

.map-inner {
    width: 100%;
    height: 100%;
    border-top: 3px solid var(--frame-border);
    border-bottom: 3px solid var(--frame-border);
}

@keyframes scaleIn {
    from {
        transform: scale(.6);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* TOPBAR */
.topbar-wrapper {
    display: flex;
    justify-content: center;
    background: #fff8e6;
}

.topbar {
    background: #003366;
    color: #fff;
    border: 3px solid #d4a017;
    border-radius: 12px;
    width: calc(100% - 4rem);
    max-width: 1100px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.logo {
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    text-decoration: none;
}

.btn {
    background: #005fa3;
    border: none;
    border-radius: 6px;
    color: white;
    padding: .4rem .9rem;
    cursor: pointer;
}

.btn.red {
    background: #b32626;
}

.btn.gray {
    background: #666;
}

.btn.yellow {
    background: #d4a017;
    color: #000;
}

/* upload btn disabled */
#uploadBtn.is-disabled {
    opacity: .55;
    cursor: not-allowed;
}

#uploadBtn.is-disabled:hover {
    transform: none;
}

/* Center tekst i sorterings-dropdown */
#sort-select.sort-select,
.sort-select {
    text-align: center;
    text-align-last: center;
    line-height: 30px;
}

.sort-select option {
    text-align: center;
}

/* ======================================================
   UPLOAD – DELUXE STYLING V2
====================================================== */

.gallery-frame {
    position: relative;
    z-index: 1;
}

.upload-dropzone {
    border: 4px dashed #d4a017;
    background: #fffdf5;
    border-radius: 18px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all .25s ease;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

.upload-dropzone:hover {
    background: #fff6d6;
    border-color: #c08c00;
    box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

.upload-dropzone.dragover {
    background: #ffefb3;
    border-color: #8a6500;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 0.7rem;
    opacity: .85;
}

.upload-title {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: .5px;
    color: #003366;
    margin: 0;
}

.upload-sub {
    font-size: 1.05rem;
    margin-top: .4rem;
    color: #555;
}

#fileInput {
    display: none;
}

/* PREVIEW GRID */
.upload-preview-grid {
    margin-top: 3rem;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    display: grid;
    gap: 1.4rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    position: relative;
    z-index: 2;
    max-height: 280px;
    overflow-y: auto;
}

.preview-item {
    background: white;
    border: 3px solid #d4a017;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,.15);
    animation: fadein 0.4s ease;
}

.preview-item img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

/* BUTTON SECTION */
.upload-buttons {
    margin-top: 3rem;
    text-align: center;
    position: relative;
    z-index: 5;
}

.upload-buttons .btn {
    font-size: 1.2rem;
    padding: .7rem 2.2rem;
    border-radius: 10px;
    margin: 0 .5rem;
}

@keyframes fadein {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   SEARCH POPUP (modal)
========================================================= */

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.search-modal.hidden {
    display: none;
}

.search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

.search-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    padding: 1.2rem 1.6rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}

/* header i popup (scope: kun search modal) */
.search-box .search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .8rem;
}

.search-box .search-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #003366;
}

.search-close-btn {
    border: none;
    background: transparent;
    font-size: 1.4rem;
    cursor: pointer;
}

.search-row {
    display: flex;
    gap: .6rem;
}

.search-row > div {
    flex: 1;
}

.search-box label {
    font-weight: 600;
    font-size: .9rem;
    display: block;
    margin-top: .5rem;
}

.search-box input[type="text"],
.search-box input[type="date"],
.search-box select {
    width: 100%;
    padding: .35rem .5rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: .9rem;
    box-sizing: border-box;
}

.search-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

/* 2-kolonne layout til avanceret søgning */
.search-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem 1rem;
    margin-top: 0.6rem;
}

.search-grid-2col label {
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
    margin-top: 0.35rem;
}

.search-grid-2col input[type="text"] {
    width: 100%;
    padding: .35rem .5rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: .9rem;
    box-sizing: border-box;
}

/* Match for keywords-boks */
.kw-box {
    margin-top: 0.6rem;
    padding: 0.45rem 0.7rem 0.55rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #f7f7f7;
}

.kw-box legend {
    padding: 0 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #003366;
}

.kw-radio {
    display: block;
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.kw-radio input {
    margin-right: 4px;
}

/* Stack kolonner på små skærme */
@media (max-width: 600px) {
    .search-grid-2col {
        grid-template-columns: 1fr;
    }
}

/* =======================================
   SØGERESULTATER
======================================= */

.search-main {
    max-width: 1100px;
    margin: 0 auto 2rem;
}

/* Header i søgeresultater – centreret og pæn */
.search-main .search-header,
.search-main .gallery-header.search-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding-top: .55rem;
    padding-bottom: .55rem;
}

/* Titel */
.search-main .gallery-header.search-header h1 {
    margin: 0 !important;
    line-height: 1.00 !important;
}

/* Linjen "18 billeder fundet" */
.search-main .gallery-header.search-header p {
    margin: 0 0 0 0 !important;
    line-height: 1.00 !important;
}

/* "Galleri: …" knappen tættere på teksten */
.search-main .gallery-header.search-header .search-filters {
    margin-top: 0rem !important;
}

.search-filters {
    margin-top: .3rem;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

/* "chips" centreret */
.search-main .search-filters {
    justify-content: center;
}

.search-chip {
    background: #005fa3;
    color: #fff;
    border-radius: 999px;
    padding: .15rem .6rem;
    font-size: .8rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 5 billeder i bredden på desktop */
.search-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

@media (max-width: 1000px) {
    .search-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 800px) {
    .search-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .search-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.search-card {
    background: #fff;
    border: 2px solid #d4a017;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
    transition: transform .15s ease, box-shadow .15s ease;
    position: relative;
}

.search-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,.12);
}

.search-thumb img,
.search-thumb-missing {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #eee;
}

/* ekstra lille klasse til grå felt uden billede */
.search-thumb-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    color: #666;
}

/* Flisetekst under thumbs – centreret (som før) */
.search-card .photo-info {
    text-align: center;
    font-size: .80rem;
    padding: 6px 8px 8px;
    line-height: 1.25;
}

/* mappenavn-linje */
.gallery-line {
    font-size: .8rem;
    margin-bottom: .2rem;
}

.gallery-line i {
    margin-right: .3rem;
}

.gallery-line a {
    color: #003366;
    font-weight: 600;
    text-decoration: none;
}

.gallery-line a:hover {
    text-decoration: underline;
}

/* Mappelinke-linje */
.search-card .photo-info .gallery-line {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    margin-bottom: 2px;
}

.search-card .photo-info .gallery-line i {
    margin: 0;
}

.search-card .photo-info .gallery-line a {
    color: #003366;
    font-weight: 600;
    text-decoration: none;
}

.search-card .photo-info .gallery-line a:hover {
    text-decoration: underline;
}

/* Titel/caption */
.search-card .photo-info .pi-title {
    font-weight: 700;
    color: #003366;
    margin-top: 2px;
}

.search-card .photo-info .pi-caption {
    font-size: .75rem;
    margin-top: 2px;
    color: #003366;
}

/* Linjer med ikoner (dato, fotograf osv.) */
.search-card .photo-info .pi-line {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    color: #003366;
}

/* Kort-link */
.search-card .photo-info .map-link {
    margin-top: 4px;
}

.search-card .photo-info .map-link a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #c00;
    font-weight: 600;
    text-decoration: none;
    font-size: .85rem;
}

.search-card .photo-info .map-link a:hover {
    text-decoration: underline;
}

/* Hvis din søg-flise bruger .info-box (nogle steder) – centrer den også */
.search-card .info-box {
    text-align: center;
}

/* =========================================================
   SEARCH CARDS: edit-knap (ikon)
========================================================= */

.photo-edit-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,.65);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
}

.photo-edit-btn:hover {
    background: rgba(0,0,0,.85);
}

.photo-edit-btn i {
    font-size: .9rem;
}

/* =========================================================
   EDIT POPUPS (SINGLE + BULK) – BRED OG SCROLLBAR
========================================================= */

/* overlay + blur */
.edit-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 120000;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
}

.edit-overlay.visible {
    display: flex;
}

/* modal - BREDERE */
.edit-modal {
    width: min(1100px, 96vw);  /* ✅ bredere: 1100px i stedet for 900px */
    max-height: 90vh;          /* ✅ max højde */
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, #fffefb, #fff8e6);
    border: 2px solid rgba(255,235,184,.95);
    box-shadow: 0 26px 70px rgba(0,0,0,.38);
    display: flex;
    flex-direction: column;    /* ✅ flex så body kan scrolle */
}

/* header */
.edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(to bottom, rgba(255,255,255,.22), rgba(255,255,255,0)), var(--theme-primary);
    border-bottom: 2px solid var(--theme-secondary);
    border-radius: 18px 18px 0 0;  /* ✅ kun top-hjørner */
    flex-shrink: 0;                 /* ✅ header skal ikke krympe */
}

/* header titel */
.edit-header h2 {
    margin: 0;
    color: #fff !important;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: .2px;
}

/* close button */
.edit-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255,255,255,.18);
    color: #fff !important;
    font-size: 22px;
    line-height: 1;
}

.edit-close:hover {
    background: rgba(255,255,255,.28);
}

/* single edit body (med preview til venstre) - SCROLLBAR */
.edit-body {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    overflow-y: auto;           /* ✅ scroll hvis nødvendigt */
    max-height: calc(90vh - 140px);  /* ✅ plads til header + actions */
    padding: 16px 18px;
}

.edit-left {
    flex-shrink: 0;             /* ✅ preview skal ikke krympe */
}

.edit-left img {
    max-width: 360px;           /* ✅ større preview */
    max-height: 360px;
    border-radius: 12px;
    border: 3px solid #003366;
    background: #000;
    object-fit: contain;
}

/* form (bruges både single + bulk) */
.edit-form {
    flex: 1;
    min-width: 0;               /* ✅ tillad flex shrink */
}

/* intro tekst */
.edit-form p {
    margin: 0 0 14px 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0,0,0,.04);
    border: 1px solid rgba(0,0,0,.08);
    color: #243547;
    font-size: .95rem;
    line-height: 1.25;
}

/* DEFAULT row: 2 kolonner - BREDERE */
.edit-row {
    display: grid;
    grid-template-columns: 160px 1fr;  /* ✅ bredere label: 160px */
    gap: 16px;                          /* ✅ større gap */
    align-items: center;
    padding: 10px 0;
}

.edit-row > label:first-child {
    font-weight: 800;
    color: var(--theme-primary);
}

/* input + textarea + select */
.edit-row input[type="text"],
.edit-row input[type="datetime-local"],
.edit-row textarea,
.edit-row select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.18);
    background: #fff;
    padding: .55rem .7rem;
    font-size: .95rem;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.edit-row textarea {
    resize: vertical;
    min-height: 56px;
}

/* focus state */
.edit-row input[type="text"]:focus,
.edit-row input[type="datetime-local"]:focus,
.edit-row textarea:focus,
.edit-row select:focus {
    border-color: var(--theme-secondary);
    box-shadow: 0 0 0 4px rgba(212,160,23,.22);
    transform: translateY(-1px);
}

/* actions nederst */
.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid rgba(0,0,0,.10);
    flex-shrink: 0;             /* ✅ actions skal ikke krympe */
    background: #fff8e6;
}

/* knapper i popup (Gem/Luk) */
.edit-actions .btn {
    min-height: 38px;
    padding: .45rem 1.2rem;
    border-radius: 12px;
    font-weight: 800;
}

/* responsive */
@media (max-width: 1024px) {
    .edit-modal {
        width: min(860px, 96vw);
    }
    .edit-left img {
        max-width: 280px;
        max-height: 280px;
    }
}

@media (max-width: 760px) {
    .edit-body {
        flex-direction: column;
    }
    .edit-left img {
        max-width: 100%;
        max-height: 280px;
    }
}

@media (max-width: 650px) {
    .edit-row {
        grid-template-columns: 1fr;
        align-items: start;
    }
    .edit-row > label:first-child {
        margin-bottom: 4px;
    }
}

/* =========================================================
   BULK EDIT – BREDERE OG SCROLLBAR
========================================================= */

#bulk-edit-overlay.edit-overlay {
    backdrop-filter: blur(2px);
}

/* Modal - BREDERE */
#bulk-edit-overlay .edit-modal {
    width: min(1100px, 96vw);  /* ✅ bredere */
    max-height: 90vh;
    border-radius: 18px;
    overflow: hidden;
    border: 2px solid var(--theme-secondary);
    background: #fffdf6;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
    display: flex;
    flex-direction: column;
}

/* Header */
#bulk-edit-overlay .edit-header {
    padding: 12px 16px;
    background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.10)), var(--theme-primary);
    border-bottom: 1px solid rgba(255,255,255,.18);
    border-radius: 18px 18px 0 0;
    overflow: hidden;
    flex-shrink: 0;
}

#bulk-edit-overlay .edit-header h2 {
    margin: 0;
    color: #fff !important;
    font-weight: 800;
    font-size: 1.10rem;
    letter-spacing: .2px;
    text-shadow: 0 1px 1px rgba(0,0,0,.35);
}

#bulk-edit-overlay .edit-close {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.25);
    background: rgba(255,255,255,.14);
    color: #fff !important;
    font-size: 22px;
    line-height: 1;
}

#bulk-edit-overlay .edit-close:hover {
    background: rgba(255,255,255,.24);
}

/* Body - SCROLLBAR */
#bulk-edit-overlay .edit-form {
    padding: 14px 16px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

#bulk-edit-overlay .edit-form p {
    margin: 0 0 14px 0;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,.08);
    background: rgba(0,0,0,.03);
    font-size: .92rem;
}

/* BULK ROWS: FLEX - BREDERE */
#bulk-edit-overlay .edit-row {
    display: flex !important;
    align-items: center;
    gap: 16px;                  /* ✅ større gap */
    padding: 10px 0;
}

/* Label (bredere) */
#bulk-edit-overlay .edit-row > label:first-child {
    flex: 0 0 160px;            /* ✅ bredere label */
    font-weight: 800;
    color: var(--theme-primary);
}

/* checkbox */
#bulk-edit-overlay .edit-row input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px !important;
    height: 18px !important;
    margin: 0 2px 0 0 !important;
    accent-color: var(--theme-primary);
}

/* "Ryd / Ryd alle" chip */
.clear-chip,
#bulk-edit-overlay .edit-row label[for^="clear-"],
#bulk-edit-overlay .edit-row label[for^="clear_"],
#bulk-edit-overlay .edit-row a {
    flex: 0 0 auto;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: .80rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    color: var(--theme-primary);
    background: rgba(0,51,102,.08);
    border: 1px solid rgba(0,51,102,.16);
    user-select: none;
}

.clear-chip:hover,
#bulk-edit-overlay .edit-row a:hover {
    background: rgba(0,51,102,.14);
}

/* INPUT - mere plads */
#bulk-edit-overlay .edit-row input[type="text"],
#bulk-edit-overlay .edit-row input[type="datetime-local"],
#bulk-edit-overlay .edit-row textarea,
#bulk-edit-overlay .edit-row select {
    flex: 1 1 auto;
    min-width: 500px;           /* ✅ større min-width */
    width: auto !important;
    box-sizing: border-box;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,.18);
    background: #fff;
    padding: .52rem .68rem;
    font-size: .95rem;
}

#bulk-edit-overlay .edit-row textarea {
    min-height: 44px;
    resize: vertical;
}

/* fokus */
#bulk-edit-overlay .edit-row input:focus,
#bulk-edit-overlay .edit-row textarea:focus,
#bulk-edit-overlay .edit-row select:focus {
    outline: none;
    border-color: var(--theme-secondary);
    box-shadow: 0 0 0 4px rgba(212,160,23,.18);
}

/* Actions */
#bulk-edit-overlay .edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(0,0,0,.03);
    border-top: 1px solid rgba(0,0,0,.10);
    flex-shrink: 0;
}

#bulk-edit-overlay .edit-actions .btn {
    min-height: 40px;
    padding: .55rem 1.25rem;
    border-radius: 14px;
    font-weight: 800;
}

/* Mobil */
@media (max-width: 1024px) {
    #bulk-edit-overlay .edit-modal {
        width: min(860px, 96vw);
    }
    #bulk-edit-overlay .edit-row input[type="text"],
    #bulk-edit-overlay .edit-row input[type="datetime-local"],
    #bulk-edit-overlay .edit-row textarea,
    #bulk-edit-overlay .edit-row select {
        min-width: 400px;
    }
}

@media (max-width: 760px) {
    #bulk-edit-overlay .edit-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    #bulk-edit-overlay .edit-row > label:first-child {
        flex: 0 0 100%;
    }

    #bulk-edit-overlay .edit-row input[type="text"],
    #bulk-edit-overlay .edit-row input[type="datetime-local"],
    #bulk-edit-overlay .edit-row textarea,
    #bulk-edit-overlay .edit-row select {
        min-width: 0;
        flex: 1 1 100%;
    }
}

/* ===========================
   MOBILE / TABLET – TOPBAR
=========================== */

@media (max-width: 900px) {
    .topbar {
        height: auto;
        flex-wrap: wrap;
        gap: .5rem;
        padding: .6rem .75rem;
        position: sticky;
        top: 0;
        z-index: 9999;
    }

    .topbar .left,
    .topbar .right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    #top-tools,
    #user-block,
    .topbar #sort-wrapper {
        flex-wrap: wrap;
        justify-content: center;
    }

    .topbar .logo,
    .topbar .btn,
    .topbar .sort-select {
        height: 34px;
        padding: 0 .75rem;
        font-size: .78rem;
    }

    .topbar #sort-wrapper {
        padding: 0 !important;
        background: transparent !important;
        border-radius: 0 !important;
    }

    /* Mobil-fix: topmenu skal ALTID være synlig */
    .topmenu,
    .topbar,
    .top-nav,
    .top-actions,
    .gallery-topbar,
    .header-actions {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .topmenu *,
    .topbar *,
    .top-nav *,
    .top-actions *,
    .gallery-topbar *,
    .header-actions * {
        visibility: visible !important;
        opacity: 1 !important;
    }

    .topmenu,
    .gallery-topbar {
        position: sticky;
        top: 0;
        z-index: 9999;
        flex-wrap: wrap;
        gap: 8px;
    }

    .topbar input[type="search"],
    .topbar input[type="text"],
    .topbar select {
        min-width: 160px;
        flex: 1 1 160px;
    }

    .topbar a,
    .topbar button {
        flex: 0 0 auto;
    }
}

@media (max-width: 520px) {
    .topbar {
        width: calc(100% - 1rem);
    }

    .selectionCounter {
        font-size: .75rem;
        padding: .25rem .5rem;
    }
}

/* ===========================
   MOBILE – SØGEPOPUP (scroll)
=========================== */

#search-overlay,
.search-overlay,
#searchModal,
.searchModal {
    position: fixed;
    inset: 0;
    z-index: 9000;
}

#search-overlay .overlay-box,
.search-overlay .overlay-box,
#searchModal .overlay-box,
.searchModal .overlay-box,
#search-overlay .search-box,
.search-overlay .search-box,
.search-modal {
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
    #search-overlay .overlay-box,
    .search-overlay .overlay-box,
    #search-overlay .search-box,
    .search-overlay .search-box,
    .search-modal {
        width: min(560px, 96vw);
        padding: 14px 14px;
    }
}

/* Rotate hint */
.rotate-hint {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    z-index: 9500;
}

.rotate-hint.hidden {
    display: none !important;
}

.rotate-hint-box {
    max-width: 320px;
    background: rgba(0,0,0,0.4);
    border-radius: 16px;
    padding: 1.4rem 1.6rem;
    border: 1px solid rgba(255,255,255,0.6);
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    color: #fff;
}

.rotate-hint-icon {
    font-size: 2.8rem;
    margin-bottom: .8rem;
}

.rotate-hint-text {
    font-size: .95rem;
    margin-bottom: 1rem;
}
