:root {
  --color-primary: #0f62fe;
  --color-primary-dark: #0b3fa0;
  --color-accent: #17b8cc;
  --color-accent-light: #dff6fa;
  --color-success: #2ea043;
  --color-success-dark: #1f7a30;
  --color-danger: #e5484d;
  --color-danger-dark: #b3272b;
  --color-warning: #f5b400;
  --color-warning-light: #fff3cd;
  --color-text: #14213d;
  --color-bg-page: #eef1f6;
  --color-card-bg: #ffffff;
}

#fullscreenBtn {
  position: fixed;
  top: 15px;
  right: 15px;
  background: transparent;   /* sin fondo */
  color: var(--color-primary);
  border: none;
  font-size: 2rem;           /* icono más bonito */
  cursor: pointer;
  z-index: 9999;
  display: block;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--color-bg-page);
  color: var(--color-text);
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.screen {
  display: none;
  flex-direction: column; /* si usas flex */
  width: 100%;
  height: 100%;
}

#loginScreen {
  display: flex; /* visible al inicio */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}


#loginBox {
  padding: 20px;
  border: 1px solid #ccc;
  border-radius: 12px;
  width: 320px;
  background: #fafafa;
  box-shadow: 0 0 12px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
}

#loginLogo {
  width: 320px;
  height: 230px;
  margin-bottom: 15px;
}

#loginLogo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#loginBox input {
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  font-size: 1em;
  border-radius: 8px;
  border: 1px solid #bbb;
}

#loginBox h2 {
  color: var(--color-primary-dark);
  letter-spacing: 0.02em;
}

#loginBox button {
  width: 100%;
  margin-top: 18px;
  padding: 10px;
  background: var(--color-primary);
  color: white;
  font-size: 1.1em;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  transition: 0.2s;
}
#loginBox button:hover { background: var(--color-primary-dark); }


/* ========= PANTALLA PRINCIPAL ========= */
#mainScreen {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100%;
  padding-bottom: 90px;
  box-sizing: border-box;
}

#hmiContainer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
}

#logoContainer {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 20px;
}

#logoContainer img {
  width: 80%;
  max-width: 420px; /* evita estirar mas alla de la resolucion real (567x310) y verse borroso */
  height: auto;
  object-fit: contain;
}

/* Rectángulo flotante y responsive */
.rectangulo {
    width: 7%;
    aspect-ratio: 1.5/1;
    background-color: var(--color-danger);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0.6vw;
    font-size: 2vw;
    font-weight: bold;
    transition: 0.3s ease;
    position: absolute;
}
.fullScreenContainer {
    position: fixed;   /* se fija al viewport */
    top: 0;
    left: 0;
    width: 100vw;      /* 100% del ancho del viewport */
    height: 100vh;     /* 100% del alto del viewport */
    overflow: hidden;  /* evita scroll si algo sobresale */
    z-index: 0;
}

.img-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 89%;
    object-fit: fill; /* llena todo el contenedor, recorta si hace falta */
    z-index: -1;       /* detrás de los botones */
}

.overlayImg {
    position: absolute; /* ya estaban en inline-style, pero mejor CSS */
    z-index: 1;         /* al frente del fondo */
    object-fit: fill; /* mantiene proporciones de la imagen */
}
.botones-container {
    z-index: 10;
}

