html, body {
    overscroll-behavior-y: none;  /* no "pull-to-refresh on mobile */
    min-height: 100%;
}

body {
    -webkit-overflow-scrolling: touch;  
    font-family: Arial, sans-serif;
}


.hidden {
  display: none !important;
}


.topbar {
  position: sticky;
  top: 0;
  z-index: 9999;
  margin-top: -20px;
  display: flex;
  align-items: center;
  height: 56px;
  background: #046363;
  color: #fff;
  padding: 0 12px;
}

.hamburger {
  display: none;
  font-size: 22px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
}

.device-title {
  margin: 0 auto;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;        /* nincs sortörés */
  overflow-x: auto;           /* vízszintes scroll */
  overflow-y: hidden;
  max-width: 100%;
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* IE/Edge legacy */
  touch-action: pan-x;        /* mobilon oldalra húzható */
}

.device-title::-webkit-scrollbar {
    display: none;              /* Chrome / Android */
}

.device-id {
  opacity: 0.7;
  margin-left: 4px;
}

.menu {
  list-style: none;
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
}

.menu a {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 14px;
}

.menu a:hover {
  text-decoration: underline;
}

.menu a.active {
  color: #fff;
  font-weight: 600;
  border-bottom: 2px solid #3b82f6;
}

.separator {
  width: 2px;
  background: #a4a7ac;
}

.user-menu {
  position: relative;
  margin-left: auto;
}

.user-button {
  font-size: 16px;
  cursor: pointer;
  padding: 5px 5px;
  border-radius: 6px;
  border: none;
  width: 100px;
}
.user-button::before {
  content: "👤";
  color: transparent;
  text-shadow: 0 0 0 #000000;
  margin-right: 8px;
  /*vertical-align: middle; /* Hozzáigazítja az ikon közepét a szöveghez */
  font-size: 16px;       /* Szükség esetén finomhangolhatod a méretét */
}


.user-dropdown {
  position: absolute;
  right: 0;
  top: 36px;
  background: #046363;
  list-style: none;
  padding: 8px;
  margin: 0;
  min-width: 160px;
  border-radius: 6px;
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

.user-dropdown.open {
  display: block;
}

.user-dropdown li {
  padding: 6px 8px;
  font-size: 14px;
}

.user-dropdown a {
  color: #e5e7eb;
  text-decoration: none;
  display: block;
}

.user-dropdown a:hover {
  background: #0ecece;
  border-radius: 2px;
}

.user-name {
  font-size: 12px;
}

.divider {
  border-top: 2px solid rgb(14, 170, 162);
  margin: 6px 0;
}



@media (max-width: 768px) {
  .hamburger {
    display: block;
  }

  .menu {
    position: absolute;
    top: 72px;
    left: 0;
    width: 100px;
    height: 160;
    background: #046363;
    flex-direction: column;
    padding: 12px;
    transform: translateX(-108%);
    transition: transform 0.25s ease;
  }

  .menu.open {
    transform: translateX(0);
  }

  .menu li {
    margin-bottom: 8px;
  }

  .menu a.active {
    border-bottom: none;
    background: #0ba5a5;
    border-radius: 4px;
    padding: 6px 8px;
  }	

  .separator {
    height: 2px;
    width: 100%;
    margin: 8px 0;
  }
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.devices-grid > div:first-child {      /* select first card */
  grid-column: 1 / -1;                 /* from first to last coloumn */  grid-column: 1 / -1;                 /* from first to last coloumn */
 }

 .banner {
  padding:1cap;
  border-radius: 12px;
  background-color: #f8d4055c;
  text-align: center;
  font-weight: bold; 
}

.card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    text-align:center;
    box-shadow: 2px 2px 12px 1px rgba(140,140,140,.5);
}
.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.subcard {
  max-width: 500px;
  margin:0 auto;  
  border-radius: 12px;
  padding: 4px;
  text-align:center;
  box-shadow: 2px 2px 12px 1px rgba(140,140,140,.5);
}

.subcard:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mail {
  text-align:right;
  margin-left: 0;
  font-size:20px;
}

.mail-toggle {
  display: none;
}

.mail::before {
  font-size:12px;
  margin-right: 0;
  content: "email";
  position:relative;
  right: -33px;
  top:-20px;
  color:#97690c;
  }
  
.device-name {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 8px;
}
.device-id {
    font-family: monospace;
    color: #666;
}
.last-seen {
    margin-top: 8px;
    color: #555;
    font-size: 0.9em;
}
.status {
    font-weight: bold;
    margin-top: 4px;
}
.status.online { color: green; }
.status.offline { color: red; }

.delete-btn {
    background: #d9534f;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    width: 75%;
    font-size: 14px;
}

.delete-btn:hover {
    background: #c9302c;
}

.select-btn {
    background: #0c812f;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    width: 75%;
    font-size: 14px;
}

.select-btn:hover {
    background: #13a81b;
}


.zones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 56px;
}

