:root {
  /* Colors */
  --color-primary-bg: #003869; /* BTC-Blau */
  --color-secondary-bg: #ffffff;
  --color-action-bg: #ffffff;
  --color-map-bg: #f5f5f5; /* BTC-Grau */
  --color-primary: #ffffff;
  --color-secondary: #333;
  --color-action: #5aa6e7; /* BTC-hellblau */

  /* States */
  --color-available: rgba(0, 255, 0, 0.6);
  --color-unavailable: rgba(255, 0, 0, 0.6);
  --color-soon-unavailable: rgba(242, 189, 22, 0.6);
  --color-unknown: rgba(0, 110, 155, 0.85);

  /* Shadow */
  --shadow-popup: 0 10px 30px rgba(0,0,0,.3);
  --shadow-box: 0 4px 16px rgba(0,0,0,0.15);
  --shadow-drop: -11px 3px 15px #00000080;

  /* Sizing */
  --header-height: 82px;
  --avatar-size: 55px;
  --avatar-size-mobile: 40px;
  --spacing-s: 6px;
  --spacing-m: 12px;
  --spacing-l: 16px;
}

body {
  margin: 0;
  background: var(--color-map-bg);
  color: var(--color-primary);
  font-family: Arial, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none; /* Non-prefixed version */
}

/* --------------------------------------------------
   HEADER
-------------------------------------------------- */

.header {
  height: var(--header-height);
  background: var(--color-primary-bg);
  align-items: center;
  padding: 0 20px;
  box-sizing: border-box;
  z-index: 9;
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: 24px;
}

.header-logo {
  max-height: calc( var(--avatar-size) - 20px );
  width: auto;
}


/* Zentraler Bereich */
.header-center {
    display: flex;
    align-items: center;
    justify-content: center; /* → zwingt Titel in die absolute Mitte */
    position: relative;
}

.location-selector img {
    max-height: calc(var(--avatar-size) - 10px);
    cursor: pointer;
}
.location-selector img:hover {
  filter: drop-shadow(0px 0px 3px #fff);
}

.location-selector {
    display: flex;
    gap: 20px;
    position: absolute;
    left: calc(33% - 193px);
}

.title {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  text-align: center;
  color: var(--color-primary);
}

.title h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#planName {
  margin-top: 4px;
  font-size: 13px;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#userAvatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  justify-self: end;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
}

#userAvatar:empty {
  display: none;
}

/* --------------------------------------------------
   MOBILE
-------------------------------------------------- */

/* Standard: Helper ausgeblendet */
.orientation-helper {
  display: none;
}
.phone {
  height: 75px;
  width: 150px;
  border: 3px solid white;
  border-radius: 10px;
  animation: rotate 3.5s ease-in-out infinite alternate;
  /* display: none; */
}

.message {
  color: white;
  font-size: 1em;
  margin-top: 50px;
  /* display: none; */
}

@keyframes rotate {
  0% {
		transform: rotate(-90deg)
	}
	20% {
		transform: rotate(0deg)
	}
    66% {
      transform: rotate(0deg)
    }
	100% {
		transform: rotate(-90deg)
	}
}

@media only screen and (max-device-width: 812px) and (orientation: portrait) {

  .orientation-helper {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 9999;
    background: #000000ed;
    color: #fff;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-direction: column;
    font-size: 3.2rem;
    padding: 2rem;
  }

}

@media (max-width: 480px) or (max-height: 480px) {
  .header {
    height: 50px;
    column-gap: 12px;
    padding: 0 12px;
  }

  .inline-progress {
    top: 50px!important;
  }

  .sidebar {
      height: calc(100vh - 50px)!important;
      top: 50px!important;
      overflow-y: scroll
  }

  .header .logo {
    max-height: var(--avatar-size-mobile);
  }

  #userAvatar {
    width: var(--avatar-size-mobile);
    height: var(--avatar-size-mobile);
  }

  .header .title h2 {
    font-size: 18px;
  }

  #planName {
    font-size: 12px;
  }
}

/* --------------------------------------------------
   NAV BUTTON
-------------------------------------------------- */

.nav-button {
  position: absolute;
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 22px;
  cursor: pointer;
}

.nav-up { right: 20px; top: 8px; }
.nav-down { right: 20px; bottom: 8px; }

/* --------------------------------------------------
   MAP VIEWPORT
-------------------------------------------------- */

