/* ---------------------- FUENTES ---------------------- */
@import url("https://fonts.googleapis.com/css?family=Roboto+Slab:400,700&display=swap");
@import url("https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap");

/* ---------------------- BASE ---------------------- */
body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  background-color: #f2f4f8;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.container {
  background: #fff;
  max-width: 640px;
  width: 100%;
  border-radius: 12px;
  padding: 30px 20px;
  animation: fadeIn 0.6s ease;
  position: relative;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12),
              0 4px 6px rgba(0, 0, 0, 0.08);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------- VOLVER ---------------------- */
.volver-button {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #0077b6;
  background-color: #e3f2fd;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.3s ease;
}
.volver-button:hover {
  background-color: #bbdefb;
}

/* ---------------------- HEADER ---------------------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  margin-bottom: 25px;
}

.header-col {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-col.center {
  flex: 1 1 auto;
  text-align: center;
}

.header-title {
  font-family: 'Roboto Slab', serif;
  font-size: 22px;
  color: #000;
  margin: 0;
  line-height: 1.4;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.header-image {
  max-width: 100px;
  width: 100px;
  height: auto;
  object-fit: contain;
}

/* ---------------------- FORMULARIO ---------------------- */
.formulario {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  margin-top: 10px;
}

.input-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 320px;
}

.input-group label {
  font-weight: 600;
  margin-bottom: 6px;
  text-align: left;
  font-size: 17px;
}

.input-group input {
  width: 100%;
  padding: 12px;
  font-size: 17px;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(15, 172, 238, 0.1);
}

.input-group input:focus {
  border-color: #0facee;
  box-shadow: 0 0 0 3px rgba(15, 172, 238, 0.25);
}

.unidad {
  font-size: 13px;
  margin-top: 4px;
  text-align: center;
  color: #666;
  height: 14px;
}

/* ---------------------- ERRORES ---------------------- */
.error-msg {
  font-size: 13px;
  color: red;
  margin-top: 5px;
  height: 14px;
}

/* ---------------------- VALIDACIONES VISUALES ---------------------- */

/* ✅ Input válido sin foco */
.input-valido:not(.en-foco) {
  border: 2px solid #0077b6 !important;
  box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.25) !important;
}

/* ✅ Input válido con foco */
.input-valido.en-foco {
  border: 2px solid #00ced1 !important;
  box-shadow: 0 0 0 3px rgba(0, 206, 209, 0.4) !important;
}

/* ❌ Input inválido */
.input-invalido {
  border: 2px solid #c0392b !important;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.3) !important;
}

/* Reseteo base para evitar conflictos */
input {
  transition: border-color 0.3s, box-shadow 0.3s;
}


/* ---------------------- BOTONES ---------------------- */
button {
  background-color: #0facee;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Roboto Slab', serif;
  font-size: 16px;
  width: auto;
  max-width: 120px;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #1976d2;
}

.limpiar-btn {
  background-color: #0077b6;
  margin-top: 5px;
}
.limpiar-btn:hover {
  background-color: #005a8a;
}

/* ---------------------- RESULTADOS ---------------------- */
.resultado-box {
  font-size: 18px;
  font-weight: 500;
  padding: 15px;
  background: linear-gradient(to right, #e0f7fa, #ffffff);
  border: 1px solid #0facee;
  border-radius: 8px;
  color: #0077b6;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  text-align: center;
  margin: 25px auto 0 auto;
  width: 100%;
  max-width: 320px;
}

.toggle-box {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.switch-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  gap: 8px;
  color: #0077b6;
}

.switch-label input {
  display: none;
}

.switch-slider {
  width: 40px;
  height: 22px;
  background-color: #ccc;
  border-radius: 50px;
  position: relative;
  transition: background-color 0.3s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.switch-label input:checked + .switch-slider {
  background-color: #0077b6;
}

.switch-label input:checked + .switch-slider::before {
  transform: translateX(18px);
}


/* ---------------------- RESPONSIVE ---------------------- */
@media screen and (max-width: 600px) {
  body {
    padding: 0;
  }

  .container {
    padding: 20px 10px;
    border-radius: 0;
    box-shadow: none;
  }

  .header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .header-image {
    max-width: 70px;
  }

  .header-title {
    font-size: 18px;
    margin-top: 5px;
  }

  .formulario {
    gap: 18px;
  }

  .resultado-box {
    font-size: 15px;
    max-width: 100%;
  }

  button, .input-group {
    max-width: 100%;
  }

  .hide-mobile {
    display: none !important;
  }
}
