/* #### Mobile Phones Portrait #### */
@media screen and (max-device-width: 480px) and (orientation: portrait){
  /* some CSS here */
}

/* #### Mobile Phones Landscape #### */
@media screen and (max-device-width: 640px) and (orientation: landscape){
  /* some CSS here */
}

/* #### Mobile Phones Portrait or Landscape #### */
@media screen and (max-device-width: 480px){
  #search-query{
    width: 85px;
  }

  #search-query{
    padding-left: 8px;
    padding-right: 8px;
    transition: all .5s;
  }

  #search-query:focus{
    width: 206px;
  }

  /* Adapt form */
  #dock .form-horizontal .controls, div.modal .form-horizontal .controls {
    margin-left: 10px;
  }

  #edition #edition-point-coord-form-group.jforms-table-group {
    padding-left: 5px;
  }

  #edition-point-coord-form-group .control-group label.control-label{
    width: 80px;
    display: inline-block;
  }

  #edition-point-coord-form-group .control-group div {
    display: inline-block;
    text-align: right;
  }

  #edition-point-coord-form-group .control-group input.jforms-ctrl-input{
    width: 85px;
  }

  #edition-point-coord-form-group .control-group select {
    width: auto;
  }

  lizmap-geolocation-survey .control-group > div:first-child{
    width: 80px;
  }

  lizmap-geolocation-survey input.input-mini{
    width: 40px;
  }

  /* snap panel */
  #edition-point-coord-form-group .control-group div.snap-panel-controls {
    display:flex;
    flex-direction: column;
    margin: 10px;
    text-align: left;
  }
  #edition-point-coord-form-group .control-group div.snap-layers-list {
    overflow: auto;
    display: flex;
    flex-direction: column;
    text-align: left;
  }

  #edition-point-coord-form-group .control-group div.snap-layer {
    text-align: left;
    display: flex;
  }
}
@media screen and (max-device-width: 640px){
  #attributeLayers-tabs > li > a {
    padding: 2px;
  }

  /* Hide text for login links */
  #headermenu.mobile #auth ul.nav a span.text {
    display:none;
  }
}

/* #### Retina screen (iphone4, samsung note, etc.) Portrait or Landscape #### */
@media
only screen and (        min-device-pixel-ratio: 2),
only screen and (                min-resolution: 192dpi),
only screen and (                min-resolution: 2dppx),
only screen and (                   max-height : 640px) ,
only screen and (                   max-device-height : 640px) {

  /* Retina-specific stuff here */
  body{
    padding-top : 60px;
  }
  #header {
    height : 30px;
  }
    .jacl2-list.jacl2-list-sticky-heads thead,
    .jacl2-list-user.jacl2-list-sticky-heads thead
    {
        top: 35px;
    }
  #logo {
    height : 30px;
    margin: 0px 5px;
    min-width:30px;
  }
  #logo h1 {
    font-size : 1.5em;
    margin-left: 10px;
    margin: 5px 5px;
    line-height: 20px;
  }
  #title{
    height : 30px;
    margin : 0px 5px;
    padding-right:5px;
  }
  #title h1 {
    margin : 0px 5px;
    font-size : 1.5em;
    line-height: 30px;
  }
  #headermenu{
    height:30px;
    position: fixed;
    top: 0px;
    padding-right: 20px;
  }
  #headermenu.mobile #auth form#nominatim-search {
    position:absolute;
    right:50px;
    top:30px;
  }
  #headermenu.mobile #auth ul.nav {
    position: absolute;
    left:auto;
    right: 0px;
  }
  #headermenu.mobile .btn-locate-clear.icon {
  background-color: transparent;
  background-position: -850px 0px;
  margin-top: 3px;
  }

  .navbar-inner {
    min-height:30px;
    padding: 0px 10px;
  }

  #search{
    top: 30px;
  }

  /*  for ie*/
  .navbar-inner ul li{
    display:inline\9;
  }

  #overview-box {
    right:10px;
    bottom:40px;
  }

  #bottom-dock  {
    opacity: 1;
  }
}

/* #### Tablets Portrait or Landscape #### */
@media screen and (min-device-width: 768px) and (max-device-width: 1024px){
  /* some CSS here */
}

/* #### Desktops #### */
@media screen and (min-width: 1024px){
  /* some CSS here */
}

