/** LS Custom TRWT Map Styles **/

body {
    overflow: hidden;
    font-family: "poppins";
}

.trwt-map header,
.trwt-map footer {
    display: none !important
}

#trwt-map {
    padding: 0;
    margin: 0;
    height: 100%;
    width: 100%;
    height: 100vh;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

#map-container {
    height: 100vh;
    width: 100%;
}
.iav-hidden {
    visibility: hidden;
    display: none !important;
}

/** Sidebar **/
#trwt-sidebar {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100%;
    background-color: #ffffff;
    box-shadow: 0 10px 10px 0px rgba(0, 0, 0, 0.5);
    padding: 20px 5px;
    overflow-x: hidden;
    transition: left 0.4s ease;
    z-index: 1005;
}

.sidebar-logo img {
    max-width: 200px !important;
    height: auto !important;
    margin: 0 auto !important;
    display: block;
}

.trwt-sidebar h4 {
    font-size: 26px;
    padding: 0 25px;
    margin: 0 !important;
}

.trwt-sidebar .sidebar-head {
    text-align: center;
    border-bottom: 1px solid #eeeeee;
}

.trwt-sidebar .sidebar-head p {
    padding: 10px 25px;
    font-size: 18px;
    font-family: poppins !important;
    margin-bottom: 15px;
}

.trwt-sidebar .sidebar-head p:last-child {
    text-align: left;
    margin-bottom: 0 !important;
    font-size: 16px !important;
}

.trwt-sidebar::-webkit-scrollbar {
    width: 10px;
}

.trwt-sidebar::-webkit-scrollbar-track {
    background: #055269;
    border-radius: 5px;
}

.trwt-sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #055269, #055269);
    border-radius: 5px;
}

.trwt-sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #055269, #055269);
}

.trwt-sidebar {
    scrollbar-width: thin;
    scrollbar-color: #055269 #f1f1f1;
}

/** Layer Controls **/
#layerControls {
    margin: 20px 0;
}

#layerControls h5 {
    margin: 20px 20px 5px 20px;
}

#layerControls ul {
    list-style: none;
    padding: 0;
}

#layerControls li {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

#layerControls li:hover {
    background: #f5f5f5;
}

#layerControls input {
    margin-right: 10px;
    cursor: pointer;
}

#layerControls label {
    font-size: 16px;
    font-weight: 500;
    font-family: "poppins";
    cursor: pointer;
    color: #333333;
    flex: 1;
    margin-left: 10px !important;
}

/** Sidebar Toggle **/
#toggle-sidebar {
    position: absolute;
    top: 40%;
    left: 0px;
    padding: 5px;
    background-color: #ffffff;
    border-radius: 5px;
    border: 0;
    transform: translateY(-50%);
    box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: left 0.4s ease, opacity 0.4s ease 0.1s;
    z-index: 1001;
}

#toggle-sidebar img {
    display: block;
    width: 25px;
    height: auto;
}

#trwt-sidebar.active {
    left: 0;
}

#trwt-sidebar.active #toggle-sidebar {
    right: -25px;
}

#trwt-sidebar.active + #toggle-sidebar img {
    transform: rotate(180deg);
    transition: transform 0.4s ease;
}

#map-container.sidebar-active #trwt-map {
    width: calc(100% - 350px);
    margin-left: 350px;
}

/** Custom Popup **/
.custom-popup {
    font-family: "poppins", sans-serif;
    position: absolute;
    display: none;
    z-index: 1004;
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -100%);
    width: 300px;
    height: auto;
    max-height: 300px;
    max-width: 300px;
    min-height: 100px;
}

.custom-popup .popup-caret {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

/* .custom-popup .popup-content {
    word-break: break-all;
} */

.custom-popup .popup-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-popup .popup-title img {
    margin-bottom: auto !important;
}

.custom-popup .popup-content h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    color: #333;
}

.custom-popup .popup-content p {
    margin: 5px 0 0;
    font-size: 0.9rem;
    color: #666;
}

.custom-popup .popup-content .popup-link-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    width: 100%;
    gap: 10px;
}

.custom-popup .popup-content a.popup-link {
    display: inline-block;
    background: #1C244B;
    color: white;
    border-radius: 3px;
    padding: 10px;
    line-height: 1;
    width: 100%;
    text-align: center;
    font-size: 0.9rem;
}

.custom-popup .popup-content .popup-img {
    max-width: 100%;
    max-height: 170px;
    border-radius: 5px;
}