.content {
  height: calc(100vh - var(--header-height));
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.zoom-container {
  position: relative;
  transform-origin: 0 0;
  will-change: transform;
}

.image-container img {
  display: block;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(var(--shadow-drop));
  image-rendering: pixelated;
}

.dot,
.room {
  position: absolute;
  cursor: pointer;
}

.dot-legend {
  width: 15px;
  height: 15px;
  border-radius: 50%;
}
.dot-legend.unknown:after, .dot-legend.available:after, .dot-legend.unavailable:after, .dot-legend.soon-unavailable:after  {
  width: 15px!important;
  height: 15px!important;
  font-size: 0.7em!important;
}

.room-legend {
  width: 15px;
  height: 15px;
  margin: 0 5px;
}
.room-legend.available {
  background-color: #9df550;
}
.room-legend.unavailable {
  background-color: #ff938f;
}
.room-legend.soon-unavailable {
  background-color: #ffd250;
}
.room-legend.unknown {
  background-color: #a1eaff;
}

.dot{
  width: 30px;
  height: 30px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.dot.available, dot-legend.available {
  filter: drop-shadow(0px 0px 4px #000);
  background: var(--color-available);
}

.dot.unavailable, .dot-legend.unavailable {
  background: var(--color-unavailable);
}

.dot.soon-unavailable, .dot-legend.soon-unavailable {
  background: var(--color-soon-unavailable);
}

.room.available{
  filter: hue-rotate(277deg);
  backdrop-filter: saturate(8.5);
}

.room.unavailable {
    filter: hue-rotate(181deg);
    backdrop-filter: saturate(28.5);
}

.room.soon-unavailable {
    filter: hue-rotate(230deg);
    backdrop-filter: saturate(8.5);
}

.dot.unknown, .dot-legend.unknown {
  background: var(--color-unknown);
}

.dot.unknown:after, .dot-legend.unknown:after {
    content: "!";
    display: grid;
    place-items: center;
    line-height: 1.7em;
    aspect-ratio: 1;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-unknown);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    font-weight: bold;
    font-size: larger;
}

.dot.available:after, .dot-legend.available:after {
  content: "✔";
  display: grid;
  place-items: center;
  line-height: 1.7em;
  aspect-ratio: 1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-available);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  font-weight: bold;
  font-size: larger;
}

.dot.soon-unavailable:after, .dot-legend.soon-unavailable:after {
  content: "~";
  display: grid;
  place-items: center;
  line-height: 1.7em;
  aspect-ratio: 1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-soon-unavailable);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  font-weight: bold;
  font-size: larger;
}

.dot.unavailable:after, .dot-legend.unavailable:after {
  content: "✕";
  display: grid;
  place-items: center;
  line-height: 1.7em;
  aspect-ratio: 1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-unavailable);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  font-weight: bold;
  font-size: larger;
}

.room.unknown { backdrop-filter: saturate(3.5); }

.current-ressource{
  height: 600px;
}

.ressource-banner {
  height: 185px;
  background-size: cover;
  background-position: center;
  border-bottom: 2px solid var(--color-primary-bg);
}

.ressource-content {
  padding: 16px 18px;
  color: var(--color-secondary);
}

.ressource-content h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.ressource-description {
  font-size: 14px;
  margin-bottom: 14px;
  padding: 10px 0;
  color: var(--color-secondary);
  max-width: 350px;
}

.person-booking-ressource {
  font-size: 14px;
  color: var(--color-secondary);
  width: 100%;
  text-align: center;
  margin: 10px 0;
}

.ressource-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px solid #eee;
}

.ressource-row:last-child { border-bottom: none; }


.sidebar{
  display: flex;
  min-width: 405px;
  background: var(--color-primary);
  position: absolute;
  height: calc(100vh - var(--header-height));
  right: 0;
  top: var(--header-height);
  filter: drop-shadow(2px 4px 6px black);
  flex-direction: column;
  flex-wrap: nowrap;

}

.legend{
    position: absolute;
    color: var(--color-primary-bg);
    display: flex;
    flex-direction: column;
    /* padding: 5px 20px; */
    bottom: 40px;
    left: 15px;
    width: 250px;
}

.legend>div {
  display:flex;
  padding: 3px 0;
  font-size: 0.8em;
}

.legend>div>span {
  padding-left: 20px;
}

.availability-bar-container {
  margin: 16px 0;
  width: 100%;
}

