/* BBI Immobilien GmbH -- Sunpath Visualizer
   Design-System: BBI CI v1.0 (marke/ci/bbi/00-BBI-CI-REFERENZ.md + bbi-tokens.css)
   Pflichtangaben-Footer: aktive_stufe = bbi (context/branding-stufen.md)
   Sonnen-/Bahn-Farben (Gelb/Orange) = funktionale Daten-Semantik, keine Brand-Flächen */

:root {
  /* BBI Primär (belegt aus CI) */
  --bbi-blue:   #113250;   /* BBI-Dunkelblau -- Hauptfarbe */
  --bbi-white:  #FFFFFF;
  --bbi-black:  #000000;

  /* Abgeleitet (Tints + K-Grauskala, sparsam) */
  --bbi-blue-90: #29465F;  /* Hover / Sekundär-Flächen */
  --bbi-blue-20: #CFD8E0;  /* Linien, Borders */
  --bbi-blue-10: #E7EBEF;  /* helle Akzent-Hintergründe */
  --bbi-gray:   #737373;   /* Sekundär-Text */
  --bbi-mist:   #F2F2F2;   /* heller Background */
  --bbi-ink:    #262626;   /* Body-Text */

  --bbi-font: "Source Sans Pro", "Source Sans 3", "Segoe UI", "Liberation Sans", Helvetica, Arial, sans-serif;
  --bbi-radius: 4px;
  --bbi-gap: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--bbi-font);
  color: var(--bbi-ink);
  background: var(--bbi-mist);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== Brandbar ===== */
#brandbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--bbi-blue-20);
  background: var(--bbi-blue);
  color: var(--bbi-white);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Logo-Regel (NIE-WIEDER, Vorfall 2026-07-16): nur EINE Dimension,
   align-self gegen die Flexbox-Stretch-Falle, object-fit gegen Verzerrung */
.brand-logo {
  height: 44px;
  width: auto;
  align-self: flex-start;
  object-fit: contain;
  display: block;
}

#brandbar .title {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  color: var(--bbi-white);
  opacity: 0.85;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  padding-left: 18px;
}

#brandbar .address {
  font-size: 13px;
  font-weight: 400;
  color: var(--bbi-white);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
  opacity: 0.92;
}

/* ===== Layout ===== */
#layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  flex: 1;
  min-height: 0;
}

#mapwrap {
  position: relative;
  min-height: 0;
}
#map {
  height: 100%;
  width: 100%;
  background: var(--bbi-blue-10);
}

.attribution-note {
  position: absolute;
  bottom: 6px;
  left: 8px;
  z-index: 500;
  font-size: 10px;
  color: var(--bbi-gray);
  background: rgba(242, 242, 242, 0.93);
  padding: 3px 7px;
  border-radius: var(--bbi-radius);
  border: 1px solid var(--bbi-blue-20);
  pointer-events: none;
}

/* Rechtsseiten-Verweis im Kartenbereich: im Vollmodus überflüssig (steht in der
   Footer-Karte), im iframe die einzige erreichbare Stelle -- deshalb nur dort sichtbar */
.embed-legal {
  display: none;
  position: absolute;
  /* hält Abstand zur Leaflet-Attributionszeile, die unten rechts sitzt;
     bei 6px stossen beide im schmalen iframe aneinander (gemessen 06.08.) */
  bottom: 26px;
  right: 8px;
  z-index: 500;
  font-size: 10px;
  background: rgba(242, 242, 242, 0.93);
  padding: 3px 7px;
  border-radius: var(--bbi-radius);
  border: 1px solid var(--bbi-blue-20);
}
.embed-legal a {
  color: var(--bbi-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
#app[data-mode="embed"] .embed-legal { display: block; }

#panel {
  border-left: 1px solid var(--bbi-blue-20);
  background: var(--bbi-mist);
  overflow-y: auto;
  padding: var(--bbi-gap);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===== Cards ===== */
.card {
  background: var(--bbi-white);
  border: 1px solid var(--bbi-blue-20);
  border-radius: var(--bbi-radius);
  padding: 16px;
}

.card-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--bbi-blue);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bbi-blue-10);
}

/* ===== Form-Rows ===== */
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.row:last-child { margin-bottom: 0; }
.row.buttons { flex-wrap: wrap; gap: 6px; }