/** Legend & Zoom **/
.trwt-legend {
    max-width: 450px;
    height: auto !important;
    box-shadow: none !important;
}

.trwt-legend.top-right-legend {
    max-width: 300px;
    box-shadow: none !important;
}

.trwt-legend.bottom-left-legend {
    min-width: 450px;
	margin-right: 0 !important
}

.legend-label {
    font-weight: bold;
    font-size: 14px;
}

.legend-label span {
    padding: 5px 10px;
    display: inline-block;
    background-color: white;
    border-radius: 5px;
    margin-bottom: 10px;
    color: #000;
    border: 1px solid #666666;
    margin-bottom: 5px;
}

.legend-label.active span {
    margin-bottom: 10px !important;
}

.legend-label span img {
    width: 15px;
    height: 15px;
    margin-left: 5px;
    transform: rotate(180deg);
    transition: transform 0.4s ease;
}

.legend-label.active span img {
    transform: rotate(0deg);
    transition: transform 0.4s ease;
}

.admin-bar .esri-ui-bottom-right {
    bottom: 20px !important;
    right: 10px !important;
}

.admin-bar .esri-ui-bottom-left {
    bottom: 10px !important;
}

.trwt-map .esri-ui-bottom-right {
    bottom: 10px !important;
    right: 5px !important;
}

.trwt-map .esri-ui-bottom-left {
    transition: left 0.4s ease !important
}

.top-right-legend .legend-label {
    text-align: right;
}

.lang a span, .lang a {
    text-decoration: none;
}

.lang.es a span {
    /* keep the span’s height/flow but make its text invisible */
    color: transparent!important;
    position: relative;
}

.lang.es a span::before {
    /* absolutely position new text exactly over the old */
    content: "Español";
    position: absolute;
    top: 0;
    left: 0;
    /* inherit the line-height/font-size/etc so it matches */
    font: inherit;
    color: #333333;
}

/** RESPONSIVE **/

@media screen and (max-width: 1440px) {
    #trwt-map {
        min-height: 100% !important;
    }
}

@media screen and (max-width: 1200px) {
    .trwt-legend.bottom-left-legend {
        min-width: 300px;
    }
    .trwt-legend.top-right-legend {
        max-width: 300px;
    }
    .legend-label {
        font-size: 14px;
    }

    .legend-label span img {
        width: 10px;
        height: 10px;
    }
}

@media screen and (max-width: 768px) {
    body {
        overflow: scroll !important;
    }
    .trwt-legend.bottom-left-legend {
        min-width: 250px;
    }
    .trwt-legend.top-right-legend {
        max-width: 200px;
    }
}

/** CHECKBOX STYLE **/

@supports (-webkit-appearance: none) or (-moz-appearance: none) {
    #layerControls input[type=checkbox] {
      --active: #055269;
      --active-inner: #fff;
      --focus: 2px #055269;
      --border: #BBC1E1;
      --border-hover: #055269;
      --background: #fff;
      --disabled: #F6F8FF;
      --disabled-inner: #E1E6F9;
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      height: 21px;
      width: 21px;
      outline: none;
      position: relative;
      margin: 0;
      cursor: pointer;
      border-radius: 7px;
      border: 1px solid var(--bc, var(--border));
      background: var(--b, var(--background));
      transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;
    }

    #layerControls input[type=checkbox]:after {
      content: "";
      position: absolute;
      width: 5px;
      height: 9px;
      border: 2px solid var(--active-inner);
      border-top: 0;
      border-left: 0;
      left: 7px;
      top: 4px;
      transform: rotate(var(--r, 20deg));
      opacity: var(--o, 0);
      transition: transform 0.6s cubic-bezier(.2, .85, .32, 1.2), opacity 0.3s;
    }

    #layerControls input[type=checkbox]:checked {
      --b: var(--active);
      --bc: var(--active);
      --r: 43deg;
      --o: 1;
    }

    #layerControls input[type=checkbox]:disabled {
      --b: var(--disabled);
      cursor: not-allowed;
      opacity: 0.9;
    }

    #layerControls input[type=checkbox]:disabled:checked {
      --b: var(--disabled-inner);
      --bc: var(--border);
    }

    #layerControls input[type=checkbox]:hover:not(:checked):not(:disabled) {
      --bc: var(--border-hover);
    }

    #layerControls input[type=checkbox]:focus {
      box-shadow: 0 0 0 var(--focus);
    }

    #layerControls input[type=checkbox] + label {
      cursor: pointer;
      margin-left: 4px;
    }
}
