
/***** Bootstrap customizations ******/

.dropdown-menu {
    z-index: 9999;
}

.btn-group.disabled .btn img {
    opacity: 0.5;
}

select[multiple] {
    min-height: 180px;
}

/***** Chosen override ******/

.chosen-container-active .chosen-choices {
    border: 1px solid #AAA;
}

.chosen-container .chosen-results .highlighted {
    background-color: #919191;
    background-image: linear-gradient(#919191 20%, #747474 90%);
    color: #fff;
}

.chosen-container .chosen-choices {
    border-radius: 4px;
}

.controls .text-muted{
    display: block;
}

/* Bootstrap style */

.chosen-container .chosen-single {
    background-image: none;
    box-shadow: none;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    font-size: 14px;
    font-weight: normal;
    color: #555555;
    height: 28px;
    line-height: 28px;
    text-align: left;
    vertical-align: middle;
    padding-left: 10px;
    border-radius: 4px;
}

.chosen-container-single .chosen-single div b {
    background-position-y: 5px;
}

/* Fix a Chosen bug, which sets width to 0px when initialized while hidden */
#mainfilter .chosen-container-multi,
#mainform .chosen-container-multi {
    width: 220px !important;
}

.table th, .table td {
    padding: 4px;
    line-height: 25px;
}

/***** Reusables ******/

.autohide {
    opacity: 0.1;
}
.autohide .btn {
    font-size: .7rem;
}
.autohide .bi {
    font-size: .7rem;
}
.autohide.hover {
    opacity: 1;
}

.scrollable {
    overflow-y: auto;
    clear: both;
}


/***** Alerts ******/

#alert-box {
    position: absolute;
    top: 3px;
    left: 50%;
    width: 50%;
    margin: 0 0 0 -25%;
    z-index: 1000;
}

#alert-box li.alert {
    list-style-type: none; margin-bottom: 3px;
}

/**** Navigation bar ****/

#entitylist-dropdown .dropdown-menu {
    position: absolute;
}
#entitylist-dropdown .dropdown-item {
    padding: 0.25rem 1rem;
}

#entitylist-dropdown .dropdown-item {
    display: flex;
    flex: row nowrap;
    justify-content: space-between;
}

#entitylist-dropdown .dropdown-item .entitylist-add-btn {
    margin-left: 1rem;
}

#entitylist-dropdown .dropdown-item.active a {
    color: #FFF;
}

#historylist {
    width: 100%;
}
#historylist .nav-link {
    padding-left: 18px;
    padding-right: 10px;
}
@media (max-width: 767.98px) {
    #historylist .nav-link {
        border-color: white;
    }
}

/**** Layout ****/

.map-panel,
.list-container {
    height: calc(100vh - 65px);
}
@media (max-width: 767px) {
    .map-panel {
        height: 350px;
    }
}

#panelleft {
    padding-left: 0;
}
#panelright {
    padding: 0;
}
#mainmap {
    position: absolute;
    top: 0px;
    bottom: 0px;
    left: 0px;
    right: 0px;
}
#detailmap { height: 100%; }

/* Navbar fixed */

#container {
    padding-top: 60px;
}



/**** Maps ****/

.map-fogged .leaflet-container {
     background-color: #000;
}
.map-fogged .leaflet-tile-pane .leaflet-layer .leaflet-tile-loaded,
.map-fogged .leaflet-tile-pane .leaflet-fade-anim .leaflet-tile {
    opacity: 0.75;
    -webkit-transition: none;
    -moz-transition: none;
    -o-transition: none;
    transition: none;
}

.map-error {
    border: 5px solid red;
}

.leaflet-container .leaflet-control-information {
    font-size: 1.2em;
}

.screenshot-control {
    background-image: url(images/screenshot-control.png);
}

.leaflet-draw.leaflet-control {
    margin-top: 35px;
}

.leaflet-draw.leaflet-control:before{
    content: "";
    position: absolute;
    display: block;
    left: -5px;
    right: -5px;
    top: -5px;
    bottom: -5px;
    border: 1px solid white;
    z-index: -1;
}

.leaflet-control-layers-list {
   max-height: calc( 100vh - 160px );
   overflow-y: auto;
   overflow-x: hidden;
   margin: 0;
}

.leaflet-control-layers input[type="checkbox"] {
    margin: -2px 0 0;
}

