html, body {
    overscroll-behavior-y: none;  /* no "pull-to-refresh on mobile */
    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;
  }
}

/* Normal mode */
#app {
    background-color: #ffffff;
    transition: background-color 0.3s ease;
    padding: 20px;
}

/* Set Mode */
#app.set-mode {
    background-color: #fff4e5; /* Halvány narancssárga/figyelmeztető szín */
    border: 2px solid orange;
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.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 {
    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: 18px;
    margin-top: 20px;
}

.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 ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 0;
    pointer-events: none;

    transition: opacity 0.25s ease;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    margin: 20px;
    
    flex-direction: column;
    background-color: white;
    box-shadow: 2px 2px 12px 1px rgba(140,140,140,.5);
    padding: 1.5rem;
    border-radius: 0.5rem;

    width: 100%;
    max-width: 350px;   /* mobile full width, limit on desktop */  
  
    transform: scale(0.92);
    opacity: 0;

    transition:
        transform 0.25s ease,
        opacity 0.25s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
    opacity: 1;
}

.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.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;
    }
}


.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.details-grid > div:first-child {      /* select first card */
  grid-column: 1 / -1;                 /* from first to last coloumn */
  background-color: #f0f0f0;
  text-align: center;
}


.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;
}

.save-btn {
    padding: 8px 14px;
    background: #1d8fdb;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}

.save-btn:hover {
    background: #0f6fb6;
}

.save-btn.locked {
  background-color: #aaa;
  color: #666;
  cursor: not-allowed;
  opacity: 0.6;
}

.save-btn.locked:hover {
  background-color: #aaa;
}

.zoneselect {min-width: 200px;}
  
  select {
    /*  safari  */
    -webkit-appearance: none;
    appearance: none;
    /*  other styles for aesthetics */
    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::before,
  .zoneselect::after {
    --size: 0.3rem;
    content: "";
    position: absolute;
    right: 1rem;
    pointer-events: none;
  }
  
  .zoneselect::before {
    border-left: var(--size) solid transparent;
    border-right: var(--size) solid transparent;
    border-bottom: var(--size) solid black;
    top: 40%;
  }
  
  .zoneselect::after {
    border-left: var(--size) solid transparent;
    border-right: var(--size) solid transparent;
    border-top: var(--size) solid black;
    top: 55%;
  }

  /* The switch - the box around the slider */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

/* Hide default HTML checkbox */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  box-shadow: inset 2px 2px 8px 2px rgba(0,0,0,0.3);
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #FCB700;
  box-shadow: inset 2px 2px 8px 2px rgba(0,0,0,0.3);
}

input:focus + .slider {
  box-shadow: inset 2px 2px 8px 2px rgba(0,0,0,0.3);
}

input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}
