/* mobile.css */
@media (max-width: 768px) and (pointer: coarse) {

  :root {
    --top-nav-height: 52px;
    --bottom-bar-height: 44px;
    --bottom-bar-margin: 0;

    --safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  html {
    font-size: 12px;
  }

  body {
    overflow-y: hidden;
  }

  /* TopBar */

  .top-bar {
    height: var(--top-nav-height);
    padding: 0 14px;
  }

  .top-bar .menu {
    gap: 8px;
  }

  .top-bar .menu .menu-item {
    padding: 0 6px;
  }

  .top-bar .menu .menu-item .menu-icon {
    height: 22px;
  }

  .top-bar .menu .menu-item .text {
    padding-top: 3px;
    font-size: 0.65em;
    line-height: 1.1;
    white-space: nowrap;
  }

  @supports (height: 100dvh) {
    .leaflet-container {
      height: calc(100dvh - var(--top-nav-height) - var(--bottom-bar-height) - var(--safe-bottom));
    }
  }

  @supports not (height: 100dvh) {
  .leaflet-container {
    height: calc(100vh - var(--top-nav-height) - var(--bottom-bar-height) - var(--safe-bottom));
    }
  }

  /* popup */

  .popup-area {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .popup-area .popup {
    max-height: calc(100vh - var(--top-nav-height) - var(--bottom-bar-height) - 60px);
    display: flex;
    flex-direction: column;
  }

  .popup-area .popup .popup-body {
    max-height: calc(100vh - var(--top-nav-height) - var(--bottom-bar-height) - 130px);
    overflow-y: auto;
    padding-right: 10px;
    -webkit-overflow-scrolling: touch;
  }

  .popup-area .popup .popup-body * {
    max-width: 109%;
  }

  .popup-area .popup .popup-header {
    padding: 5px 10px;
  }

  .popup-area .popup .popup-title {
    font-size: 0.8rem;
  }

  /* Add layers - fullscreen*/
  .popup-area .popup#add-layers {
    position: fixed !important;
    top: var(--top-nav-height) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(var(--bottom-bar-height) + var(--safe-bottom)) !important;

    width: 100vw !important;
    height: calc(100vh - var(--top-nav-height) - var(--bottom-bar-height) - var(--safe-bottom)) !important;

    max-width: 100vw !important;
    max-height: calc(100vh - var(--top-nav-height) - var(--bottom-bar-height) - var(--safe-bottom)) !important;

    margin: 0 !important;
    border-radius: 0 !important;
    z-index: 99999 !important;
  }

  .popup-area .popup#add-layers .popup-header {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .popup-area .popup#add-layers .popup-body {
    height: calc(100% - 40px);
    max-height: none !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 10px;
  }

  /* add layers */

  .add-layers .sub-menu {
    gap: 2px;
    margin-bottom: 4px;
  }

  .popup-area .popup#add-layers {
    max-width: 100vw;
    width: 100vw;
    flex: 0 0 auto;
  }

  .add-layers .sub-menu .sub-menu-button {
    padding: 3px 5px;
    margin: 2px;
    font-size: 0.8rem;
  }

  .add-layers .sub-menu-content-container {
    padding: 4px 14px;
    margin: 3px 3px 3px -12px;
    width: calc(100% + 20px);
  }

  .add-layers .gallery-content .gallery-item {
    padding: 3px 6px;
    min-width: 50px;
    min-height: 50px;
  }

  .add-layers .gallery-content .gallery-item .gallery-item-map {
    width: 64px;
    height: 42px;
  }

  .add-layers .gallery-content .gallery-item .gallery-item-icon {
    width: 30px;
    height: 30px;
  }

  .add-layers .pills-container .pill-type {
    padding: 3px 6px;
  }

  .add-layers .layers-titlebar {
    padding: 1px 35px 1px 4px;
  }

  .add-layers .layers .dataset {
    margin: 6px 0;
  }

  .add-layers .layers .dataset .layer {
    padding: 2px 0;
  }

  .add-layers .layers .layer .layer-label {
    font-size: 0.7rem;
    white-space: normal;
  }

  .no-layers-add-layers {
    font-size: 0.74rem;
    padding: 5px;
  }

  .add-layers .layers .layer .layer-icon,
  .add-layers .layers .layer .layer-info,
  .add-layers .layers .layer .layer-streamline,
  .add-layers .layers .layer .layer-historical {
    width: 12px;
    height: 12px;
  }

  .add-layers .layers .layer .layer-checkbox-plus-icon,
  .add-layers .layers .layer .layer-checkbox-minus-icon {
    margin-top: -3px;
    width: 12px;
    height: 12px;
  }

  /* Collapse/Expand all button*/
  .add-layers .collapse-all-button {
    padding: 2px 6px;
    gap: 6px;
    font-size: 9px;
  }

  .add-layers .collapse-all-icon {
    width: 12px;
    height: 8px;
  }

  /* Active layers (somente reduzido, NÃO fullscreen) */

  .active-layers .clear-layers .clear-layers-button {
    padding: 2px 4px;
    gap: 3px;
  }

  .active-layers .clear-layers .clear-layers-button span {
    font-size: 9px;
  }

  .active-layer {
    padding: 5px 0;
    gap: 3px;
    flex-wrap: wrap;
  }

  .active-layer .active-layer-left-content {
    gap: 2px;
    max-width: 58%;
    flex-wrap: wrap;
  }

  .active-layer .active-layer-left-content span {
    white-space: normal;
  }

  .active-layer .active-layer-left-content-container .active-layer-dataset-content {
    font-size: 0.65rem;
  }

  .active-layer .active-layer-right-content {
    gap: 13px;
    min-width: 45px;
  }

  .active-layer .active-layer-close {
    width: 14px;
    height: 14px;
  }

  .active-layer-color-icon {
    width: 13px;
    height: 7px;
    margin-top: -28px;
    margin-left: 80px;
  }

  .active-layer .active-layer-right-content .active-layer-legend-container .active-layer-legend-values .active-layer-legend-value {
    font-size: 8px;
    margin-inline: -6px;
  }

  .active-layer .active-layer-right-content .active-layer-legend-container .active-layer-legend-values {
    margin: -13px -12px 0px 0px;
  }
  .active-layer .active-layer-right-content .active-layer-legend-container.trajectory-legend .active-layer-legend-values {
    margin: 0px -12px 0px 0px;
  }

  .active-layer .active-layer-details {
    padding: 10px;
    margin-right: 10px;
  }

  .active-layer .active-layer-details-content {
    padding-right: 8px;
  }

  .active-layer .active-layer-details-label {
    font-size: 0.7rem;
  }

  .active-layer .active-layer-tools .icon {
    width: 14px;
    height: 14px;
  }

  .active-layer .active-layer-color-range .active-layer-color-range-auto {
    padding: 1px 4px;
    font-size: 6px;
  }

  .active-layer-slider-labels {
    font-size: 8px;
    margin-top: 4px;
  }

  .active-layer-legend-name {
    font-size: 9px;
  }

  .active-layer .active-layer-palettes-label,
  .active-layer .active-layer-tool-label,
  .active-layer .active-layer-color-schemes .scheme-label {
    font-size: 0.5rem;
  }

  .active-layer .active-layer-color-schemes .scheme {
    padding: 1px 3px;
    font-size: 0.48rem;
  }

  .active-layer .active-layer-color-range .active-layer-color-range-input {
    width: 20px;
    font-size: 7px;
    padding: 1px 1px;
  }

  .active-layer .active-layer-legend-container .active-layer-legend-value {
    font-size: 6px;
  }

  .active-layer .active-layer-palettes-body {
    gap: 2px;
  }

  .active-layer-color-scheme .active-layer-color-scheme-part  {
    width: 13px;
    height: 10px;
  }

  .active-layer .active-layer-legend {
    padding: 1px 2px;
  }

  .active-layer .active-layer-legend img:not(.active-layer-palettes-icon) {
    height: 8px !important;
    max-width: 100%;
  }

  .active-layer .active-layer-legend .active-layer-palettes-icon {
    width: 15px;
    height: 6px;
    margin-left: 3px;
    margin-top: -1px;
  }

  .active-layer .active-layer-right-content .active-layer-legend-container .active-layer-legend-div {
    width: 85px;
  }

  .active-layer .toggle-switch {
    transform: scale(0.85);
    transform-origin: left center;
  }

  .active-layer .active-layer-tools {
    margin: auto;
    gap: 5px;
  }

  .active-layer .toggle-switch .slider {
    height: 10px;
  }

  .active-layer .toggle-switch .slider:before {
    width: 10px;
    height: 10px;
  }

  /* Leaflet controls */

  .leaflet-control.custom-control {
    padding: 3px;
    transform: scale(0.9);
    transform-origin: top right;
  }

  .leaflet-control.custom-control .leaflet-bar a,
  .leaflet-control.custom-control .leaflet-bar button {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }

  .leaflet-control .zoom-control .leaflet-bar.leaflet-bar a {
    height: 16px;
    width: 16px;
    font-size: 13px;
    line-height: 16px;
  }

  .leaflet-control-scale-line {
    padding: 4px 3px 1px;
    font-size: 10px;
  }

  /* Popup close button */

  .popup-area .popup .popup-close {
    width: 14px;
    height: 14px;
  }

  /* Bottom bar */

  .bottom-bar {
    height: calc(var(--bottom-bar-height) + var(--safe-bottom));
    padding: 0 14px var(--safe-bottom) 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background-color: var(--color-g-050);
  }

  .bottom-bar .player {
    display: flex;
    gap: 8px;
  }

  .bottom-bar .player img {
    max-height: 9px;
    display: block;
  }

  .bottom-bar .player .player-button .player-text {
    font-size: 9px;
    color: var(--color-g-450);
    white-space: nowrap;
  }

  .bottom-bar .slider-container {
    width: 46%;
    margin-left: var(--bottom-bar-margin);
  }

  .bottom-bar .slider-container .slider-label output {
    width: 24px;
    font-size: 8px;
  }

  .bottom-bar .slider-container .slider-indicators {
    margin: -10px -6px 0 -5px;
  }

  .bottom-bar .slider-container .slider-indicators .slider-indicator {
    width: 13px;
    height: 8px;
    font-size: 8px;
  }

  .bottom-bar .calendar {
    gap: 6px;
    margin: 2px;
    font-size: 11px;
    min-width: 0;
    flex: 0 1 auto;
  }

  .bottom-bar .calendar .calendar-text {
    width: 150px;
  }

  .bottom-bar .location {
    margin: 2px;
    font-size: 9px;
    width: 160px;
    min-width: 0;
  }

  .bottom-bar .location .current-location {
    width: 14px;
    height: 14px;
    filter: var(--primary-filter);
    cursor: pointer;
  }

  /* Popup*/
  .popup-area .popup#base-layers {
    left: 8px;
    bottom: calc(var(--bottom-bar-height, 0px) + var(--safe-bottom) + 12px);
    min-width: 0;
  }

  .base-layers.base-layers-shell {
    padding: 3px 3px;
    border-radius: 6px;
  }

  .base-layers.base-layers-shell .base-layers-panel {
    gap: 8px;
  }

  .base-layers.base-layers-shell:hover .base-layers-panel,
  .base-layers.base-layers-shell:focus-within .base-layers-panel {
    overflow-x: auto;
  }

  .base-layers .base-layer-item {
    padding: 0px;
    min-width: 58px;
    min-height: 58px;
    border-radius: 6px;
  }

  .base-layers .base-layer-item .base-layer-item-minimap {
    width: 56px;
    height: 36px;
    margin: 0 auto 2px auto;
  }

  .base-layers .base-layer-item .base-layer-item-text {
    font-size: 8px;
    line-height: 9px;
    max-width: 60px;
  }

  .base-layers .base-layers-panel::-webkit-scrollbar {
    height: 6px;
  }

  .base-layers .base-layers-panel::-webkit-scrollbar-track {
    background: transparent;
  }

  .popup-area .popup .popup-header .popup-title {
    font-size: 13px;
  }

  #base-layers .row.row-cols-2>.col-auto {
    padding: 3px 3px;
  }

  #base-layers .base-layer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  #base-layers .base-layer-item-minimap {
    width: 56px;
    height: 36px;
    margin: 0 auto 2px auto;
  }

  #base-layers .base-layer-item-text {
    font-size: 8px;
    line-height: 9px;
    padding: 0 2px 2px;
    white-space: normal;
  }

}

/* Bottom bar */
@media (max-width: 380px) and (pointer: coarse) {

  :root {
    --bottom-bar-height: 44px;
  }

  .bottom-bar {
    padding: 0 10px var(--safe-bottom) 10px;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .bottom-bar .player {
    gap: 6px;
  }

  .bottom-bar .player .player-button .player-text {
    display: none;
  }

  .bottom-bar .slider-container {
    width: auto;
    flex: 1 1 auto;
    min-width: 120px;
    margin-left: 0;
  }

  .bottom-bar .slider-container .slider-indicators {
    display: none;
  }

  .bottom-bar .calendar {
    margin: 0;
    font-size: 10px;
    min-width: 0;
  }

  .bottom-bar .calendar .calendar-text {
    width: auto;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-bar .location {
    margin: 0;
    font-size: 9px;
    width: auto;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-bar .location .location-text {
    display: none;
  }

  .bottom-bar .location .current-location {
    width: 16px;
    height: 16px;
  }

}