.availability-bar {
  display: flex;
  width: 100%;
  height: 26px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.availability-segment {
  height: 16px;
  margin-top: 5px
}

.avail-free {
  background: #4caf50; /* grün */
}

.avail-busy {
  background: #e53935; /* rot */
}

.availability-times {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.7;
}

.now-indicator {
  position: absolute;
  width: 2px;
  height: 180%;
  background: var(--color-secondary);
  top: -40%;
  z-index: 85;
  pointer-events: none;
}


.spinner[hidden] { display: none; }
.error { color:#b3261e; margin-top:6px; }
.btn-primary:disabled { opacity:.6; cursor:not-allowed; }


/* --------------------------------------------------
   BADGES
-------------------------------------------------- */

.badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: bold;
}

.badge.green { background: #d4f7d4; color: #1c7c1c; }
.badge.red { background: #fbdcdc; color: #a10000; }
.badge.gray { background: #eee; color: #555; }
.badge.yellow { background: #fff3cd; color: #856404; }

/* --------------------------------------------------
   SELECTORS (Floor / Availability)
-------------------------------------------------- */

.floor-selector,
.availability-selector {
  position: relative;
  background: var(--color-primary);
  color: var(--color-primary-bg);
  font-family: "Segoe UI", sans-serif;
  padding: 15px 0px 15px 20px
}

.floor-selector { min-width: 290px; }

.floor-bar{
  display:flex;
}
.floor-btn.active{
  color: var(--color-primary-bg);
  background: #ffd628;
  font-weight: 700;
}
.floor-btn{
  border-radius: 0;
  border-right: 1px solid gray!important;
}
.floor-btn:first-child {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}
.floor-btn:last-child {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
  border-right: 0!important;
}

/* Inputs */
input[type="date"],
input[type="time"] {
  color: var(--color-secondary);
  padding: 6px 10px;
  width: 120px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #fafafa;
  font-size: 14px;
  transition: all 0.2s ease;
  color: var(--color-secondary);
}

.availability-selector input:hover {
  border-color: var(--color-secondary);
  background: var(--color-action-bg);
}

.availability-selector input:focus {
  outline: none;
  border-color: var(--color-action);
  box-shadow: 0 0 0 2px rgba(0,120,212,0.25);
  background: var(--color-action-bg);
}

/* Buttons */
button,
.floor-selector button {
  color: var(--color-secondary);
  padding: 6px 12px;
  border: none;
  border-radius: 0;
  background: #f1f1f1;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.availability-selector button {
    color: var(--color-primary-bg);
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background: #ffd628;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

.floor-selector button:hover,
.availability-selector button:hover {
  background: #e1e1e1;
}

.floor-selector button:active,
.availability-selector button:active {
  transform: scale(0.97);
}

.floor-selector button:disabled,
.availability-selector button:disabled {
  color: #979797;
  cursor: not-allowed;
  transform: none !important;
  pointer-events: none;
}


/* --------------------------------------------------
   LOADING STATES & INLINE PROGRESS
-------------------------------------------------- */

/* Dot loading state: visible spinner */
.dot.loading {
  background: rgba(90, 100, 115, 0.7) !important;
  filter: none !important;
  display: grid !important;
  place-items: center !important;
  box-shadow: 0 0 6px rgba(0,0,0,0.3) !important;
}

.dot.loading::after {
  content: "" !important;
  display: block !important;
  width: 16px !important;
  height: 16px !important;
  aspect-ratio: auto !important;
  line-height: 0 !important;
  border: 2.5px solid rgba(255,255,255,0.3) !important;
  border-top-color: #fff !important;
  border-radius: 50% !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0 !important;
  animation: dotLoadSpin 0.6s linear infinite !important;
}

.room.loading {
  backdrop-filter: saturate(0);
}

@keyframes dotLoadSpin {
  to { transform: rotate(360deg); }
}

/* Inline progress bar (below header) */
.inline-progress {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  z-index: 500;
  pointer-events: none;
  transition: opacity 0.4s;
}

.inline-progress__track {
  width: 100%;
  height: 7px;
  background: rgba(255, 214, 40, 0.2);
}

.inline-progress__fill {
  height: 100%;
  width: 0%;
  background: #ffd628;
  border-radius: 0 2px 2px 0;
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
}

.inline-progress__label {
  display: inline-block;
  margin: 6px 0 0 12px;
  font-size: 11px;
  font-weight: 600;
  color: #5a6a7a;
  background: white;
  padding: 3px 10px;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
  pointer-events: auto;
}



/* --- Footer-Hilfe unten links --- */
.help-footer {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 50;
    color: #6b7280;
    font: 500 14px / 1.3 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    cursor: pointer;
    user-select: none;
    padding: 0px 5px;
}
.help-footer:hover { background: #f3f4f6; color: #374151; }
.help-footer svg { width: 16px; height: 16px; opacity: .8; }

/* --- Einfaches Modal/Popup --- */
.modal {
  position: fixed;
  inset: 0;
  display: none;             /* per JS auf block */
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.is-open { display: flex; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(1px);
}
.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 32px));
  background: #ffffff;
  color: #111827;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  padding: 18px 18px 12px 18px;
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.modal__title {
  font: 700 18px/1.3 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
}
.modal__close {
  border: 0;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
.modal__close:hover { background: #f3f4f6; color: #374151; }
.modal__content {
  font: 400 14px/1.55 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #374151;
}
.modal__content p { margin: 0 0 10px 0; }
.modal__content code {
  background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 13px;
}

