/* ====== Estilos generales ====== */
body {
  font-family: Arial, sans-serif;
  background: #f4f6f9;
  margin: 0;
  padding: 20px;
}

h1 {
  margin-top: 0;
  color: #2c3e50;
  text-align: center;
}

h2 {
  color: #34495e;
  margin-bottom: 8px;
}

/* ====== Contenedor general (login y registro) ====== */
.container {
  max-width: 600px;
  margin: auto;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ====== Alertas ====== */
.alert {
  background: #fff0cc;
  border: 1px solid #ffd36e;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}

/* ====== Formularios (login y registro) ====== */
form {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

form input[type="text"],
form input[type="password"] {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}

form button {
  padding: 10px;
  background: #022035;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
}

form button:hover {
  background: #2f5568;
}

/* ====== Botón de registro/volver ====== */
.modoru {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  margin-bottom: 15px;
}

.modoru a {
  text-decoration: none;
  padding: 8px 12px;
  background: #022035;
  color: #fff;
  border-radius: 4px;
}

.modoru a:hover {
  background: #2f5568;
}

/* ====== CHAT ====== */

/* Contenedor del chat */
.chat-container {
  max-width: 800px;
  margin: auto;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Caja del chat */
.chat-box {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 10px;
  overflow-y: auto;
  background: #fafafa;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Formulario del chat */
.chat-form {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.chat-form select,
.chat-form textarea,
.chat-form button {
  font-size: 1em;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.chat-form textarea {
  flex: 1 1 auto;
  min-height: 60px;
  resize: vertical;
}

.chat-form button {
  background: #022035;
  color: #fff;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-form button:hover {
  background: #2f5568;
}

/* Mensajes */
.msg {
  padding: 6px 10px;
  border-radius: 6px;
  max-width: 70%;
  word-wrap: break-word;
  border: 1px solid transparent;
}

.msg.enviado {
  background: #d1e7dd;
  border-color: #bcd0c7;
  align-self: flex-end;
  text-align: right;
}

.msg.recibido {
  background: #f8d7da;
  border-color: #e6c6c9;
  align-self: flex-start;
  text-align: left;
}

.msg.nuevo {
  border: 2px solid #0d6efd;
  animation: flash 1s ease-in-out 2;
}

@keyframes flash {
  0% { background-color: #ffe066; }
  50% { background-color: #f8d7da; }
  100% { background-color: #ffe066; }
}

/* Fondo global cuando hay mensaje nuevo */
body.nuevo-mensaje {
  background: #e6f0ff;
  transition: background 0.3s ease;
}

/* Barra de emojis */
.emoji-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
}

.emoji-btn {
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.2s;
}

.emoji-btn:hover {
  transform: scale(1.2);
}

/* Responsive */
@media (max-width: 600px) {
  .chat-container {
    padding: 10px;
    border-radius: 0;
    max-width: 100%;
  }
  h1 {
    font-size: 1.2rem;
  }
  .chat-box {
    height: 60vh;
  }
  .chat-form {
    flex-direction: column;
  }
  .chat-form select,
  .chat-form textarea,
  .chat-form button {
    width: 100%;
  }
}
.btn-sonido {
    background: #4CAF50;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 8px;
}
.btn-sonido:active {
    transform: scale(0.97);
}