/* =====================================================
   GLOBAL
===================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;

  font-family: Arial, Helvetica, sans-serif;

  background: #000;
}

/* =====================================================
   HEADER
===================================================== */

.app-header {
  height: 64px;

  display: flex;
  align-items: center;

  padding: 0 22px;

  background: #ffffff;

  border-bottom: 1px solid #e4e4e4;

  position: relative;

  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;

  height: 100%;

  gap: 18px;
}

.brand-logo {
  display: block;

  width: auto;
  height: auto;

  max-height: 42px;
  max-width: 175px;

  object-fit: contain;
}

.header-divider {
  width: 1px;
  height: 30px;

  background: #d6d6d6;
}

.project-title {
  color: #202020;

  font-size: 18px;
  font-weight: 600;

  letter-spacing: 0.1px;

  white-space: nowrap;
}

/* =====================================================
   MAIN VIEWER
===================================================== */

.viewer {
  display: flex;

  width: 100%;

  height: calc(100vh - 64px);

  background: #000;
}

.map-panel,
.video-panel {
  position: relative;

  height: 100%;

  min-width: 0;
}

/* Map = 40% */

.map-panel {
  width: 40%;
}

/* Video = 60% */

.video-panel {
  width: 60%;

  overflow: hidden;

  background: #000;
}

/* =====================================================
   MAP
===================================================== */

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

/* =====================================================
   MAP STYLE SWITCHER
===================================================== */

.map-style-switcher {
  position: absolute;

  top: 18px;
  right: 18px;

  z-index: 20;

  display: flex;

  gap: 4px;

  padding: 4px;

  background: rgba(20, 20, 20, 0.86);

  border-radius: 10px;

  backdrop-filter: blur(8px);

  -webkit-backdrop-filter: blur(8px);
}

.map-style-switcher button {
  border: none;

  padding: 8px 14px;

  border-radius: 7px;

  background: transparent;

  color: #ddd;

  font-size: 13px;
  font-weight: 500;

  cursor: pointer;

  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.map-style-switcher button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.map-style-switcher button.active {
  background: #fff;

  color: #111;
}

/* =====================================================
   RECENTER BUTTON
===================================================== */

.recenter-btn {
  position: absolute;

  right: 18px;
  bottom: 32px;

  z-index: 20;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 44px;
  height: 44px;

  padding: 0;

  border: none;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.96);

  color: #111;

  font-size: 25px;

  cursor: pointer;

  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.32);
}

/* =====================================================
   VIDEO
===================================================== */

#droneVideo {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;

  background: #000;
}

/*
  Transparent layer handles video
  play/pause.

  Bottom 60px remains free for
  native video controls.
*/

.video-click-area {
  position: absolute;

  top: 0;
  left: 0;
  right: 0;

  bottom: 60px;

  z-index: 3;

  cursor: pointer;

  background: transparent;
}

/* =====================================================
   TELEMETRY OVERLAY
===================================================== */

.telemetry-overlay {
  position: absolute;

  left: 50%;
  bottom: 78px;

  transform: translateX(-50%);

  z-index: 4;

  min-width: 320px;

  padding: 11px 18px;

  text-align: center;

  color: #fff;

  background: rgba(0, 0, 0, 0.63);

  border: 1px solid rgba(255, 255, 255, 0.08);

  border-radius: 10px;

  backdrop-filter: blur(7px);

  -webkit-backdrop-filter: blur(7px);

  pointer-events: none;
}

.telemetry-time {
  margin-bottom: 6px;

  font-size: 15px;

  font-weight: 600;
}

.coordinates {
  display: flex;

  justify-content: center;

  gap: 18px;

  font-size: 13px;
}

.telemetry-altitude {
  margin-top: 5px;

  font-size: 12px;

  opacity: 0.9;
}

/* =====================================================
   PLAY / PAUSE INDICATOR
===================================================== */

.play-state {
  position: absolute;

  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%);

  z-index: 5;

  display: flex;

  align-items: center;
  justify-content: center;

  width: 72px;
  height: 72px;

  border-radius: 50%;

  background: rgba(0, 0, 0, 0.58);

  color: white;

  font-size: 28px;

  pointer-events: none;

  opacity: 0;

  transition: opacity 0.18s ease;
}

.play-state.show {
  opacity: 1;
}

/* =====================================================
   DRONE MARKER
===================================================== */

.drone-marker {
  width: 20px;
  height: 20px;

  border-radius: 50%;

  background: white;

  border: 4px solid #111;

  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.5),
    0 3px 10px rgba(0, 0, 0, 0.5);
}

/* =====================================================
   MAPBOX ATTRIBUTION
===================================================== */

/*
  Mapbox attribution must remain available
  when using Mapbox maps.

  We use the compact Mapbox attribution
  control from JavaScript.
*/

.mapboxgl-ctrl-attrib {
  font-size: 10px;
}

/* =====================================================
   RESPONSIVE
===================================================== */