.leaflet-control-filelayer .leaflet-bar-part {
    text-align: center;
    margin-bottom: 0px;
}

.leaflet-control-filelayer.leaflet-control-zoom-in {
    background-image: none;
}

.leaflet-control-filelayer i {
    margin-top: 4px;
}


/*
 * Show enumeration values and map icons, only in print mode.
 * (in document export, values will appear too since HTML is put in doc)
 * See https://github.com/makinacorpus/django-mapentity/issues/35
 */
.enumeration-icon, .enumeration-value {
    display: none;
}

body.screamshot .enumeration-icon,
body.screamshot .enumeration-value {
    display: inline-block;
}

.enumeration-icon {
    background-color: #000042 !important;
    text-align: center;
    vertical-align: middle;
    width: 16px !important;
    height: 16px !important;
    margin-left: -8px !important;
    margin-right: -8px !important;
    line-height: 16px;
    font-size: 10px;
    font-weight: bold;
    color: white;
}


/**** Widgets ****/

.axislabel {
    color: blue;
    font-size: 10px;
}

tr.selected-row td {
    /* Button green color #5BB75B */
    background-color: #DF8 !important;
    opacity: 1 !important;
}

.filter-set {
    font-weight: bold;
    color: black !important;
    border: 2px solid black !important;
}

#maphead {
    position: absolute;
    padding-top: 3px;
    text-align: center;
    z-index: 999;
    width: 100%;
}

#maphead .chosen-container {
    max-width: 180px;
    text-align: left;
}

/***** Entity List ******/

#list-panel {
    padding-left: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 40px);
}

@media (min-width: 768px) {
    #list-panel {
        padding-left: 10px;
        height: calc(100vh - 65px);
    }
}

#list-panel .list-title {
    font-size: 1.25rem;
    display: inline;
    margin: 0;
    padding: 0.375rem 0.75rem;
}

@media (min-width: 992px) {
    #list-panel .list-title {
        display: none;
    }
}
#list-panel .table th,
#list-panel .table td {
    padding: 5px;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

#list-panel .table tbody tr.success > td {
    background-color: #75E376;
}

#list-panel .table tbody tr.success > td a {
    color: black;
    font-weight: bold;
    text-decoration: underline;
}


/*** Left menu ***/
#entitylist {
    width: 0;
    position: absolute;
    overflow: hidden;
}

@media (min-width: 768px) {
    #entitylist {
        position: static;
        width: 40px;
        height: auto;
        max-height: calc(100vh - 65px);
        overflow-x: inherit;
        overflow-y: auto;
        flex-shrink: 0;
    }
}

#entitylist .nav-item img {
    opacity: 0.5;
    max-width: 100%;
}

#entitylist .nav-link {
    padding: 0.5rem .5rem;
}

#entitylist .nav-link.active img,
#entitylist .nav-link:hover img {
    opacity: 1.0;
}


/* Datatables customization for filters and pagination */

.table-responsive {
    height: 350px;
    display: flex;
    flex-direction: column;
}
@media (min-width: 768px) {
    .table-responsive {
        flex-grow: 1;
    }
}
.dataTables_wrapper {
    flex-grow: 1;
}

div.dataTables_wrapper div.dataTables_paginate {
    float: right;
}
div.dataTables_wrapper div.dataTables_filter {
    text-align: left;
}
div.dataTables_wrapper div.dataTables_filter input {
    margin-left: 0;
}

#objects-list_filter {
    left: 160px;
}

@media (max-width: 1280px) {
    #objects-list_filter {
        left: 130px;
    }
}


/* Filters popover */

/* Crispy form is displayed but with default classes
 try to override this to make form inline
 */

#filters-panel {
    width: 240px;
    max-width: 480px;
}

#mainfilter {
    background-color: #f5f5f5;
    padding: .5rem;
}

#mainfilter label {
    /* sr-only */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#mainfilter .form-group p {
    margin-bottom: .5rem;
}

#mainfilter .form-group input,
#mainfilter .form-group select {
    width: 100%;
}

#mainfilter select {
    color: #999;
}
#mainfilter select option {
    color: black;
}
#mainfilter select option:first-child {
    color: #999;
}
#mainfilter .actions {
    text-align: right;
    flex-basis: 100%;
}

