/* ============================================================
   style.css — Weg Analyse Tool
   ============================================================
   Structuur:
     1.  Reset & basis
     2.  Landing page
     3.  Navigatiebalk
     4.  Dashboard layout
     5.  Kaart & kaartbesturingselementen
     6.  Sidebar
     7.  Legenda & info-icoon tooltip
     8.  Lijstitems (zones, manual, projecten)
     9.  Detail-panel
    10.  Import-formulier
    11.  Kaartknop (card)
    12.  Zoekbare project-dropdown
    13.  Export-dropdown
    14.  Sidebar-toggle & inklapbare secties
    15.  Dwarsprofiel modal
    16.  Kaartlagen control
    17.  Responsief (tablet / mobiel)
    18.  Viewer/admin toegangscontrole
    19.  Login pagina
   ============================================================ */


/* ============================================================
   1. Reset & basis
   ============================================================ */

html,
body {
  margin:      0;
  padding:     0;
  height:      100%;
  font-family: Arial, sans-serif;
}

body {
  background: #f4f6f8;
  color:       #1f2d3d;
}


/* ============================================================
   2. Landing page
   ============================================================ */

.landing-bg {
  position:  absolute;
  inset:     0;
  background: url("../assets/mobile-mappers.png") center center / cover no-repeat;
  filter:    blur(7px);
  transform: scale(1.08);
  z-index:   1;
}

.landing-overlay {
  position:   absolute;
  inset:      0;
  background: rgba(17, 31, 48, 0.58);
  z-index:    2;
}

.landing-content {
  z-index: 3;
}

.landing-logo {
  max-width:     360px;
  background:    rgba(255, 255, 255, 0.96);
  padding:       14px 22px;
  border-radius: 14px;
  box-shadow:    0 10px 28px rgba(0, 0, 0, 0.25);
}

.landing-text {
  max-width:   760px;
  font-size:   1.1rem;
  line-height: 1.8;
}

.teccon-title {
  font-size:      2rem;
  font-weight:    700;
  letter-spacing: 2px;
  color:          white;
  text-transform: uppercase;
}


/* ============================================================
   3. Navigatiebalk
   ============================================================ */

.navbar .navbar-brand {
  margin-bottom: 0;
}

/* Hover → blauw voor outline-knoppen in de navbar */
.navbar .btn-outline-light:hover {
  background-color: #0d6efd;
  border-color:     #0d6efd;
  color:            white;
}


/* ============================================================
   4. Dashboard layout
   ============================================================ */

.dashboard-row {
  height: calc(100vh - 96px);
}


/* ============================================================
   5. Kaart & kaartbesturingselementen
   ============================================================ */

#mapWrapper {
  position: relative;
  width:    100%;
  height:   100%;
}

#map {
  width:      100%;
  height:     100%;
  min-height: 500px;
}

.map-controls {
  position:   absolute;
  top:        14px;
  left:       70px;
  z-index:    1000;
  display:    flex;
  gap:        10px;
  flex-wrap:  wrap;
}


/* ============================================================
   6. Sidebar
   ============================================================ */

.sidebar-col {
  height:     calc(100vh - 96px);
  overflow-y: auto;
  background: #f8f9fa;
}

/* Extra pagina's (import, projectlijst, …) */
.custom-page {
  position:   fixed;
  inset:      0;
  background: #f8f9fa;
  z-index:    3000;
  overflow-y: auto;
}

/* SweetAlert2 boven de custom-pagina's */
.swal2-container {
  z-index: 9999 !important;
}


/* ============================================================
   7. Legenda & info-icoon tooltip
   ============================================================ */

/* Gekleurde blokjes in de legenda */
.kleur {
  display:        inline-block;
  width:          18px;
  height:         18px;
  border-radius:  4px;
  vertical-align: middle;
  flex-shrink:    0;
}

