*{
    margin: 0;
    padding: 0;
    --switch-height: 30px;
    --switch-padding: 4.7px;
    --switch-width: calc((var(--switch-height) * 2) - var(--switch-padding));
    --slider-height: calc(var(--switch-height) - var(--switch-padding));
    --slider-on: calc(var(--switch-height) - var(--switch-padding));
}

@keyframes blinker { 50% { opacity: 0; } }
body, .panSetting{
    max-width: 500px;
    margin: 0 auto;
    height: 100vh;
    font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.2);
}
#header{
    display: flex;
    flex-direction: row;
    padding: 20px 0;
}
#header .title .appbar, .panSetting .title .appbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex-wrap: nowrap; /* Ngăn không cho wrap xuống dòng */
    min-height: 50px;
}
#header .title .appbar h2, .panSetting .title .appbar h2 {
    flex: 1;
    text-align: center;
    margin: 0;
    min-width: 0; /* Cho phép text bị cắt nếu cần */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#header .title .appbar .actions, 
.panSetting .title .appbar .leading, 
.panSetting .title .appbar .actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Không cho phép thu nhỏ */
    min-width: 44px; /* Đảm bảo có đủ không gian để bấm */
}
#header .title .appbar .actions .btn_setting, 
.panSetting .title .appbar .leading .btn_back {
    padding: 8px 12px;
    cursor: pointer;
    border: 1px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    flex-shrink: 0;
}
#header .title .appbar .actions .btn_setting:hover, .panSetting .title .appbar .leading .btn_back:hover{
    border: 1px solid #2196F3;
}
#header .title{
    text-align: center;
    flex: 1;    padding: 0 15px;
}
#header .title .time{
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 10px;
}
#header .title .time span{
    padding-left: 10px;
}
#body .Alert{
    background: #fff;
    padding: 5px 20px;
    margin: 10px 10px;
    border: 1px solid #fe1010;
    border-radius: 10px;
    animation: blinker 1s linear infinite;
}
#body .Alert .Alert_box .title{
    display: flex;
    align-items: center;
}
#body .Alert .Alert_box .title h3, #body .Alert .Alert_box .title i{
    color: #fe1010;
}
#body .Alert .Alert_box .title h3{
    padding-left: 5px;
}
#body .Alert .Alert_box .body{
    padding: 10px 20px;
}
#body .temperature{
    display: flex;
    flex-direction: row;
    background: #fff; 
    padding: 10px 0;
    margin: 0 10px;
    /* border: 1px solid #ccc;  */
    border-radius: 10px;
    box-shadow: 0 3px 10px rgb(0 0 0 / 0.2);
}
#body .temperature .temperature_box{
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: center;
}
#body .temperature .temperature_box .leading{
    padding: 10px 20px;
}
#body .temperature .temperature_box i{
    font-size: 35px;
    color: rgb(248, 188, 77);
}
#body .temperature .temperature_box .title .value{
    font-size: 25px;
    font-weight: bold;
}
#body .temperature .temperature_box .title .des{
    font-size: 16px;
    color: #a3a0a0;
}
#body .device >.title{
    padding: 20px 10px 0px 10px ;
}
#body .device .list_device{
    display: flex;
    flex-wrap: wrap;
}
#body .device .list_device .box{
    width: calc((100% / 2) - 40px);
    padding: 0 10px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.2);
    background: #fff; 
    margin: 10px 10px;
}
#body .device .list_device .box .status{
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px 5px;
    border-bottom: 1px solid #ccc;
}
#body .device .list_device .box .status .leading{
    display: flex;
    justify-content: center;
}
#body .device .list_device .box .status .leading i{
    font-size: 25px;
    padding-right: 10px;
}
.toggle_switch .switch {
    position: relative;
    display: inline-block;
    width: var(--switch-width);
    height: var(--switch-height);
}
.toggle_switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle_switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}
  
.toggle_switch .slider:before {
    position: absolute;
    content: "";
    height: var(--slider-height);
    width: var(--slider-height);
    left: calc(var(--switch-padding) / 2);
    bottom: calc(var(--switch-padding) / 2);
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

.toggle_switch input:checked + .slider {
    background-color: #2196F3;
}

.toggle_switch  input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

.toggle_switch input:checked + .slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
}

/* Rounded sliders */
.toggle_switch .slider.round {
    border-radius: 34px;
}

.toggle_switch .slider.round:before {
    border-radius: 50%;
}
#body .device .list_device .box .info{
    padding: 10px 5px;
}
#body .device .list_device .box .info .title{
    font-weight: bold;
}
#body .device .list_device .box .info .value{
    color: rgb(163, 160, 160);
    font-style: italic;
    padding-top: 5px;
    font-size: 13px;
}
/* Cập nhật CSS cho panSetting với title vừa phải */

.panSetting {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}
 @keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.panSetting>.title {
    height: 70px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #dedede;
    flex-shrink: 0;
    padding: 0 15px;
}

.panSetting>.content {
    flex: 1; /* Chiếm toàn bộ không gian còn lại */
    overflow: auto;
}

.warning-section {
    padding: 20px;
}

.warning-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    color: #d63384;
}

.warning-title i {
    font-size: 20px;
}

.warning-title span {
    font-size: 18px;
    font-weight: 600;
}

.temperature-section {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}
.temperature-section >.title{
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.temperature-title {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.temperature-title i {
    color: #fd7e14;
}

.input-group {
    position: relative;
    margin-top: 15px;
}

.input-label {
    position: absolute;
    left: 16px;
    top: -8px;
    background: white;
    padding: 0 8px;
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    z-index: 1;
}

.temperature_input {
    width: 90%;
    padding: 16px 19px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    color: #495057;
    background: #f8f9fa;
    transition: all 0.3s ease;
    outline: none;
}

.temperature_input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.input-suffix {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-weight: 600;
    font-size: 16px;
}

.save-button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 25px;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.save-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.save-button:active {
    transform: translateY(0);
}

/* Custom scrollbar */
.panSetting .content::-webkit-scrollbar {
    width: 6px;
}

.panSetting .content::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 10px;
}

.panSetting .content::-webkit-scrollbar-thumb {
    background: #c1c8d1;
    border-radius: 10px;
}

.panSetting .content::-webkit-scrollbar-thumb:hover {
    background: #a8b4c1;
}

/* Ẩn spinner trên Chrome, Safari, Edge (Chromium), Opera */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Ẩn spinner trên Firefox */
input[type="number"] {
  -moz-appearance: textfield; /* Firefox cũ */
  appearance: textfield;      /* Chuẩn hiện đại */
}
