/* ===== Reset básico ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Contenedor principal ===== */
.container {
  flex: 1;
  max-width: 900px;
  margin: 20px auto;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== Encabezado ===== */
.header {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  padding: 20px;
  text-align: center;
  color: white;
  font-weight: 600;
  font-size: 18px;
  position: relative;
}
/* Botón de regreso */
.back-button {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 20px;
  padding: 25px 30px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.back-button:hover {
  background: rgba(255,255,255,0.4);
}


/* ===== Área de mensajes ===== */
.messages {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.message {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 20px;
  line-height: 1.4;
  font-size: 15px;
  word-wrap: break-word;
  position: relative;
  word-break: break-word;
}

.message.sent {
  align-self: flex-end;
  background: #667eea;
  color: white;
  border-bottom-right-radius: 6px;
}

.message.received {
  align-self: flex-start;
  background: #f1f1f1;
  color: #333;
  border-bottom-left-radius: 6px;
}

.timestamp {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
  display: block;
  text-align: right;
}

.message img,
.message video {
  max-width: 100%;
  border-radius: 12px;
  margin-top: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container {
    margin: 0;
    border-radius: 0;
    max-width: 100%;   /* 🔹 Ocupa toda la pantalla */
    width: 100%;       /* 🔹 Forzar ancho completo */
    height: 100vh;     /* 🔹 Que llene el alto */
  }

  .messages {
    padding: 12px;     /* 🔹 Reduce padding en móviles */
  }

  .message {
    max-width: 85%;    /* 🔹 Burbujas más anchas */
    font-size: 14px;
  }

  .header {
    font-size: 16px;
    padding: 16px;
  }

  .back-button {
    font-size: 18px;
    padding: 4px 8px;
  }
}

@media (max-width: 480px) {
  .message {
    max-width: 90%;    /* 🔹 Todavía más anchas en pantallas muy chicas */
    font-size: 13px;
  }
}
