/* style.css */

/* Reset y base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(135deg, #667eea, #764ba2);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-container {
  background: #fff;
  padding: 40px 30px 30px;
  border-radius: 15px;
  box-shadow: 0 8px 20px rgb(118 75 162 / 0.17);
  width: 95vw;
  max-width: 400px;
  margin: 60px auto 24px auto;
  text-align: center;
  position: relative;
}

.logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
}

.logo img {
  height: 60px;
  width: 60px;
  margin-right: 12px;
  border-radius: 50%;
  background: #eee;
}

.logo h1 {
  font-size: 2rem;
  font-weight: 800;
  color: #4b3f6b;
  letter-spacing: .5px;
}

h2 {
  color: #4b3f6b;
  margin-bottom: 24px;
  margin-top: 3px;
  font-weight: 700;
}

form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-bottom: 10px;
}

input[type="email"], input[type="password"] {
  padding: 12px 14px;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
  width: 100%;
  transition: border-color 0.3s ease;
}

input[type="email"]:focus, input[type="password"]:focus {
  border-color: #764ba2;
  outline: none;
}

button[type="submit"] {
  padding: 13px 0;
  background: #764ba2;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.07rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 7px;
}

button[type="submit"]:hover {
  background: #5a3680;
}

#mensaje {
  margin-top: 10px;
  font-weight: 600;
  min-height: 20px;
}

.registro-link {
  margin-top: 12px;
  font-size: 0.97rem;
}

.registro-link button {
  background: none;
  border: none;
  color: #764ba2;
  cursor: pointer;
  font-weight: 600;
}

footer {
  width: 100vw;
  background: #c0a488;
  color: #222;
  text-align: center;
  padding: 23px 8px 12px 8px;
  font-size: 1.07rem;
  border-top: 6px solid #221c1c;
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 10;
  user-select: none;
}

footer img {
  vertical-align: middle;
  transition: transform 0.2s;
  filter: grayscale(40%);
  width: 37px;
  margin: 0 8px;
}

footer a:hover img {
  transform: scale(1.17);
  filter: none;
}

footer div.social {
  margin-top: 8px;
}

.dashboard-container {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0px 8px 22px rgba(90, 75, 162, 0.16);
  padding: 42px 36px 46px 36px;
  margin: 50px auto 40px auto;
  width: 97vw;
  max-width: 530px;
  min-width: 320px;
}

.dashboard-container h1 {
  color: #332f29;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 24px;
}

.dashboard-container section {
  margin-bottom: 18px;
  padding: 0 !important;
  background: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

@media (max-width: 600px) {
  .login-container {
    padding: 18px 7vw 26px 7vw;
    margin: 27px auto 16vw auto;
    max-width: 97vw;
    min-width: 0;
  }
}

.dashboard-container {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(90, 75, 162, 0.16);
  margin: 50px auto 34px auto;
  width: 96vw;
  max-width: 680px;
  min-width: 280px;
  padding: 34px 32px 32px 32px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 24px;
}

header {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}
header h1 {
  text-align: left;
  color: #392b6b;
  font-size: 2rem;
  font-weight: 900;
  flex: 1;
}
header button {
  background-color: #764ba2;
  border: none;
  color: white;
  padding: 11px 18px;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  transition: background-color 0.3s ease;
  margin-left: 34px;
  margin-top: 3px;
}
header button:hover {
  background-color: #5a3680;
}

.dashboard-container section {
  background: #faf8fe;
  border-radius: 9px;
  box-shadow: 0 3px 12px rgb(120 75 162 / 0.06);
  margin-bottom: 0;
  padding: 24px 22px 20px 22px;
}

section h2 {
  color: #523688;
  font-size: 1.25rem;
  margin-bottom: 14px;
  font-weight: 800;
}

#climaActual img {
  vertical-align: middle;
  margin-right: 10px;
}

#graficas canvas {
  max-width: 100%;
  background: #fff;
  border-radius: 7px;
  margin-bottom: 10px;
}

#controles button {
  margin-right: 13px;
  margin-bottom: 0;
  padding: 11px 25px;
  font-size: 1rem;
  border-radius: 11px;
  border: none;
  cursor: pointer;
  background-color: #764ba2;
  color: white;
  font-weight: 700;
  transition: background-color 0.2s ease;
}
#controles button:hover {
  background-color: #5a3680;
}
#controles {
  display: flex;
  flex-direction: column;
  align-items: center;
}
#controles button {
  margin-bottom: 13px;
  width: 95%;
  max-width: 290px;
}

#configForm label {
  display: block;
  margin-top: 13px;
  font-weight: 600;
}
#configForm input,
#configForm select {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  border-radius: 9px;
  border: 1px solid #cdcdcd;
  font-size: 1rem;
  margin-bottom: 6px;
}
#configForm input:focus,
#configForm select:focus {
  border-color: #8d6cda;
  outline: none;
}
#configForm button[type="submit"] {
  margin-top: 18px;
  width: 100%;
  background-color: #764ba2;
  border: none;
  border-radius: 10px;
  color: white;
  padding: 15px 0;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
#configForm button[type="submit"]:hover {
  background-color: #5a3680;
}

#alertas ul {
  list-style-type: disc;
  padding-left: 18px;
  font-size: 1rem;
  color: #cc3f3f;
  max-height: 135px;
  overflow-y: auto;
}

@media (max-width: 800px) {
  .dashboard-container {
    padding: 14px 3vw 18vw 3vw;
    margin: 18px 0 16vw 0;
    max-width: 99vw;
    min-width: 0;
  }
  header {
    flex-direction: column;
    gap: 9px;
  }
  #controles button {
    max-width: 99vw;
  }
  section {
    padding: 15px 3vw 12px 3vw;
  }
}

.alerta-table-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#tablaAlertas {
  width: 96%;
  max-width: 680px;
  margin: 0 auto;
  border-collapse: separate;
  border-spacing: 0;
  background: #f7f3ff;
  border-radius: 13px;
  box-shadow: 0 2px 14px rgb(82 70 133 / 0.10);
  font-size: 1rem;
  overflow: hidden;
  margin-bottom: 10px;
}

#tablaAlertas th, #tablaAlertas td {
  padding: 10px 15px;
  text-align: left;
}

#tablaAlertas th {
  background: #655ec7;
  color: white;
  font-weight: 900;
  letter-spacing: .7px;
  border: none;
  user-select: none;
  position: relative;
}

#tablaAlertas tr {
  border-bottom: 1.5px solid #e4e0fa;
}

#tablaAlertas tr:last-child {
  border-bottom: none;
}

#tablaAlertas td {
  background: #fff;
  border: none;
  vertical-align: middle;
}

.alerta-emoji {
  font-size: 1.2rem;
  text-align: center;
}

.custom-dropdown {
  min-width: 120px;
  background: #fff;
  border: 1.3px solid #b7aed7;
  border-radius: 7px;
  box-shadow: 0 4px 16px rgba(110, 98, 171, 0.18);
  margin-top: 4px;
  overflow: hidden;
}

.custom-dropdown div {
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.13s;
  color: #3d3271;
  font-size: 1rem;
}
.custom-dropdown div:hover, .custom-dropdown .active {
  background: #e4e0fa;
  color: #3a156b;
}

@media (max-width: 800px){
  #tablaAlertas {
    width: 99vw;
    font-size: 0.94rem;
  }
}

.panel-row {
  display: flex;
  flex-direction: row;
  gap: 48px;
  justify-content: center;
  align-items: flex-start;
  margin-bottom: 2.5rem;
}

#datosActuales, #climaActual {
  flex: 1 1 310px;
  background: #fff;
  border-radius: 17px;
  box-shadow: 0 2px 15px rgb(90 75 162 / 8%);
  padding: 32px 22px 22px 22px;
  max-width: 370px;
}

#climaActual img {
  display: block;
  margin: 0 0 14px 0;
}

@media (max-width: 900px) {
  .panel-row {
    flex-direction: column;
    gap: 22px;
    align-items: stretch;
  }
  #datosActuales, #climaActual {
    max-width: 100%;
    margin: 0;
  }
}

.clima-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.clima-header img {
  margin: 0;
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background: #eee;
}

.clima-header h2 {
  margin: 0;
  font-size: 1.18em;
  font-weight: 800;
  color: #523688;
  letter-spacing: .5px;
  line-height: 1.1em;
}

.clima-headerdos {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.clima-headerdos img {
  margin: 0;
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background: #eee;
}

.clima-headerdos h2 {
  margin: 0;
  font-size: 1.18em;
  font-weight: 800;
  color: #523688;
  letter-spacing: .5px;
  line-height: 1.1em;
}

.fila-config {
  display: flex;
  flex-direction: row;
  gap: 24px;
  margin-bottom: 18px;
}

.fila-config > div {
  flex: 1 1 120px;
  min-width: 120px;
}

.fila-config label {
  font-weight: 600;
  font-size: 0.98rem;
}

.fila-config input {
  width: 100%;
  margin-top: 6px;
  margin-bottom: 0;
  padding: 8px 9px;
  border-radius: 8px;
  border: 1.1px solid #d6d4e1;
  font-size: 1rem;
}

@media (max-width: 800px) {
  .fila-config {
    flex-direction: column;
    gap: 0;
  }
  .fila-config > div {
    min-width: 0;
    margin-bottom: 8px;
  }
}

.controles-botones {
  display: flex;
  flex-direction: row;
  gap: 18px;
  justify-content: center;
}

#controles button {
  width: auto;
  margin-bottom: 0;
  max-width: 180px;
  padding: 12px 32px;
  font-size: 1rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  background-color: #764ba2;
  color: white;
  font-weight: 700;
  transition: background 0.2s;
}
#controles button:hover {
  background-color: #5a3680;
}

.offline {
  color: red;
  font-weight: bold;
}

.online {
  color: rgb(50, 198, 36);
  font-weight: bold;
}