.zones-grid > div:first-child {      /* select first card */
  grid-column: 1 / -1;                 /* from first to last coloumn */  grid-column: 1 / -1;                 /* from first to last coloumn */
}

.zone-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    text-align:center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.zone-card:hover {
    transform: translateY(-0px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.16);
}

.zone-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.zone-info-line {
    font-size: 14px;
    margin: 4px 0;
}

.zone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.zone-status {
    font-size: 0.9em;
    display: flex;
    align-items: center;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.power-bar {
    width: 100%;
    height: 12px;
    background: #ddd;
    border-radius: 6px;
    overflow: hidden;
    margin-top: -6px;
    margin-bottom: 12px;
}

.power-bar-fill {
    height: 100%;
    width: 0%; /* start */
    transition: width 0.5s ease-in-out, background-color 0.5s ease;
}



/* ---------- MODAL ---------- */

/* Overlay */
.overlay {
    position: fixed;
    inset: 0;
    height: 100dvh;
    background: rgba(0,0,0,0.4);
    height: 100dvh; /* important for mobile */
    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Modal box */
.modal {
    background: white;
    border-radius: 12px;
    padding: 16px;
    width: min(90%, 400px);
}

/* Scroll lock 
body.modal-open {
    overflow: hidden;
    touch-action: none;
}*/

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1rem;
}

button.danger {
    background: #ff0000;
    border-radius: 6px;
    border: 0;
    color: #fff;
    cursor: pointer;
}

button.info {
    background: #0bb313;
    border-radius: 6px;
    border: 0;
    color: #fff;
    cursor: pointer;
}

button.cancel {
    background: #d7e5ff;
    border-radius: 6px;
    border: 0;
    color: #000a5f;
    cursor: pointer;
}

.modal-close {
    float: right;
    font-size:16px;
    border: 0;
    background: white;
    cursor: pointer;
}



/* ---------- FADE OUT ANIMATION ---------- */

.fade-out {
    opacity: 1;
    transition: opacity 0.6s ease;
}

.fade-out.remove {
    opacity: 0;
}

#statusPopup {
    position: fixed;
    bottom: 25px;
    right: 25px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity .4s ease, transform .3s ease;
    transform: translateY(10px);
    z-index: 9999;
}
#statusPopup.show {
    opacity: 1;
    transform: translateY(0);
}
#statusPopup.success { background-color: #28a745; }
#statusPopup.error   { background-color: #dc3545; }
#statusPopup.info    { background-color: #017bfe; }




/* --- INPUTS --- */
.input-container {
    width: 100%;
    margin-bottom: 1rem;
}

.input-container_ {
    display: none;
}

.input-container input {
    width: 100%;
    padding: 0.9rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    box-sizing: border-box;
}

/* --- SUBMIT BUTTON --- */
.submit {
    position:relative ;
    left:20%;
    padding: 0.9rem;
    background-color: #4F46E5;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    border: 0;  
    border-radius: 0.5rem;
    margin-top: 5px;
    width: 60%;
    cursor: pointer;
}