.donkergroen { background: #0b6b0b; }
.groen       { background: #4cd137; }
.geel        { background: gold;    }
.oranje      { background: orange;  }
.rood        { background: red;     }

.legenda-wrap {
  row-gap: 8px;
}

.legenda-item {
  display:     inline-flex;
  align-items: center;
  gap:         8px;
  position:    relative;
}

/* Info-icoon (ⓘ) */
.info-icon {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           18px;
  height:          18px;
  border-radius:   50%;
  background:      #2b6cb0;
  color:           #fff;
  font-size:       11px;
  font-weight:     bold;
  cursor:          pointer;
  position:        relative;
  line-height:     1;
  flex-shrink:     0;
}

/* Tooltip die verschijnt bij hover op het info-icoon */
.tooltip-text {
  display:       none;
  position:      absolute;
  top:           24px;
  left:          100%;
  margin-left:   10px;

  width:      280px;
  box-sizing: border-box;

  background-color: #2b6cb0;
  color:            #fff;
  text-align:       left;

  padding:       10px 12px;
  border-radius: 8px;

  font-size:   12px;
  font-weight: normal;
  line-height: 1.45;

  white-space:   normal;
  word-break:    break-word;
  overflow-wrap: break-word;

  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  z-index:    5000;
}

/* Pijl-decoratie links van de tooltip-ballon */
.tooltip-text::before {
  content:      "";
  position:     absolute;
  top:          10px;
  left:         -6px;
  border-width: 6px 6px 6px 0;
  border-style: solid;
  border-color: transparent #2b6cb0 transparent transparent;
}

.info-icon:hover .tooltip-text {
  display: block;
}


/* ============================================================
   8. Lijstitems (zones, handmatige markeringen, projecten)
   ============================================================ */

.zone-item,
.manual-item,
.project-item {
  padding:       10px;
  margin-bottom: 10px;
  background:    white;
  border-left:   6px solid #ccc;
  border-radius: 8px;
  cursor:        pointer;
  box-shadow:    0 1px 3px rgba(0, 0, 0, 0.08);
  transition:    0.2s ease;
}

.zone-item:hover,
.manual-item:hover,
.project-item:hover {
  background: #eef3f7;
  transform:  translateY(-1px);
}

.project-meta {
  font-size: 13px;
  color:     #5c6b7a;
}

.empty-text {
  color:  #6c757d;
  margin: 0;
}

/* Knoppen onderaan een manual-item */
.manual-controls {
  margin-top: 8px;
  display:    flex;
  gap:        6px;
  flex-wrap:  wrap;
}

.manual-controls button {
  border:        none;
  padding:       6px 10px;
  border-radius: 6px;
  cursor:        pointer;
  color:         white;
  font-size:     13px;
}

/* "Opvolgen"-knop */
.btn-opvolgen {
  background-color: #8e44ad;
  color:            white;
  border:           none;
}

.btn-opvolgen:hover {
  background-color: #732d91;
}

/* Rij binnen een manual-item (tekst + verwijderknop naast elkaar) */
.manual-item-row {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  gap:             10px;
}

.manual-text {
  font-size: 14px;
}

/* Verwijderknop (✕) */
.btn-remove {
  background-color: #e74c3c;
  color:            white;
  border:           none;
  border-radius:    6px;
  padding:          4px 8px;
  cursor:           pointer;
  font-size:        14px;
}

.btn-remove:hover {
  background-color: #c0392b;
}


/* ============================================================
   9. Detail-panel
   ============================================================ */

#detailPanel {
  background:    white;
  border-radius: 8px;
  padding:       0;
  margin-top:    0;
  box-shadow:    none;
}

/* Tweekoloms raster voor meetpuntgegevens */
.detail-grid {
  display:               grid;
  grid-template-columns: 1fr 1fr;
  gap:                   8px 12px;
  font-size:             14px;
}

.detail-label {
  font-weight: bold;
  color:       #2c3e50;
}

/* Notitieveld */
#detailNote {
  width:         100%;
  margin-top:    10px;
  min-height:    70px;
  padding:       8px;
  border-radius: 6px;
  border:        1px solid #ccc;
  resize:        vertical;
  box-sizing:    border-box;
}