.slider-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 400;
  color: var(--bbi-gray);
  min-width: 100px;
}

input[type="date"],
input[type="time"] {
  flex: 1;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  border: 1px solid var(--bbi-blue-20);
  border-radius: var(--bbi-radius);
  background: var(--bbi-white);
  color: var(--bbi-ink);
  font-variant-numeric: tabular-nums;
}
input[type="date"]:focus,
input[type="time"]:focus {
  border-color: var(--bbi-blue);
  outline: 2px solid var(--bbi-blue);
  outline-offset: -1px;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--bbi-blue);
}

button {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border: 1px solid var(--bbi-blue);
  background: var(--bbi-white);
  color: var(--bbi-blue);
  border-radius: var(--bbi-radius);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
button:hover {
  background: var(--bbi-blue);
  color: var(--bbi-white);
}
button:focus-visible {
  outline: 2px solid var(--bbi-blue);
  outline-offset: 2px;
}

/* ===== Sonnen-Daten KV-Liste ===== */
.kv {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
}
.kv dt {
  font-size: 12px;
  font-weight: 400;
  color: var(--bbi-gray);
}
.kv dd {
  margin: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  color: var(--bbi-ink);
  text-align: right;
}
.kv dd strong { font-weight: 700; }

/* ===== Legende ===== */
.legend ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  color: var(--bbi-ink);
}
.legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 8px;
}
/* Sonnen-Semantik-Farben (funktional, nicht Brand) */
.dot-path   { background: #E8841C; border: 1px solid #B86610; }
.dot-sun    { background: #FFD23F; border: 2px solid #E8841C; width: 12px; height: 12px; }
.dot-shadow { background: #262626; opacity: 0.6; }
.dot-marker { background: var(--bbi-blue); }

/* ===== Footer-Card / Pflichtangaben ===== */
.small {
  font-size: 11px;
  color: var(--bbi-gray);
  margin: 0 0 6px 0;
  line-height: 1.5;
  font-weight: 400;
}
.small a {
  color: var(--bbi-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-card .small:last-child { margin-bottom: 0; }
.footer-card .legal {
  font-size: 10px;
}

/* ===== Embed-Mode ===== */
#app[data-mode="embed"] #brandbar {
  padding: 10px 14px;
  gap: 14px;
}
#app[data-mode="embed"] .brand-logo {
  height: 34px;
}
#app[data-mode="embed"] #brandbar .title {
  display: none;
}
#app[data-mode="embed"] #panel {
  padding: 10px;
  gap: 10px;
}
#app[data-mode="embed"] .footer-card {
  display: none;
}

/* ===== Mobile / schmale iframes ===== */
@media (max-width: 720px) {
  #layout {
    grid-template-columns: 1fr;
    grid-template-rows: 55% 45%;
  }
  #panel {
    border-left: none;
    border-top: 1px solid var(--bbi-blue-20);
  }
  #brandbar .address {
    max-width: 30%;
    font-size: 12px;
  }
  .brand-logo { height: 28px; }
  #brandbar .title { display: none; }
}

/* ===== Map-Marker (Pin in BBI-Blau) ===== */
.bbi-marker {
  width: 24px;
  height: 32px;
  filter: drop-shadow(0 2px 4px rgba(17, 50, 80, 0.5));
}
.bbi-marker svg { display: block; width: 100%; height: 100%; }

/* ===== Sun-Icon (funktionale Sonnen-Darstellung) ===== */
.sun-icon {
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(255, 192, 60, 0.85));
}
.sun-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ===== Stunden-Labels auf der Sonnenbahn ===== */
.hour-label {
  pointer-events: none;
}
.hour-label-inner {
  background: rgba(255, 255, 255, 0.94);
  color: #262626;
  font: 700 10px/1 var(--bbi-font);
  letter-spacing: 0.02em;
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid rgba(232, 132, 28, 0.6);
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ===== Uhrzeit-Label über der Sonne ===== */
.sun-time-label {
  pointer-events: none;
}
.sun-time-inner {
  background: #113250;
  color: #FFFFFF;
  font: 700 11px/1 var(--bbi-font);
  padding: 3px 8px;
  border-radius: 3px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