.test {
    padding: 0.7rem;
    background-color: #179da7;
    color: #ffffff;
    font-size: 1rem;
    border: 0;  
    border-radius: 0.5rem;
    margin-top: 25px;
    margin-left: 10px;
    width: 40%;
    cursor: pointer;
}
.btn-group {
    text-align:center;
}


/* --- SIGNUP LINK --- */
.signup-link {
    color: #6B7280;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 1rem;
}

.signup-link a {
    text-decoration: underline;
}

/* --- Mobile friendly settings --- */
@media (max-width: 480px) {
    .form {
        margin: 10px;
        padding: 1.2rem;
        max-width: 100%;
    }

    .form-title {
        font-size: 1.25rem;
    }

    .submit {
        font-size: 1rem;
    }
}


.setpoint-panel {
    background: #f4f4f6;
    padding: 18px;
    border-radius: 10px;
    width: 260px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.label {
    font-size: 1.2rem;
    margin: 0;
    padding-top: 15px;
    color: #403fa5;
}

.setpoint-display {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
}

.setpoint-value {
    font-size: 1.3rem;
    color: black; 
    text-align: center;
}

.sp-btn {
    background: #ddd;
    border: none;
    border-radius: 8px;
    font-size: 24px;
    width: 45px;
    height: 45px;
    cursor: pointer;
    font-weight: bold;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.sp-btn:hover {
    background: #ccc;
}

.settings-wrapper {
  position: relative;
}

.onlineStatus {
  position: absolute;
  left:0;
  margin-left:-15px;
  margin-top:-20px;
}

.errorStatus {
  position: absolute;
  right:0;
  margin-right:-15px;
  margin-top:-20px;
}


.discard-btn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin-top:88px; /* kb. a két kártya közé */
    z-index: 10;
    border: none;
    padding: 8px 8px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    background: #c6eeee;
}

.discard-btn:hover {
    background: #ffc600;
}

 .saDisplay{
  position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 20px; 
    z-index: 10;
    border: none;
    padding: 8px 8px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    background: #c6eeee;
 }

.save-btn {
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    background: var(--yellow);
}

.save-btn:hover {
    background: #ffc600;
}

@keyframes glowing {
        0% {
          background-color: #2ba805;
          box-shadow: 0 0 5px #2ba805;
        }
        50% {
          background-color: #49e819;
          box-shadow: 0 0 20px #49e819;
        }
        100% {
          background-color: #2ba805;
          box-shadow: 0 0 5px #2ba805;
        }
      }
      .save-btn.locked  {
        animation: glowing 2300ms infinite;
 }

 
  select {
    /*  safari  */
    -webkit-appearance: none;
    appearance: none;
    /*  other styles for aesthetics */
    text-align-last: center;
    width: auto;
    font-size: 1.0rem;
    padding: 0.575em 1em 0.575em 1em;
    background-color: #deeff3;
    border: 1px solid #2d1dc4;
    border-radius: 0.25rem;
    color: #000;
    cursor: pointer;
  }
  
   
  .zoneselect {
  position: relative;
  display: inline-block;
  }

  .zoneselect select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem; /* hely a nyílnak */
  /* text-align: center; */
  text-align-last: center;
  }
     
  .zoneselect::after {
  content: "▼";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.7rem;
}

.timerselect {
  position: relative;
  display: inline-block;
  }

  .timerselect select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem; /* hely a nyílnak */
  /* text-align: center; */
  text-align-last: center;
  }
     
  .timerselect::after {
  content: "▼";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.7rem;
}

  .mobiletabs {
  position: relative;
  /* display: inline-block; */
  }

  .mobiletabs select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem; /* hely a nyílnak */
  /* text-align: center; */
  text-align-last: center;
  }
     
  .mobiletabs::after {
  content: "▼";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.7rem;
}
 
/***************************************/
:root {
    --bg-color: #e0e0e0;
    --card-bg: #f5f5f5;
    --yellow: #ffb400;
    --active-tab: #ffffff;
    --tab-bg: #cccccc;
    --text-color: #333;
}

.settings-grid {      
  grid-column: 1 / -1;                 /* from first to last coloumn */
  text-align: center;
}