@media (min-width: 576px) {
    #filters-panel {
        width: 480px;
    }
    #filters-panel .left,
    #filters-panel .right {
        flex-basis: 48%;
    }
    #mainfilter {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: flex-start;
    }
    #mainfilter input[name^=length] {
        width: calc(50% - 1rem);
    }
}

#filters-close {
    position: absolute;
    right: -20px;
    top: -25px;
}

#filters-close a {
    padding: 4px;
    font-size: 20px;
    color: #666;
}

.popover {
    border: 5px solid rgba(0, 0, 0, 0.5);
    font-size: 14px;
    max-width: none;
}

span.filter-info {
    font-weight: bold;
}


/***** Entity detail ******/



.details-panel .download-group {
    margin: .75rem 0;
    text-align: right;
}
.details-panel .details-title {
    margin-left: 64px;
    font-size: 1.25rem;
}
@media (min-width: 992px) {
    .details-panel .nav-tabs {
        margin-left: 50px;
    }
    .details-panel .details-title {
        display: none;
    }
    .details-panel .tabbable {
        padding-left: 30px;
    }
}

.details-panel .tab-content > .tab-pane.active {
    padding: 15px 5px;
}

.details-panel table.blades {
    table-layout: auto;
}

.details-panel .table th {
    width: 40%;
}

.details-panel table.blades th {
    width: auto;
}

.details-panel h3 {
    border-bottom: 1px solid #333333;
}

.details-panel td {
    color: #636363;
}

.details-panel th, .details-panel td {
    border-top: 0px;
    border-bottom: 1px solid #DDDDDD;
}

.details-panel tr.dashed-line td {
    border-bottom: 1px dashed #DDDDDD;
}

.details-panel td ul li {
    list-style: none;
}

.details-panel span.none {
    opacity: 0.4;
}

.details-panel td .autohide {
    float: right;
}

.details-panel td ul {
    margin: 0px;
}

.details-panel td p {  /* Autohide add buttons within <p> */
    margin: 0px;
}

.details-panel .hover {
    background-color: rgba(240, 240, 240, 0.5);
}

.map-panel .leaflet-control-attribution {
    display: none;
}

.map-panel .leaflet-control-information {
    display: block;
}

.map-panel p.nomap {
    color: lightgray;
    font-size: 2em;
    text-align: center;
    margin-top: 2em;
}

#history .btn {
    float: right;
    margin-top: 10px;
}

/* Map capture */

body.screamshot #maphead {
    display: none;
}

body.screamshot .map-fogged .leaflet-tile.leaflet-tile-loaded {
    opacity: 1.0;
}

body.screamshot .leaflet-control {
    display: none;
}

body.screamshot .leaflet-control-scale {
    display: block;
}

body.screamshot .leaflet-control-attribution {
    display: block;
    text-shadow: 1px 0 0 #fff, -1px 0 0 #fff, 0 2px 0 #fff, 0 -2px 0 #fff, 1px 1px #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff;
    background: none;
    font-size: 15px;
    color: black;
}

body.screamshot .leaflet-top.leaflet-left {
    background-image: url(images/compass.svg);
    display: block;
    min-height: 60px;
    min-width: 60px;
    background-size: 60px;
    margin-left: 5px;
    margin-top: 5px;
}

body.screamshot .leaflet-control-scale {
    border: 3px solid black;
    border-top: none;
    box-shadow: 2px 2px 0 white;
    color: black;
    text-shadow: 2px 0 0 #fff, -2px 0 0 #fff, 0 2px 0 #fff, 0 -2px 0 #fff, 1px 1px #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff;
    max-height: 7px;
}

body.screamshot .leaflet-control-scale-line {
    border: none;
    background: none;
    font-size: 15px;
    font-weight: bold;
    overflow: auto;
    margin-top: -12px;
    text-align: center;
}

/***** Entity form ******/

/*
 * Field and labels
 */

.form-panel {
    flex-basis: 100%;
}
.form-panel .scrollable {
    height: calc(100vh - 140px - 1rem);
    padding-bottom: 20px;
}
.form-actions {
    padding: .5rem 0;
}

.form-panel .form-actions {
    background-color: var(--light);
    padding: .5rem 15px;
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
}

label.requiredField {
    font-weight: bold;
}
label.requiredField .asteriskField {
    color: red;
}