/* ===== BOTONES INTERACTIVOS (más modernos: bordes redondeados y sombra) ===== */
.boton-mqtt {
    border: none;
    border-radius: 0.6vw;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
/* Sombra y hover solo en los botones visibles (los "select"/"automatico"/"manual"
   son zonas invisibles sobre el esquema y no deben marcarse con sombra) */
.boton-mqtt.start,
.boton-mqtt.stop,
.boton-mqtt.reintentar {
    box-shadow: 0 0.2vw 0.5vw rgba(0,0,0,0.25);
}
.boton-mqtt.start:hover,
.boton-mqtt.stop:hover,
.boton-mqtt.reintentar:hover {
    filter: brightness(1.08);
    box-shadow: 0 0.3vw 0.7vw rgba(0,0,0,0.3);
}
.boton-mqtt:active {
    transform: scale(0.96);
}

.navBtn {
    border-radius: 0.6vw !important;
    box-shadow: 0 0.2vw 0.5vw rgba(0,0,0,0.25);
    transition: background 0.2s ease, transform 0.15s ease;
}
.navBtn:hover {
    background: var(--color-primary-dark) !important;
    transform: translateY(-2px);
}
.navBtn:active {
    transform: translateY(0);
}
/* RESPONSIVO PARA MÓVIL */
@media (max-width: 768px) {
  .rectangulo {
    width: 6vw; /* 10% del ancho de la pantalla */
    height: 10vh;
    font-size: 2.5vw;
  }
}

.textoProcesoBox {
  position: absolute;

  display: flex;
  justify-content: center;    /* centra horizontal */
  align-items: center;        /* centra vertical */

  padding: 0.5vw 1vw;

  background: var(--color-primary);
  border: 0.15vw solid var(--color-primary-dark);
  border-radius: 0.3vw;

  box-shadow: 0 0 0.6vw rgba(0,0,0,0.25);

  white-space: normal;        /* ahora sí permite multilinea */
  text-align: center;         /* centra cada línea */
}
.textoProceso {
  font-size: 1.2vw;
  color: white;
  font-weight: bold;
  margin: 0;
}
/* === CUADRO ESPECIAL MÁS GRANDE (SOLO PARA PARAMETROS) === */
.textoProcesoBoxGrande {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;

  padding: 0.5vw 1vw;

  background: var(--color-accent);
  border: 1px solid var(--color-primary-dark);
  border-radius: 0.5vw;

  box-shadow: 0 0 1vw rgba(0,0,0,0.25);

  white-space: normal;
  text-align: center;

  width: 34vw;   /* MÁS ANCHO */
  height: 6vw;   /* MÁS ALTO */
  z-index: 10;
}

.textoProcesoGrande {
  font-size: 1.7vw;
  color: var(--color-text);
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

/* ===== CAJAS DE INPUT NUMÉRICO (valor + unidad juntos, sin overlap) ===== */
.valueInputBox {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4vw;

  background: var(--color-warning-light);
  border: 0.15vw solid var(--color-warning);
  border-radius: 0.4vw;
  box-shadow: 0 0.15vw 0.5vw rgba(0,0,0,0.15);

  box-sizing: border-box;
}

.valueInputBox input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-weight: 700;
  color: var(--color-text);
  -moz-appearance: textfield;
}

.valueInputBox input::-webkit-outer-spin-button,
.valueInputBox input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.valueUnit {
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  flex: 0 0 auto;
}

.valueBtn {
  flex: 0 0 auto;
  width: 2vw;
  height: 2vw;
  min-width: 26px;
  min-height: 26px;
  border: none;
  border-radius: 0.3vw;
  background: var(--color-primary);
  color: #fff;
  font-size: 1.3vw;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  line-height: 1;
  padding: 0;
}
.valueBtn:hover {
  filter: brightness(1.1);
}
.valueBtn:active {
  transform: scale(0.92);
}

.textoProcesoBox2 {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: center;   /* CENTRA verticalmente */
  align-items: flex-start;

  width: 28vw;
  height: 2.4vw;             /* un poquito más alto para que respire */

  padding: 12px 10px;        /* más espacio uniforme arriba/abajo */
  background: var(--color-accent-light);
  border: 1px solid var(--color-primary-dark);
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(0,0,0,0.25);
  z-index: 10;
}


.textoProceso2 {
  font-size: 1.2vw;
  color: var(--color-text);
  text-align: left;
  font-weight: bold;
  margin: 0;

  display: flex;
  justify-content: space-between;
  width: 96%; /* Ajusta la separación automáticamente */
}
/* ===== CUADRO TRANSPARENTE SOLO TEXTO ===== */
.textoProcesoBoxTransparente {
  position: absolute;
  display: flex;
  justify-content: left;
  align-items: center;

  padding: 0.5vw 1vw;

  background: transparent;      /* SIN FONDO */
  border: none;                 /* SIN BORDE */
  box-shadow: none;             /* SIN SOMBRA */

  white-space: normal;
  text-align: left;

  width: 34vw;                  /* igual que textoProcesoBoxGrande */
  height: 6vw;                  /* igual que textoProcesoBoxGrande */
  z-index: 15;
}

.textoProcesoTransparente {
  font-size: 2vw;               /* igual que textoProcesoGrande */
  color: var(--color-text);     /* color del texto */
  font-weight: bold;
  margin: 0;
  line-height: 1.2;
}
/* Quitar flechas de los inputs type=number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield; /* Firefox */
}

/* ====== INDICADOR DE ESTADO MQTT ====== */
#mqttStatus {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 999;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    background-color: #6b7280; /* gris = conectando/desconocido */
}
#mqttStatus.mqtt-ok {
    background-color: #2ea043; /* verde = conectado */
}
#mqttStatus.mqtt-error {
    background-color: #e5484d; /* rojo = desconectado/error */
}