@media screen and (max-width: 900px), screen and (max-height: 400px){
  #navbar .slider{
    display: none;
  }
}
/* smartphones, touchscreens */
@media (pointer: coarse) {
  #navbar button.btn{
    height : 40px;
    width : 40px;
    margin-bottom: 0.3em;
  }

  #navbar .btn.pan {
  background-position : 5px -25px;
  }
  #navbar .btn.zoom {
    background-position : -25px -25px;
  }
  #navbar .btn.zoom-extent {
    background-position : -25px -55px;
  }
  #navbar .btn.zoom-out {
    background-position : -25px 5px;
  }
  #navbar .btn.zoom-in {
    background-position : 5px 5px;
  }

  #navbar div.slider{
    margin-left: 18px;
  }

  #navbar .history button.btn{
    width: 20px;
  }

  #navbar .btn.previous, #navbar .btn.next{
    background-position-y: -87px;
  }

  #navbar .btn.previous.disabled{
    background-position-y: -117px;
  }

  #navbar .btn.next.disabled{
    background-position-y: -116px;
  }

  #navbar .btn.next, #navbar .btn.next.disabled{
    background-position-x: -39px;
  }

  #headermenu.mobile #auth form#nominatim-search{
    right: 65px;
  }

  #mapmenu{
    z-index: 5001;
    width: 80%;
    left: -80%;
    transition: left 0.3s cubic-bezier(0.77,0.2,0.05,1.0);
  }

  #mapmenu > div{
    width: unset;
    display: flex;
    top: 45px;
  }

  #mapmenu > div > ul{
    margin: 0 7px;
    width: 100%;
    background-color: #F0F0F0;
  }

  #mapmenu > div > ul li{
    background: #444444;
    border-radius: 6px;
    margin-top: 10px;
    padding-left: 15px;
  }

  #mapmenu > div > ul li.active{
    background-color: #006dcc;
  }

  #mapmenu > div > ul li:last-child{
    margin-bottom: 15px;
  }

  #mapmenu .nav-list > li > a{
    width: unset;
    text-align: left;
    font-size: 1.2em;
    color: white;
    padding: .5em;
  }

  #mapmenu .nav-list > li.active > a{
    background-color: initial;
  }

  #mapmenu .menu-title{
    display: inline-block;
    margin-left: 10px;
    text-transform: capitalize;
  }

  #map-content{
    margin-left: 0;
  }

  #content #dock{
    background-color: #4A4A4A;
  }

  #docks-wrapper{
    left: -1px;
    width: 100%;
    box-sizing: border-box;
  }

  #bottom-dock{
    border-left: 0;
  }

  #menuToggle.opened ~ #mapmenu{
    left: 0;
  }

  #menuToggle{
    display: block;
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 9000;
    -webkit-user-select: none;
    user-select: none;
    padding: 7px;
    border-radius: 8px;
    background: #3a3c3d;
    transition: padding 0.3s cubic-bezier(0.77,0.2,0.05,1.0);
  }

  #menuToggle span{
    display: block;
    width: 33px;
    height: 4px;
    margin-bottom: 5px;
    position: relative;
    background: white;
    border-radius: 3px;
    z-index: 1;
    transform-origin: 4px 0px;
    transition: transform 0.3s cubic-bezier(0.77,0.2,0.05,1.0);
  }

  #menuToggle span:first-child{
    transform-origin: 0% 0%;
  }

  #menuToggle span:nth-last-child(2){
    transform-origin: 0% 100%;
  }

  #menuToggle span:last-child{
    margin-bottom: 0;
  }

  #menuToggle.opened{
    padding-right: 2px;
  }

  /* Transform all the slices of hamburger into a crossmark. */
  #menuToggle.opened span{
    opacity: 1;
    transform: rotate(45deg) translate(0px, -5px);
  }

  /* Hide the middle one */
  #menuToggle.opened span:nth-child(2){
    opacity: 0;
    transform: rotate(0deg) scale(0.2, 0.2);
  }

  /* The last one should go the other direction */
  #menuToggle.opened span:nth-child(3){
    transform: rotate(-45deg) translate(0, -1px);
  }

  #content.mobile #mini-dock{
    left: 0;
  }

  /* Overload dock icons. TODO : change sprite with SVG */
  #mapmenu .nav-list > li.home.active .icon {
  background-position: -25px 0px;
  }
  #mapmenu .nav-list > li.projects.active .icon {
    background-position: -925px 0px;
  }
  #mapmenu .nav-list > li.metadata.active .icon {
    background-position: -125px 0px;
  }
  #mapmenu .nav-list > li.switcher.active .icon {
    background-position: -75px 0px;
  }
  #mapmenu .nav-list > li.legend.active .icon {
    background-position: -75px 0px;
  }
  #mapmenu .nav-list > li.locate.active .icon {
    background-position: -175px 0px;
  }
  #mapmenu .nav-list > li.print.active .icon {
    background-position: -375px 0px;
  }
  #mapmenu .nav-list > li.measure.active .icon {
    background-position: -275px 0px;
  }
  #mapmenu .nav-list > li.edition.active .icon {
    background-position: -475px 0px;
  }
  #mapmenu .nav-list > li.geolocation.active .icon {
    background-position: -325px 0px;
  }
  #mapmenu .nav-list > li.attributeLayers.active .icon {
    background-position: -525px 0px;
  }
  #mapmenu .nav-list > li.permaLink.active .icon {
    background-position: -675px 0px;
  }
  #mapmenu .nav-list > li.tooltip-layer.active .icon {
    background-position: -775px 0px;
  }
  #mapmenu .nav-list > li.timemanager.active .icon {
    background-position: -625px 0px;
  }

  .nav .active > a .icon-white, .nav li > a:hover .icon-white, .nav li > a:focus .icon-white {
    background-image: url(images/glyphicons-halflings-white.png);
  }

  #dock{
    margin-top: 45px;
  }

  .digitizing .btn {
    width: 50px;
    height: 50px;
    box-sizing: border-box;
    padding: 12px;
  }

  lizmap-treeview .icon-info-sign {
    display: block;
  }

  .tooltip-layer {
    display: none;
  }
}

@media (pointer: coarse) and (orientation: portrait){
  #docks-wrapper{
    flex-direction: column;
  }
  #sub-dock{
    width: 100%;
  }
}
