/* Media query for smaller screens */
@media (max-width: 768px) {
  #updateAssistantModal0,
  #updateAssistantModal1,
  #updateAssistantModal2 {
    overflow-y: auto;
  }
  #quickDeviceListView #BottomContent {
    margin-top: 50px;
    /* Optional: Add hover effect for the SVG icon */
  }
  #quickDeviceListView #BottomContent #TopScroll {
    margin-top: -55px;
    margin-left: 0px;
    width: 110px;
    padding: 20px;
    position: fixed;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-pack: center;
        justify-content: center;
    -ms-flex-align: center;
        align-items: center;
    z-index: 9999;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  #quickDeviceListView #BottomContent #TopScroll svg {
    width: 24px;
    height: 24px;
    --ic-fill: var(--color-text-alt);
    --li-line: var(--color-text-alt);
    --li-state-line: var(--color-text-alt);
  }
  #quickDeviceListView #BottomContent #TopScroll:hover svg {
    --ic-fill: var(--color-button-highlight);
  }
  #quickDeviceListView #BottomContent #BottomScroll {
    bottom: 200px;
    padding: 22px;
    width: 100%;
    margin-left: 22px;
    position: fixed;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-pack: center;
    -ms-flex-align: center;
    align-items: center;
    z-index: 9999;
  }
  #quickDeviceListView #BottomContent #BottomScroll svg {
    width: 24px;
    height: 24px;
    --ic-fill: var(--color-text);
    --li-line: var(--color-text);
    --li-state-line: var(--color-text);
  }
  #quickDeviceListView #BottomContent .scroll-btn:hover {
    background-color: var(--color-button-highlight);
    -ms-transform: translateY(-3px);
        transform: translateY(-3px);
    /* Slight lift effect on hover */
  }
  #quickDeviceListView #BottomContent .scroll-btn:active {
    background-color: var(--color-active-btn);
  }
  #quickDeviceListView #BottomContent .scroll-btn:focus {
    outline: none;
    /* Remove focus outline for a cleaner look */
  }
  #quickDeviceListView .slideUpContent,
  #quickDeviceListView .dotSlideUpContent {
    bottom: 57px;
    position: fixed;
    z-index: 999;
    right: 10px;
    left: 10px;
    width: calc(100% - 20px);
    -ms-transform: translateY(0);
    transform: translateY(0);
    animation: none;
    transition: transform 0.3s ease-out;
  }
  #quickDeviceListView .slideUpContent ul,
  #quickDeviceListView .dotSlideUpContent ul {
    padding-left: 0;
  }
  #quickDeviceListView .slideUpContent li,
  #quickDeviceListView .dotSlideUpContent li {
    width: 100%;
    padding: 10px;
    font-size: 14px;
  }
  #ButtonsLeft {
    margin-block: 92px;
  }
  #showUpdateAssistant {
    float: right;
    margin-right: 10px;
  }
  .groupsPage {
    -ms-flex-direction: row;
        flex-direction: row;
  }
  a {
    margin-left: 0;
    margin-top: 10px;
    margin-bottom: 0;
  }
  #showHelpMenu,
  #showHelpMenuGroups {
    right: 12px;
    top: 58px;
    height: 30px;
    width: 32px;
  }
  .favouriteChart {
    padding: 15px;
    padding-top: 30px;
  }
  #canvas-container {
    max-width: 100%;
    padding: 0px;
  }
  #custom-legend-container {
    font-size: 12px;
    margin-left: 7px;
    margin-top: 1px;
  }
  .legend-item {
    font-size: 12px;
    margin-bottom: 3px;
  }
  .close {
    top: 5px;
    margin-right: 5px;
  }
  #createRoomModal .button-list,
  #createGroupModal .button-list {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: none;
        flex-direction: none;
    -ms-flex-pack: start;
        justify-content: flex-start;
    /* Align buttons to the start (left) */
    -ms-flex-align: start;
        align-items: flex-start;
    /* Align buttons to the start (left) */
    min-width: 100%;
  }
  #createRoomModal .button-list li,
  #createGroupModal .button-list li {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: row;
        flex-direction: row;
    /* Make buttons display in a row */
    -ms-flex-align: center;
        align-items: center;
    margin-bottom: 10px;
    min-width: 100%;
    /* Add some space between each button and text */
  }
  #createRoomModal .button-list li button,
  #createGroupModal .button-list li button {
    margin-top: 5px;
    border: var(--color-text);
    border-bottom: groove;
    padding: 15px 12px;
    border-radius: 0%;
    min-width: 100%;
    /* Make buttons fill out the whole width */
  }
  #createRoomModal .button-list li svg,
  #createGroupModal .button-list li svg {
    margin-right: 5px;
  }
  #deviceValueSettings {
    width: 100vw;
    top: 300px;
    margin-left: 0px;
    right: auto;
    padding: 30px;
    bottom: 17vh;
    font-size: 0.8em;
  }
  #deviceValueSettings .deviceValueWrapper {
    margin-right: 0;
    margin-bottom: 8px;
    /* Space between label and value */
  }
  #deviceValueSettings .saveButton {
    margin-top: 10px;
  }
  #sliderWrapper,
  #sliderWrapperGroupsPage {
    min-height: 300px;
    position: fixed;
    /* Use fixed positioning to keep it centered on the screen */
    left: 50%;
    /* Center horizontally */
    top: 50%;
    /* Center vertically */
    -ms-transform: translate(-50%, -50%) rotate(90deg);
        transform: translate(-50%, -50%) rotate(90deg);
    /* Center and rotate */
    width: 165%;
    max-height: 400px;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
        flex-direction: column;
    /* Align sliders horizontally */
    box-sizing: border-box;
    z-index: 99999;
    /* Ensure it's on top */
  }
  .lightSliderItemView {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
        flex-direction: column;
    /* Stack label, slider, and value vertically */
    -ms-flex-pack: center;
        justify-content: center;
    -ms-flex-align: center;
        align-items: center;
    margin: 15px 0;
    width: auto;
    /* Adjust width of each item to avoid overflow */
  }
  .lightSliderLabel {
    -ms-flex-negative: 0;
    flex-shrink: 0;
  }
  #closeLightSlider {
    top: 10px;
    left: 15px;
  }
  /* Vertical Slider Configuration */
  .lightSlider {
    -webkit-appearance: none;
    /* Remove default styling */
    width: 8px;
    /* Track's width */
    height: 200px;
    /* Set height for vertical slider */
    background: transparent;
    /* Transparent background for the track */
    margin: 10px 15px;
    /* Horizontal margin for spacing between sliders */
    -ms-touch-action: pan-y;
        touch-action: pan-y;
    /* Enable touch dragging on the y-axis */
    -ms-transform: rotate(0deg);
        transform: rotate(0deg);
    /* Keep the slider orientation vertical */
  }
  /* Adjustments for different sliders */
  .lightSlider:nth-of-type(1) {
    background: rgba(0, 0, 255, 0.3);
    /* Blue background for first slider */
  }
  .lightSlider:nth-of-type(2) {
    background: rgba(255, 0, 0, 0.3);
    /* Red background for second slider */
  }
  .lightSlider:nth-of-type(3) {
    background: rgba(0, 255, 0, 0.3);
    /* Green background for third slider */
  }
  .lightSlider:nth-of-type(4) {
    background: rgba(0, 255, 0, 0.3);
    /* Green background for third slider */
  }
  /* Track style for the vertical slider */
  .lightSlider::-webkit-slider-runnable-track {
    height: 100%;
    /* Track height spans the entire slider height */
    background: var(--color-element);
    /* Track color */
    border-radius: 4px;
    /* Rounded edges */
  }
  /* Track style for Firefox */
  .lightSlider::-moz-range-track {
    height: 100%;
    background: var(--color-element);
    border-radius: 4px;
  }
  /* Thumb styles for vertical sliders */
  .lightSlider::-webkit-slider-thumb {
    outline: 1px solid var(--color-text);
    /* Add outline */
    -webkit-appearance: none;
    width: 32px;
    /* Thumb width */
    height: 32px;
    /* Thumb height */
    background: var(--color-button);
    /* Thumb color */
    border-radius: 50%;
    /* Circular thumb */
    cursor: pointer;
  }
  /* Thumb for Firefox */
  .lightSlider::-moz-range-thumb {
    width: 32px;
    outline: 1px solid var(--color-text);
    /* Add outline */
    height: 32px;
    background: var(--color-button);
    border-radius: 50%;
    cursor: pointer;
  }
  /* Values displayed next to the slider */
  .lightSliderValue {
    text-align: center;
    -ms-flex-negative: 0;
        flex-shrink: 0;
  }
  /* Ensuring correct layout for range input slider */
  input[type="range"] {
    -webkit-appearance: none;
    -moz-appearance: none;
         appearance: none;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    outline: none;
  }
  #wrapperThermostat {
    width: 90%;
    max-width: 500px;
    padding: 15px;
  }
  .deviceNameWrapper {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: row;
        flex-direction: row;
    -ms-flex-align: baseline;
        align-items: baseline;
    -ms-flex-pack: center;
        justify-content: center;
    text-align: center;
  }
  .tempButton {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
  }
  .deviceValueSettingsItem {
    -ms-flex-direction: column;
        flex-direction: column;
    -ms-flex-align: start;
        align-items: flex-start;
    padding: 8px 0;
  }
  .deviceValueWrapper {
    margin-right: 0;
    width: 100%;
    margin-bottom: 10px;
  }
  .deviceValue {
    max-width: 100%;
    text-align: left;
  }
  #scanDialogMobile {
    position: fixed;
    bottom: 0px;
    right: 120px;
    padding: 15px;
    background-color: var(--color-bg);
    color: var(--color-text);
    border-radius: 5px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease-in-out, visibility 1s ease-in-out;
    text-align: center;
  }
  #scanDialogMobile.show {
    opacity: 1;
    visibility: visible;
  }
  .dashboard-btn-container {
    margin-top: 5px;
    -ms-flex-pack: end;
        justify-content: flex-end;
    /* Align buttons to the right on smaller screens */
  }
  #quickDeviceListView {
    position: fixed;
    bottom: 0;
    right: 0px;
    padding: 0px;
    left: auto;
    width: 110px;
    height: 100%;
    border-radius: 0;
    -ms-flex-direction: column-reverse;
    flex-direction: column-reverse;
    overflow: hidden;
    transition: transform 0.3s ease-in-out;
  }
  #quickDeviceListView #quickDeviceSensors,
  #quickDeviceListView #quickDeviceBlinds,
  #quickDeviceListView #quickDeviceThermostats,
  #quickDeviceListView #quickDeviceLights {
    display: contents;
  }
  #quickDeviceListView.hideQuickbar {
    -ms-transform: translateX(100px);
        transform: translateX(100px);
  }
  #quickDeviceListView.hideQuickbar #quickDeviceSensors,
  #quickDeviceListView.hideQuickbar #quickDeviceBlinds,
  #quickDeviceListView.hideQuickbar #quickDeviceThermostats,
  #quickDeviceListView.hideQuickbar #quickDeviceLights {
    visibility: hidden;
  }
  #quickDeviceListView.hideQuickbar #quickBarButtonsLeftTop {
    visibility: hidden;
  }
  #quickDeviceListView.collapsed {
    height: 60px;
    border-radius: 8px 0 0 0;
  }
  #quickDeviceListView .header {
    z-index: 1;
  }
  .deviceItemView.quickDevice {
    width: auto;
    /* Allow flexibility for content */
  }
  #quickBarButtonsLeftTop {
    z-index: 99;
    margin-left: -5px;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column-reverse;
        flex-direction: column-reverse;
  }
  #BottomContent {
    display: none;
  }
  #deviceNameField {
    max-width: -webkit-fit-content;
    max-width: -moz-fit-content;
    max-width: fit-content;
  }
  #ButtonsLeftContainer {
    position: fixed;
    z-index: 1000;
  }
  #quickBarButtonsRight {
    position: absolute;
    left: 0px;
    z-index: 9999;
    width: 0;
  }
  #ButtonsRight {
    padding: 0px !important;
  }
  #mainContainer #quickBarButtonsRight {
    position: fixed;
    bottom: 0;
    left: 0px;
    min-width: 110px;
  }
  #quickDeviceSensors li,
  #quickDeviceBlinds li,
  #quickDeviceThermostats li,
  #quickDeviceLights li {
    background-color: var(--color-bg);
    color: var(--color-text);
    width: 100px;
    /* Ensure the list items fill their container */
    box-sizing: border-box;
    /* Ensure padding doesn't affect width calculation */
  }
  #quickBarButtonsRight {
    margin-left: 10px;
  }
  #quickBarButtonsRight #allOffEditBtn,
  #quickBarButtonsRight #toggleOnOff,
  #quickBarButtonsRight #dragLock,
  #quickBarButtonsRight #toggleMoveRoom,
  #quickBarButtonsRight #logMoveDevices {
    max-width: 65px;
  }
  .svg-fill {
    fill: var(--color-text);
  }
  #dragLock.update-toggle {
    background-color: var(--color-bg);
  }
  #QuickBarButtonsTop {
    margin-top: 10px;
    position: absolute;
    bottom: 0;
    left: 10px;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
        flex-direction: column;
    -ms-flex-align: start;
        align-items: flex-start;
    gap: 10px;
    width: 100%;
  }
  #toggleQuickDeviceList {
    width: 100px;
    height: 36px;
    margin-right: 20px;
    background-color: var(--color-active-btn);
    box-shadow: none;
  }
  #quickDeviceListView #BottomContent #ButtonsLeft {
    display: none;
  }
  #quickScanButton {
    position: fixed;
    height: 36px;
    margin-bottom: 50px;
    margin-right: 20px;
  }
  #quickScanButton svg {
    margin-left: 3px;
  }
  #toggleQuickDeviceList {
    -ms-flex-order: 1;
        order: 1;
  }
  #quickScanButton {
    -ms-flex-order: 2;
        order: 2;
  }
  .mobileDeviceToggle {
    -ms-flex-order: 3;
        order: 3;
    margin-right: 20px;
    margin-bottom: 60px;
    display: -ms-grid;
    display: grid;
    bottom: 50px;
    -ms-grid-columns: (1fr)[2];
        grid-template-columns: repeat(2, 1fr);
    -ms-grid-rows: (1fr)[2];
        grid-template-rows: repeat(2, 1fr);
    gap: 5px;
    transition: bottom 0.3s ease;
    height: 100px;
  }
  #quickBarButtonsRight {
    position: fixed;
    bottom: 0px;
    left: 0px;
  }
}
@media (max-width: 768px) and (max-width: 768px) {
  #lightSliderContainer {
    margin-right: -20px;
    max-height: 60vh;
    /* On mobile, set max-height to 60% of the viewport height */
  }
}
@media (max-width: 768px) and (max-height: 600px) {
  #lightSliderContainer {
    max-height: 50vh;
    /* For very small screens, reduce height to 50% of the viewport height */
  }
}
@media (max-width: 768px) and (min-width: 769px) {
  #lightSliderContainer {
    max-height: 350px;
    /* Default height for larger screens */
  }
}