.mapboxgl-ctrl-logo {
  display: none !important;
}
.mapboxgl-ctrl-attrib {
  display: none !important;
}
@media (max-width: 900px) {
  /* =====================================================
     HEADER
  ====================================================== */

  .app-header {
    height: 54px;
    padding: 0 10px;
  }

  .brand {
    gap: 9px;
    min-width: 0;
  }

  .brand-logo {
    max-height: 32px;
    max-width: 40px;
  }

  .header-divider {
    height: 26px;
  }

  .project-title {
    font-size: 14px;
    font-weight: 600;

    line-height: 1.2;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* =====================================================
     MAIN LAYOUT
  ====================================================== */

  .viewer {
    display: flex;
    flex-direction: column;

    width: 100%;

    /*
      Use dynamic viewport height on mobile browsers.
      This reacts to Chrome/Safari browser bars.
    */
    height: calc(100dvh - 54px);

    /*
      Extra protection for iPhone safe area.
    */
    padding-bottom: env(safe-area-inset-bottom);

    overflow: hidden;

    background: #000;
  }

  /* =====================================================
     MAP
  ====================================================== */

  .map-panel {
    width: 100%;

    height: 42%;

    flex: 0 0 42%;

    min-height: 0;
  }

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

  /* =====================================================
     MAP STYLE SWITCHER
  ====================================================== */

  .map-style-switcher {
    top: 8px;
    right: 8px;

    gap: 2px;

    padding: 3px;

    border-radius: 8px;
  }

  .map-style-switcher button {
    padding: 6px 10px;

    font-size: 12px;

    border-radius: 6px;
  }

  /* =====================================================
     RECENTER BUTTON
  ====================================================== */

  .recenter-btn {
    right: 10px;
    bottom: 10px;

    width: 40px;
    height: 40px;

    font-size: 22px;
  }

  /* =====================================================
     VIDEO PANEL
  ====================================================== */

  .video-panel {
    position: relative;

    width: 100%;

    height: 58%;

    flex: 0 0 58%;

    background: #000;

    overflow: hidden;

    display: flex;

    align-items: center;
    justify-content: center;
  }

  /* =====================================================
     VIDEO
  ====================================================== */

  #droneVideo {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;

    background: #000;
  }

  /* =====================================================
     MOBILE VIDEO CONTROLS
  ====================================================== */

  .video-click-area {
    display: none;
  }

  .play-state {
    display: none;
  }

  /* =====================================================
     TELEMETRY
  ====================================================== */

  .telemetry-overlay {
    left: 50%;

    bottom: 58px;

    transform: translateX(-50%);

    min-width: 0;

    width: auto;
    max-width: 90%;

    padding: 5px 10px;

    border-radius: 7px;
  }

  .telemetry-time {
    margin-bottom: 3px;

    font-size: 11px;
  }

  .coordinates {
    gap: 10px;

    font-size: 10px;

    white-space: nowrap;
  }

  /* =====================================================
     MAPBOX CONTROLS
  ====================================================== */

  .mapboxgl-ctrl-bottom-left {
    bottom: 4px;
    left: 4px;
  }

  .mapboxgl-ctrl-bottom-right {
    bottom: 4px;
    right: 4px;
  }
}

/* =====================================================
   SMALL PHONES
===================================================== */

@media (max-width: 480px) {
  /* =====================================================
     HEADER
  ====================================================== */

  .app-header {
    height: 50px;

    padding: 0 9px;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo {
    max-height: 29px;
    max-width: 36px;
  }

  .header-divider {
    height: 23px;
  }

  .project-title {
    font-size: 12.5px;
  }

  /* =====================================================
     MAIN VIEWPORT
  ====================================================== */

  .viewer {
    height: calc(100dvh - 50px);

    padding-bottom: env(safe-area-inset-bottom);
  }

  /* =====================================================
     SMALLER MAP
  ====================================================== */

  .map-panel {
    height: 38%;

    flex: 0 0 38%;
  }

  /* =====================================================
     LARGER VIDEO
  ====================================================== */

  .video-panel {
    height: 62%;

    flex: 0 0 62%;
  }

  /* =====================================================
     MAP CONTROLS
  ====================================================== */

  .map-style-switcher {
    top: 7px;
    right: 7px;
  }

  .map-style-switcher button {
    padding: 6px 8px;

    font-size: 11px;
  }

  .recenter-btn {
    width: 38px;
    height: 38px;

    right: 8px;
    bottom: 8px;

    font-size: 21px;
  }

  /* =====================================================
     VIDEO
  ====================================================== */

  #droneVideo {
    width: 100%;
    height: 100%;

    object-fit: contain;
  }

  .video-click-area {
    display: none;
  }

  .play-state {
    display: none;
  }

  /* =====================================================
     TELEMETRY
  ====================================================== */

  .telemetry-overlay {
    /*
      Keep telemetry above native
      mobile video controls.
    */
    bottom: 62px;

    padding: 4px 8px;

    max-width: 92%;
  }

  .telemetry-time {
    font-size: 10px;

    margin-bottom: 2px;
  }

  .coordinates {
    font-size: 9px;

    gap: 8px;
  }
}
