/* =========================================================
   Fortifications Map Overlay - cleaned + deduped
   ========================================================= */

/* ---------- Overlay must sit ON TOP of the map ---------- */
.fort-map-host{
  position: relative !important;
  width: 100%;
}

.fort-map{
  width: 100%;
  display: block;
}

/* ---------- Overlay base (default = "glass") ---------- */
.fort-overlay{
  position: absolute !important;
  top: 14px !important;
  z-index: 9999 !important;
  width: 330px;

  max-height: calc(100% - 28px);
  display: flex;
  flex-direction: column;

  box-sizing: border-box;
  border-radius: 14px;
  overflow: hidden;

  /* glass look */
  background: rgba(20, 27, 23, .88) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  box-shadow: 0 18px 34px rgba(0,0,0,.45) !important;
  color: rgba(255,255,255,.92) !important;
}

/* Placement modifiers (PHP outputs these) */
.fort-overlay--right{ right: 50px !important; left: auto !important; }
.fort-overlay--left { left: 28px !important; right: auto !important; }

/* Structure */
.fort-overlay__header{
  flex: 0 0 auto;
  box-sizing: border-box;
  background: rgba(12, 16, 14, .55) !important;
  border-bottom: 1px solid rgba(255,255,255,.10) !important;
}

.fort-overlay__body{
  flex: 1 1 auto;
  box-sizing: border-box;
  overflow: auto;
  background: transparent !important;
}

/* Small readability */
.fort-overlay__title{
  color: rgba(255,255,255,.92) !important;
}

.fort-overlay__collapse{
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(255,255,255,.10) !important;
  border-radius: 10px;
  color: rgba(255,255,255,.92) !important;
}
.fort-overlay__collapse:hover{
  background: rgba(255,255,255,.12) !important;
}

/* ---------- Loading state ---------- */
.fort-is-loading .fort-overlay__body{
  opacity: .65;
  pointer-events: none;
}
.fort-is-loading .fort-overlay__header::after{
  content: "Indlæser…";
  margin-left: 10px;
  font-size: 12px;
  opacity: .75;
}

/* =========================================================
   Menu overlay variant
   ========================================================= */
.fort-overlay.fort-overlay--menu{
  width: 320px;
  border-radius: 6px;

  background: rgba(35,35,35,.92) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  box-shadow: 0 18px 34px rgba(0,0,0,.55) !important;
  color: rgba(255,255,255,.92) !important;
}

.fort-overlay--menu .fort-overlay__header{
  background: rgba(60,60,60,.95) !important;
  border-bottom: 1px solid rgba(255,255,255,.12) !important;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fort-overlay--menu .fort-overlay__title{
  font-weight: 700;
  letter-spacing: .2px;
}

.fort-overlay--menu .fort-overlay__collapse{
  width: 32px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.12) !important;
  background: rgba(0,0,0,.25) !important;
  color: #fff !important;
}

.fort-overlay--menu .fort-overlay__body{
  max-height: calc(100% - 44px);
  padding: 8px;
}

/* Menu blocks */
.fort-menu__section-title{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  opacity: .85;
  margin: 6px 0;
}

.fort-menu__row--allnone{
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.fort-menubtn{
  flex: 1;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
  color: #fff;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, transform .05s ease;
}
.fort-menubtn:hover{ background: rgba(255,255,255,.08); }
.fort-menubtn:active{ transform: translateY(1px); }

/* ACTIVE STATE */
.fort-menubtn.is-active{
  background: rgba(255,255,255,.16) !important;
  border-color: rgba(255,255,255,.28) !important;
  box-shadow: 0 0 0 2px rgba(255,255,255,.10) inset;
  font-weight: 700;
}

/* Accordion item (Sted) */
.fort-accitem{
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  margin-bottom: 6px;
}

.fort-accitem__head{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(70,70,70,.65);
  border: 0;
  color: #fff;
  cursor: pointer;
}

.fort-accitem__icon{ width: 16px; opacity: .9; }

.fort-accitem__title{
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fort-accitem__pick input{ transform: scale(1.05); }

.fort-accitem__body{
  display: none;
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
  font-size: 12px;
  opacity: .9;
}
.fort-accitem.is-open .fort-accitem__body{ display: block; }

/* Types list */
.fort-typecheck{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.fort-typecheck span{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Notes area */
.fort-notes{
  margin-top: 10px;
  border-top: 1px solid rgba(255,255,255,.10);
  padding-top: 10px;
}
.fort-notes__title{
  font-weight: 700;
  margin-bottom: 6px;
}
.fort-notes__body{
  font-size: 12px;
  line-height: 1.35;
  opacity: .9;
}

/* =========================================================
   Mobile / responsive: center overlay
   ========================================================= */
@media (max-width: 640px){
  .fort-overlay{
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 24px) !important;
    top: 10px !important;
    max-height: calc(100% - 20px) !important;
  }
}

/* =========================================================
   Leaflet popup: width follows longest visible row (safe cap)
   ========================================================= */
.leaflet-popup.fort-popup-shell .leaflet-popup-content-wrapper{
  width: fit-content;
  max-width: min(90vw, 560px);
}
.leaflet-popup.fort-popup-shell .leaflet-popup-content{
  width: fit-content;
  max-width: min(90vw, 560px);
}
.leaflet-popup.fort-popup-shell .fort-popup__row{
  white-space: nowrap;
}
.leaflet-popup.fort-popup-shell .fort-popup__v{
  overflow-wrap: anywhere;
}

/* =========================================================
   Popup quick edit UI
   ========================================================= */
.fort-popup__edit{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,.10);
  display: grid;
  gap: 8px;
}
.fort-popup__edit label{
  font-size: 12px;
  opacity: .85;
  display: grid;
  gap: 4px;
}
.fort-popup__edit select{
  width: 100%;
  font-size: 13px;
  padding: 6px 8px;
}
.fort-popup__edit .fort-popup__actions{
  display: flex;
  gap: 8px;
  align-items: center;
}
.fort-popup__edit button{
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
}
.fort-popup__edit .fort-popup__status{
  font-size: 12px;
  opacity: .8;
}

/* =========================================================
   Map action buttons control (UNDER layers control, top-left)
   ========================================================= */
.fort-map-actions{
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  box-shadow: 0 10px 20px rgba(0,0,0,.25);
  padding: 6px;
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.fort-map-actions__btn{
  appearance: none;
  width: 100%;
  padding: 7px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
  color: #fff;
  cursor: pointer;
  text-align: left;
}
.fort-map-actions__btn:hover{
  background: rgba(255,255,255,.08);
}

.fort-map-actions__status{
  font-size: 12px;
  opacity: .85;
  min-height: 14px;
}


/* Period/Type rows: keep on one line */
.fort-periodcheck,
.fort-typecheck{
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0; /* critical for ellipsis in flex */
}

.fort-periodcheck span,
.fort-typecheck span{
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Optional: make checkbox not shrink */
.fort-periodcheck input,
.fort-typecheck input{
  flex: 0 0 auto;
}


.fort-overlay.is-collapsed .fort-overlay__body { display:none; }
.fort-overlay.is-collapsed { width:auto; max-height:none; }
.fort-overlay.is-collapsed .fort-overlay__header { border-bottom:0; }

