/*  Reset & basis  */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: #0f1115;
  color: #eaeaea;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  height: 100dvh;
  overflow: hidden;
}

/*  Hoofd layout: kaart | sidebar  */
.appLayout {
  display: flex;
  height: 100dvh;
}

/*  Desktop: sidebar links via order  */
.sidebar {
  order: -1;
  width: 360px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  background: #0f1115;
  border-right: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebarHeader {
  padding: 14px;
  background: #13161e;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebarHeader h1 {
  margin: 0 0 10px 0;
  font-size: 17px;
}

/*  Zoekbalk  */
.searchRow {
  display: flex;
  gap: 6px;
}

.searchRow input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  background: #1e2230;
  color: #eaeaea;
  outline: none;
  min-width: 0;
}

.searchRow input::placeholder { color: #6b7280; }

.btnSearch, .btnLocate {
  padding: 9px 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  background: #2a3045;
  color: white;
  flex-shrink: 0;
}

.btnSearch:hover, .btnLocate:hover { background: #3a4260; }

/*  Filter knoppen  */
.filterRow {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.filterBtn {
  background: #1e2230;
  border: 1px solid #2a2f42;
  color: #ccc;
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
}

.filterBtn.active {
  outline: 2px solid #4da3ff;
  color: white;
}

.filterBtn:hover { background: #2a3045; }

/*  Machine lijst  */
.machineList {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}

.machineItem {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}

.machineItem:hover { background: rgba(255,255,255,.05); }

.machineHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

/*  Status indicator  */
.statusRow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 3px;
}

.statusDot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.green  { background: #4caf50; }
.yellow { background: #ff9800; }
.red    { background: #f44336; }
.gray   { background: #9aa0a6; }

.updatedAt {
  opacity: .5;
  font-size: 12px;
}

.distance {
  font-size: 12px;
  opacity: .55;
  margin-bottom: 8px;
}

/*  Navigatie + probleem op één lijn  */
.actionRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.navLink {
  font-size: 12px;
  color: #4da3ff;
  text-decoration: none;
}

.navLink:hover { text-decoration: underline; }

/*  Rapporteer knoppen  */
.reportRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.reportBtns {
  display: flex;
  gap: 6px;
}

.reportLabel {
  font-size: 12px;
  opacity: .6;
}

.reportBtn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .1s, opacity .1s;
}

.reportBtn:hover  { opacity: .85; transform: scale(1.05); }
.reportBtn:active { transform: scale(.97); }

.reportBtn.green  { background: rgba(76,175,80,.18);  border-color: #4caf50; color: #a5d6a7; }
.reportBtn.yellow { background: rgba(255,152,0,.18);  border-color: #ff9800; color: #ffcc80; }
.reportBtn.red    { background: rgba(244,67,54,.18);  border-color: #f44336; color: #ef9a9a; }

/*  Probleem knop  */
.problemBtn {
  display: inline-block;
  font-size: 12px;
  color: #f0a500;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.problemBtn:hover { text-decoration: underline; }

/*  Modal overlay  */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal.hidden { display: none; }

.modalBox {
  background: #1e2230;
  border-radius: 14px;
  padding: 20px;
  width: 300px;
  max-width: 90vw;
  position: relative;
}

.modalBox h3 {
  margin: 0 0 14px 0;
  font-size: 15px;
}

.modalClose {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 16px;
  cursor: pointer;
}

.modalOptions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.modalOptions label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.modalOptions input[type="text"] {
  display: none;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: #2a3045;
  color: #eaeaea;
  font-size: 13px;
  width: 100%;
}

.btnSubmitIssue {
  width: 100%;
  padding: 10px;
  background: #f0a500;
  color: #000;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.btnSubmitIssue:hover { background: #ffb830; }

/*  Automaat toevoegen knop  */
.btnAddMachine {
  margin-left: auto;
  white-space: nowrap;
  padding: 5px 10px;
  background: rgba(77,163,255,.12);
  border: 1px dashed rgba(77,163,255,.4);
  color: #4da3ff;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}

.btnAddMachine:hover { background: rgba(77,163,255,.2); }

/*  Add-machine modal form  */
.addForm {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.addForm label {
  font-size: 12px;
  opacity: .6;
  margin-top: 6px;
}

.addForm input[type="text"],
.addForm select {
  padding: 9px 12px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  background: #1e2230;
  color: #eaeaea;
  outline: none;
  width: 100%;
}

.addForm select option { background: #1e2230; }

.locatieRow {
  display: flex;
  gap: 8px;
}

.btnPickMap, .btnGps {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #2a2f42;
  background: #1e2230;
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
}

.btnPickMap:hover, .btnGps:hover { background: #2a3045; }
.btnPickMap.active { border-color: #f0a500; color: #f0a500; }

.locStatus {
  font-size: 12px;
  opacity: .7;
  min-height: 16px;
}

.btnSubmitAdd {
  width: 100%;
  padding: 10px;
  background: #4da3ff;
  color: #000;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background .15s;
}

.btnSubmitAdd:hover:not(:disabled) { background: #6db8ff; }
.btnSubmitAdd:disabled { opacity: .35; cursor: not-allowed; }

/*  Geo toast  */
.geoToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 24, 36, .92);
  color: #eaeaea;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 3000;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  white-space: nowrap;
}

.geoToast.hidden { display: none; }

/*  Kaart  */
.mapWrap {
  flex: 1;
  position: relative;
}

.mapToggleBtn {
  display: none; /* enkel zichtbaar op mobiel */
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 1000;
  background: rgba(0,0,0,.6);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
}

#map {
  width: 100%;
  height: 100%;
}

/*  Mobiel: kaart boven, sidebar eronder — één scroll (alleen de lijst)  */
@media (max-width: 700px) {
  body { overflow: hidden; height: 100dvh; }

  .appLayout {
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
  }

  /* Kaart: vaste hoogte bovenaan (DOM-volgorde: mapWrap eerst) */
  .mapWrap {
    height: 42vw;
    min-height: 180px;
    max-height: 42vh;
    flex-shrink: 0;
    transition: height .3s ease;
  }

  #map { height: 100%; }

  .mapToggleBtn { display: block; }

  .mapWrap.expanded {
    height: 100dvh;
    max-height: 100dvh;
    position: fixed;
    inset: 0;
    z-index: 1500;
  }

  .mapWrap.expanded .mapToggleBtn { font-size: 20px; }

  /* Sidebar: neemt de rest van de hoogte — scrollt NIET zelf */
  .sidebar {
    order: 0;
    width: 100%;
    min-width: unset;
    flex: 1;
    min-height: 0;           /* laat flex-child krimpen */
    overflow: hidden;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    flex-direction: column;
  }

  /* Alleen de lijst scrolt */
  .machineList {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: unset;
  }
}
