body {
  font-family: Verdana, Arial, sans-serif;
  background: #f7f9fb;
  color: #222;
  margin: 0;
  padding: 0;
  text-align: center;
  transition: background 0.3s, color 0.3s;
}

h1 {
  margin: 15px 0;
  font-size: 26px;
}

header {
  position: relative;
}

#darkToggle {
  position: absolute;
  right: 1px;
  top: 1px;
  font-size: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
}

.towerSelect {
  margin: 10px;
  padding: 5px;
  font-size: 16px;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 por linha no desktop */
  gap: 20px;
  padding: 20px;
  justify-content: center;
}

.camera {
  position: relative; /* permite sobreposição */
  background: white;
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: background 0.3s, color 0.3s;
  overflow: hidden; /* garante que o overlay não sai fora da imagem */
}

.camera img {
  width: 100%;
  border-radius: 8px;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 8px;
  background: #f1f1f1;
  border-radius: 6px;
  margin-bottom: 6px;
}
.save-btn {
   background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.save-btn:active {
  transform: scale(0.94); /* encolhe um pouco */
}
@media (hover: hover) and (pointer: fine) {
  .save-btn:hover {
    background: #77b9df;
  }
}
.save-btn:focus,
.save-btn:active {
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  text-align: center;
  font-size: 16px;
  vertical-align: middle;
  line-height: 1;
  position: relative;
  cursor: help; /* mostra o ícone de "info" ao passar o rato */
}

/* estilo da tooltip */
.icon::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 125%; /* sobe acima do ícone */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 9999;
}

/* seta da tooltip */
.icon::before {
  content: '';
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.85) transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* aparece ao hover */
.icon:hover::after,
.icon:hover::before {
  opacity: 1;
}

.toggle-btn {
  font-size: 16px;
  background: #28c76f;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}
.toggle-btn.off { background: #ea5455; }

.camera-title {
  padding-left: 10px;
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: left;
}

.status-led {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ccc;
}

.status-ok { background: #28c76f; }
.status-fail { background: #ea5455; }

.update-time {
  font-size: 12px;
  min-width: 120px;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.paused-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  z-index: 5;
  display: none;
  pointer-events: none;
  text-shadow: 0 0 4px rgba(0,0,0,0.7);
}

.camera img.loading {
  width: 80px;            /* tamanho fixo */
  height: 80px;
  margin: 20px auto;      /* centra horizontalmente */
  display: block;
  object-fit: contain;    /* evita distorção */
}


.compass {
  width: 26px;
  height: 26px;
  display: inline-block;
}

.compass svg { width: 100%; height: 100%; }

/* Fullscreen */
#fullscreenOverlay {
  display: none;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
}

#fullscreenImg {
  max-width: 90%;
  max-height: 90%;
  transition: transform 0.2s ease;
  cursor: grab;
}
.fs-controls {
  position: absolute;
  top: 15px;
  right: 70px;
  display: flex;
  gap: 8px;
  z-index: 10000;
}

.fs-controls button {
  background: rgba(255,255,255,0.8);
  border: none;
  border-radius: 6px;
  font-size: 18px;
  padding: 6px 10px;
  cursor: pointer;
  transition: 0.2s;
}
.fs-controls button:hover {
  background: rgba(255,255,255,1);
}

#closeBtn {
  position: absolute;
  top: 15px;
  right: 25px;
  background: #ea5455;
  border: none;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}

/* 🌙 Dark mode */
body.dark {
  background: #121212;
  color: #eaeaea;
}

body.dark .camera {
  background: #1e1e1e;
  box-shadow: 0 0 10px rgba(255,255,255,0.05);
}

body.dark .camera-header {
  background: #222;
}

body.dark .toggle-btn {
  filter: brightness(0.9);
}
body.dark-mode .save-btn {
  background: #121212;
  color: #eaeaea;
  border: 1px solid #333;
}
body.dark-mode .save-btn:hover {
  background: #333;
  transform: scale(0.94);          
}
body.dark-mode .interval-select {
  background: #222;
  color: #fff;
  border-color: #444;
}

.copyable {
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.copyable:hover {
  color: #007bff;
}

.copyable.copied {
  color: #28c76f; /* verde temporário */
}
.timer-wrapper {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-bg {
  fill: none;
  stroke: #ccc;
  opacity: 0.2;
}

.progress-bar {
  fill: none;
  stroke: #007bff;
  stroke-linecap: round;
  stroke-dasharray: 56.5;
  stroke-dashoffset: 56.5;
  transition: stroke-dashoffset 0.1s linear;
}

body.dark-mode .progress-bar {
  stroke: #1e90ff;
}


@media (max-width: 768px) {
   .grid {
    grid-template-columns: 1fr;
  }
  .camera-header {
    order: 1;
  }
  .camera {
      display: flex;
      flex-direction: column;
    }
  .camera-title {
    justify-content: center;
  }
  .save-btn:hover {
    background: transparent;
  }
  .update-time {
    order: 3; /* aparece depois da imagem */
    width: 100%;
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    background: rgba(0,0,0,0.05);
    border-radius: 6px;
    padding: 4px 0;
  }
  .camera-image {
    order: 2;
  }
}

.interval-btn {
  border: none;
  background: #f3f3f3;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}
.interval-btn:hover {
  background: #e0e0e0;
}