#saveNoteBtn {
  margin-top:    8px;
  border:        none;
  padding:       8px 12px;
  border-radius: 6px;
  background:    #2c3e50;
  color:         white;
  cursor:        pointer;
}

#saveNoteBtn:hover {
  background: #1b2836;
}


/* ============================================================
   10. Import-formulier
   ============================================================ */

#projectForm .form-control,
#projectForm .form-select {
  border-radius: 8px;
}

#projectForm .form-text {
  font-size:   13px;
  color:       #6c757d;
  line-height: 1.5;
}

#projectMessage .alert {
  border-radius: 10px;
}


/* ============================================================
   11. Kaartknop (card)
   ============================================================ */

.card {
  border:        none;
  border-radius: 12px;
}

.card .card-body {
  border-radius: 12px;
}


/* ============================================================
   12. Zoekbare project-dropdown
   ============================================================ */

.zoek-dropdown {
  position: relative;
  display:  inline-block;
}

.zoek-dropdown-toggle {
  width:         100%;
  text-align:    left;
  cursor:        pointer;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

.zoek-dropdown-menu {
  display:          none;
  position:         absolute;
  top:              calc(100% + 4px);
  left:             0;
  min-width:        100%;
  width:            max-content;
  max-width:        340px;
  background:       #fff;
  border:           1px solid #ced4da;
  border-radius:    6px;
  box-shadow:       0 6px 20px rgba(0, 0, 0, 0.15);
  z-index:          9999;
  padding:          6px;
}

.zoek-dropdown-menu.zoek-dropdown-open {
  display: block;
}

.zoek-dropdown-input {
  margin-bottom: 4px;
}

.zoek-dropdown-list {
  max-height: 220px;
  overflow-y: auto;
}

.zoek-dropdown-item {
  padding:       6px 8px;
  border-radius: 4px;
  cursor:        pointer;
  font-size:     0.875rem;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  color:         #212529;
}

.zoek-dropdown-item:hover {
  background: #e9ecef;
}

.zoek-dropdown-no-result {
  padding:   8px;
  color:     #6c757d;
  font-size: 0.875rem;
}


/* ============================================================
   13. Export-dropdown (old 12)
   ============================================================ */

.export-dropdown {
  position: relative;
  display:  inline-block;
}

.export-btn {
  background-color: transparent;
  color:            white;
  border:           1px solid rgba(255,255,255,0.5);
  padding:          0.25rem 0.5rem;
  font-size:        0.875rem;
  border-radius:    0.25rem;
  cursor:           pointer;
  line-height:      1.5;
}

.export-menu {
  position:        absolute;
  top:             110%;
  right:           0;
  background-color: #2c2f33;
  border:          1px solid #444;
  border-radius:   6px;
  padding:         6px;
  display:         flex;
  flex-direction:  column;
  gap:             4px;
  z-index:         1000;
}

.export-menu button {
  background:    none;
  border:        none;
  color:         white;
  text-align:    left;
  padding:       6px 10px;
  cursor:        pointer;
  border-radius: 4px;
}

.export-menu button:hover {
  background-color: #444;
}

#moduleSwitch {
  flex-shrink: 0;
}


/* ============================================================
   14. Sidebar-toggle & inklapbare secties
   ============================================================ */

/* Vloeiende overgang bij tonen/verbergen */
#mapColumn,
#mainSidebar {
  transition: all 0.3s ease;
}

/* Sidebar verborgen: kaart neemt volledige breedte in */
.dashboard-row.sidebar-hidden #mainSidebar {
  display: none !important;
}

.dashboard-row.sidebar-hidden #mapColumn {
  flex:      0 0 100%;
  max-width: 100%;
}