.loading {
  opacity: 0.6; /* dim the content */
  cursor: wait; /* busy cursor feedback */
}

.loading * {
    /* disable all mouse events on children elements */
    pointer-events: none; 
}

.settings-card {      
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 10px 10px rgba(0,0,0,0.1);
  overflow: auto;
  padding: 20px;
  margin-top: 20px;
  margin-bottom: 50px;
  max-width: 85%;
  margin-left: auto;
  margin-right: auto;  
}

.tab {
  padding: 12px 12px;
  cursor: pointer;
  font-weight: bold;
  border-radius: 10px 0 0 0;
  margin-right: 2px;
  transition: 0.3s;
}

.tab.active {
  background: white;
  font-weight: bold;
}

.tabs {
  display: flex;
  border-radius: 10px;  
  background: var(--tab-bg);  
  min-width: max-content; /* ne törjön sorba */
}

.tabs-wrapper::-webkit-scrollbar {
  display: none; /* szebb mobilon */
}

/* desktop */
.tabs-dropdown {
  display: none;
}

.mobiletabs::after {
  display:none;
}

hr {
    display: none;
}

.tabs-wrapper {
  display: flex;
  border-radius: 10px 10px 0 0; 
  background: var(--tab-bg);  
  min-width: max-content; /* ne törjön sorba */
}

.header-mobile {
    display: none;
  }

.header {
    display: flex;
    min-width: max-content;
  }
 
.row {
    display: flex;
  }      

/* mobile */
@media (max-width: 750px) {
  .tabs-dropdown {
    display: block;
    margin-top: 0px;
    margin-bottom: 0px;
    min-width: -webkit-fill-available; 
  }

hr {
    display: block;
}

  .header-mobile {
    display: flex;
    min-width: max-content; 
  }

  .row {
    display: block;
  }
  
  .mobiletabs::after {
  display:inline-block;
  }

  .tabs-wrapper {
    display: none;
  }

  .header {
    display: none;
  }
}

.tab:active {
  transform: scale(0.95);
}

/**********************************************************/

/* Header */
.header {
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
}

.header h2 { margin: 0; font-size: 24px; color: var(--text-color); }

.header-mobile {
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
}

.header h3 { margin: 0; font-size: 16px; color: var(--text-color); }

/* Buttons */
.btn {
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    background: var(--yellow);
}

/* Content Area */
.content {
    background: white;
    padding-top: 40px;
    padding-bottom: 40px;
}

.row {
    justify-content: space-evenly;
    align-items: flex-start;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 30px;
}

.control-group label {
    font-weight: bold;
    font-size: 14px;
}

.channel-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.channel-group label {
    font-weight: bold;
    font-size: 20px;
    color:#360be1;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px; width: 22px;
    left: 4px; bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--yellow); }
input:checked + .slider:before { transform: translateX(30px); }

/* Mode Selector */
.mode-selector {
    background: #eee;
    padding: 5px;
    border-radius: 8px;
    display: flex;
    border: 1px solid #ddd;
}

.mode-btn {
    border: none;
    background: none;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 18px;
    border-right: 1px solid #ccc;
}

.mode-btn.active {
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-radius: 6px;
    color: var(--yellow);
}

/* Temperature Section */
.temp-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.temp-value {
    font-size: 32px;
    font-weight: bold;
}

.temp-btn {
    border: none;
    width: 40px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
}

.temp-btn.blue { background: #b3d7ff; }
.temp-btn.red { background: #ffb3b3; }

.btn-yellow {
    background: var(--yellow);
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
}

hr {
    width: 50%;
    margin-left: auto;
    margin-right: auto;
    border: none;
    border-top: 2px solid #ccc;
}

.btn-ico {
  background: none;
  border: none;
  font-size: 25px;  
  cursor: pointer ;
  padding: 0px;
  opacity:0.2;  
}

.btn-ico.active {
  background: none;
  border: none;
  font-size: 25px;  
  cursor: pointer ;
  padding: 0px;
  opacity: 1;  
}