/* Overrides crispy styles to have correct horizontal forms in bootstrap4
    (see also in mapentity/forms.py helpers attributes, form should be inline display)
*/
.form-horizontal .form-group.row {
    margin-left: 0;
    margin-right: 0;
}
.form-horizontal .controls {
    flex-grow: 1;
}
.form-horizontal .controls span {
    font-size: .75rem;
}

@media (min-width: 768px) {

    .form-panel .form-horizontal .col-form-label {
        width: 95px;
        flex-shrink: 0;
        text-align: right;
    }
}

@media (min-width: 1280px) {

    .form-panel .form-horizontal .col-form-label {
        width: 140px;
    }
}

.translatable:hover, .form-group:hover {
    background-color: rgba(240, 240, 240, 0.5);
}

/*
 * Form tabs Main/Advanced
 */

.form-horizontal .nav-tabs:first-child {
    margin-left: 80px;
}

.form-panel .nav-tabs:first-child li:first-child {
    margin-left: 100px;
}

@media (max-width: 1280px) {
    .form-panel .nav-tabs:first-child li:first-child {
        margin-left: 22px;
    }
}


/*
 * Multilang pills
 */

.form-panel .translatable .nav {
    margin-bottom: .25rem;
}

.translatable .nav-pills {
    padding-left: 15px;
}

.translatable .nav-link {
    padding: 0.15rem .5rem;
    font-size: small;
}

@media (max-width: 1280px) {

    .translatable .nav-pills {
        margin-left: 100px;
    }
}


/*
 * Inline formsets
 * TODO: when move formset to mapentity use crispy forms
 */
.formset {
    padding: 5px;
}

.formset .form-row {
    border: solid 1px lightgray;
    padding: 5px;
    margin-bottom: .5em;
}

.formset .form-row:last-of-type {
    border: none;
}

.formset .form-row .delete-row {
    flex-basis: 100%;
}
.formset .form-row:last-of-type a.delete-row {
    display: none;
}

.formset .form-row > .form-group {
    padding-right: 5px;
    padding-left: 5px;
    flex-basis: 33%;
    max-width: 33%;
    flex-grow: 1;
}

/* Form layout */

#geomfield .leaflet-container,
#geomfield .form-group,
#geomfield .controls {
    height: calc(100vh - 120px);
    margin-left: 0;
}

#geomfield .controls {
    max-width: 100%;
}

#geomfield .form-group.error .help-block {
    z-index: 1;
    position: absolute;
}

/* Tired of bootstrap ?
TODO: please help;
 */

#geomfield label.col-form-label {
    position: absolute;
    z-index: 2000;
    background-color: rgba(255,255,255,0.7);
    padding: 5px;
    border-radius: 5px;
    top: 9px;
    left: 75px;
    width: auto;
}

.file-attachment-form {
    margin-top: 1.5em;
    padding-left: 1em;
    padding-right: 1em;
    border: solid 1px lightgray;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.file-attachment-form form {
    margin-bottom: 0px;
}
.file-attachment-form .form-actions {
    text-align: right;
    display: flex;
}

/* Form for mobile */
@media (max-width: 767px) {
    .form-panel {
        padding-bottom: 60px;
    }
    .form-panel .scrollable {
            height: auto;
            overflow: inherit;
    }
}

/* Entity icons */

.nav-item .btn-list,
.form-panel,
.details-panel {
    background-repeat: no-repeat;
}
.nav-item .btn-list {
    background-size: 24px auto;
    background-position: left center;
    padding-left: 24px;
}

@media (max-width: 767px) {
    .list-panel,
    .form-panel,
    .details-panel {
        background-size: 64px auto;
    }
}

/* Style language menu */
.dropdown-menu > li > form {
    margin: 0;
}

.dropdown-menu > li > form > button {
    background: none;
    border: none;
    display: block;
    padding: 3px 20px;
    clear: both;
    font-weight: normal;
    line-height: 20px;
    color: #333333;
    white-space: nowrap;
    width: 100%;
    text-align: left;
}

.dropdown-menu > li > form > button:hover,
.dropdown-menu > li > form > button:focus {
    color: #ffffff;
    text-decoration: none;
    background-color: #0081c2;
    background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
    background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
    background-image: -o-linear-gradient(top, #0088cc, #0077b3);
    background-image: linear-gradient(to bottom, #0088cc, #0077b3);
    background-repeat: repeat-x;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);
}

/* Projects */
.dynamic-form .asteriskField {
    display: none;
}
.dynamic-form label.requiredField {
    font-weight: normal;
}