/* Toggle-knop rechtsboven op de kaart */
.sidebar-toggle-btn {
  position:      absolute;
  top:           16px;
  right:         16px;
  z-index:       1200;
  border:        none;
  border-radius: 10px;
  padding:       8px 12px;
  background:    rgba(33, 37, 41, 0.92);
  color:         white;
  font-size:     18px;
  line-height:   1;
  cursor:        pointer;
  box-shadow:    0 4px 12px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle-btn:hover {
  background: #0d6efd;
}

/* Compacte samenvatting bovenaan het detail-panel */
.detail-summary {
  padding-bottom: 10px;
  border-bottom:  1px solid #e9ecef;
  margin-bottom:  8px;
}

/* Toon meer / Toon minder knop */
.btn-toon-meer {
  background:    none;
  border:        none;
  color:         #212529;
  font-size:     13px;
  padding:       2px 0 8px;
  cursor:        pointer;
  width:         100%;
  text-align:    left;
}

.btn-toon-meer:hover {
  text-decoration: underline;
}

.detail-extra.hidden {
  display: none;
}

/* Inklapbare secties binnen het detail-panel */
.detail-section {
  margin-top: 16px;
}

.detail-section:first-child {
  margin-top: 0;
}

.detail-section-header {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  gap:             12px;
  cursor:          pointer;
  margin-bottom:   10px;
}

.detail-section-header h5 {
  margin:      0;
  font-size:   1rem;
  display:     flex;
  align-items: center;
  gap:         8px;
}

.detail-arrow {
  font-size:  14px;
  transition: transform 0.2s ease;
  user-select: none;
}

.detail-section-header.collapsed .detail-arrow {
  transform: rotate(-90deg);
}

.detail-section-content.hidden {
  display: none;
}

/* Inklapbare kaartkoppen in de sidebar */
.sidebar-section-header {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  cursor:          pointer;
  user-select:     none;
}

.sidebar-arrow {
  font-size:  14px;
  transition: transform 0.2s ease;
  color:      #6c757d;
}

.sidebar-section-header.collapsed .sidebar-arrow {
  transform: rotate(-90deg);
}

.sidebar-section-content.collapsed {
  display: none;
}


/* ============================================================
   15. Dwarsprofiel modal
   ============================================================ */

.profile-click-hint {
  margin-top: 8px;
  font-size:  12px;
  color:      #6c757d;
}

.profile-meta {
  margin-top:  8px;
  font-size:   13px;
  color:       #2c3e50;
  line-height: 1.5;
}

.profile-uitleg {
  font-size:   12px;
  color:       #444;
  line-height: 1.5;
  margin:      0 0 10px;
  padding:     7px 10px;
  background:  #f2f2f2;
  border-left: 3px solid #333;
  border-radius: 3px;
}

.spoor-metrics {
  display:   flex;
  gap:       8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.spoor-metric {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  background:     #f8f9fa;
  border:         1px solid #dee2e6;
  border-radius:  6px;
  padding:        6px 10px;
  min-width:      80px;
}

.spoor-label {
  font-size:   10px;
  color:       #6c757d;
  margin-bottom: 2px;
}

.spoor-value {
  font-size:   15px;
  font-weight: 700;
  color:       #2c3e50;
}

.spoor-goed   { color: #27ae60; }
.spoor-matig  { color: #e67e22; }
.spoor-slecht { color: #e74c3c; }

.profile-legend {
  display:     flex;
  flex-wrap:   wrap;
  gap:         6px 16px;
  margin-top:  8px;
  font-size:   12px;
  color:       #333;
}

.profile-legend-item {
  display:     flex;
  align-items: center;
  gap:         5px;
}

.pleg-line {
  display:       inline-block;
  width:         22px;
  height:        2px;
  border-radius: 1px;
}

.pleg-box {
  display:       inline-block;
  width:         16px;
  height:        12px;
  border-radius: 2px;
}

.pleg-dash {
  display: inline-block;
  width:   22px;
}

/* Achtergrond-overlay */
.profile-modal {
  position:        fixed;
  inset:           0;
  background:      rgba(0, 0, 0, 0.72);
  display:         flex;
  align-items:     center;
  justify-content: center;
  z-index:         5000;
  padding:         20px;
}

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

/* Modalvenster */
.profile-modal-content {
  background:    white;
  border-radius: 14px;
  padding:       18px;
  width:         min(1100px, 95vw);
  max-height:    95vh;
  overflow:      auto;
  box-shadow:    0 15px 40px rgba(0, 0, 0, 0.35);
}

.profile-modal-header {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-bottom:   12px;
}

.profile-modal-header h4 {
  margin: 0;
}

/* Sluitknop */
.profile-modal-close {
  border:        none;
  background:    #dc3545;
  color:         white;
  border-radius: 8px;
  padding:       8px 12px;
  cursor:        pointer;
}

.profile-modal-close:hover {
  background: #bb2d3b;
}

/* Canvas-elementen tonen een pointer-cursor om aan te geven dat ze klikbaar zijn */
#profileCanvas,
#profileModalCanvas {
  cursor: pointer;
}


/* ============================================================
   16. Responsief (tablet / mobiel)
   ============================================================ */

@media (max-width: 991px) {
  .dashboard-row {
    height: auto;
  }

  .sidebar-col {
    height:      auto;
    border-left: none !important;
    border-top:  1px solid #dee2e6;
  }

  #map {
    min-height: 420px;
  }
}

/* =========================================
   Kaartlagen control
   ========================================= */
.lagen-control {
  position: relative;
}

.lagen-toggle-btn {
  display:         flex;
  align-items:     center;
  gap:             7px;
  background:      white;
  border:          2px solid rgba(0,0,0,0.18);
  border-radius:   10px;
  padding:         8px 14px;
  font-size:       13px;
  font-weight:     600;
  cursor:          pointer;
  box-shadow:      0 2px 10px rgba(0,0,0,0.15);
  color:           #212529;
  white-space:     nowrap;
  transition:      border-color 0.15s, color 0.15s, background 0.15s;
}

.lagen-toggle-btn:hover,
.lagen-control--open .lagen-toggle-btn {
  background:    #f0f4ff;
  border-color:  #0d6efd;
  color:         #0d6efd;
}

.lagen-panel {
  display:       none;
  position:      absolute;
  bottom:        calc(100% + 8px);
  right:         0;
  background:    white;
  border-radius: 12px;
  padding:       14px 16px;
  min-width:     215px;
  box-shadow:    0 6px 24px rgba(0,0,0,0.14);
  border:        1px solid #e9ecef;
}

.lagen-control--open .lagen-panel {
  display: block;
}

.lagen-sectie-titel {
  font-size:       10px;
  font-weight:     700;
  text-transform:  uppercase;
  letter-spacing:  0.7px;
  color:           #6c757d;
  margin-bottom:   8px;
}

.lagen-optie {
  display:      flex;
  align-items:  center;
  gap:          8px;
  font-size:    13px;
  cursor:       pointer;
  padding:      4px 0;
  color:        #212529;
  user-select:  none;
  border-radius: 4px;
  transition:   color 0.1s;
}

.lagen-optie:hover { color: #0d6efd; }

.lagen-optie input { cursor: pointer; }

.lagen-hr {
  border:     none;
  border-top: 1px solid #e9ecef;
  margin:     10px 0;
}

@media (max-width: 767px) {
  .lagen-panel { right: auto; left: 0; }

  .landing-logo {
    max-width: 260px;
    padding:   10px 16px;
  }

  .landing-text {
    font-size:   1rem;
    line-height: 1.6;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .map-controls {
    top:  10px;
    left: 65px;
    gap:  8px;
  }
}


/* ============================================================
   Viewer/admin toegangscontrole
   ============================================================ */

/* Admin-only elementen verbergen voor viewers */
body.is-viewer .admin-only,
body.is-viewer .admin-only-btn { display: none !important; }


/* ============================================================
   Login pagina — kaartknop gebruikt dezelfde achtergrond
   ============================================================ */

#loginPage .card {
  backdrop-filter: blur(2px);
}

#loginPage .form-control:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}
