/* ═══════════════════════════════════════════
   Estilo WhatsApp — Simulador de Chat
   ═══════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #0b141a;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Marco del teléfono */
.phone-frame {
  width: 420px;
  height: 720px;
  background: #0b141a;
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 2px solid #2a3942;
}

/* Header */
.chat-header {
  background: #1f2c34;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #2a3942;
  min-height: 60px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #25d366);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 18px;
}

.header-info h3 {
  color: #e9edef;
  font-size: 16px;
  font-weight: 500;
}

.header-info p {
  color: #8696a0;
  font-size: 12px;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Panel de configuración */
.config-panel {
  background: #111b21;
  padding: 16px;
  border-bottom: 1px solid #2a3942;
  display: none;
}

.config-panel.active {
  display: block;
}

.config-panel h4 {
  color: #00a884;
  margin-bottom: 12px;
  font-size: 14px;
}

.config-field {
  margin-bottom: 10px;
}

.config-field label {
  display: block;
  color: #8696a0;
  font-size: 12px;
  margin-bottom: 4px;
}

.config-field input {
  width: 100%;
  padding: 8px 12px;
  background: #2a3942;
  border: 1px solid #3b4a54;
  border-radius: 8px;
  color: #e9edef;
  font-size: 13px;
  outline: none;
}

.config-field input:focus {
  border-color: #00a884;
}

.btn-connect {
  width: 100%;
  padding: 10px;
  background: #00a884;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
  transition: background 0.2s;
}

.btn-connect:hover {
  background: #00876a;
}

.config-hint {
  color: #8696a0;
  font-size: 11px;
  margin-top: 8px;
  text-align: center;
}

/* Área de mensajes */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Crect fill='%230b141a'/%3E%3Cg fill-opacity='0.03'%3E%3Cpath fill='%23ffffff' d='M20 20h20v20H20zm40 0h20v20H60zm80 0h20v20h-20zm40 0h20v20h-20zm80 0h20v20h-20zM40 40h20v20H40zm80 0h20v20h-20zm40 0h20v20h-20zm80 0h20v20h-20z'/%3E%3C/g%3E%3C/svg%3E");
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #374045;
  border-radius: 3px;
}

/* Divisor de fecha */
.date-divider {
  text-align: center;
  margin: 12px 0;
}

.date-divider span {
  background: #182229;
  color: #8696a0;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
}

/* Mensaje del sistema */
.system-message {
  text-align: center;
  margin: 8px 0;
}

.system-message p {
  background: #182229;
  color: #8696a0;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  display: inline-block;
}

/* Burbujas de mensaje */
.message {
  max-width: 80%;
  padding: 6px 8px 4px;
  border-radius: 8px;
  position: relative;
  margin: 1px 0;
  word-wrap: break-word;
  line-height: 1.4;
}

.message-content {
  font-size: 14px;
  color: #e9edef;
  white-space: pre-wrap;
}

.message-time {
  font-size: 11px;
  color: #8696a0;
  float: right;
  margin-left: 8px;
  margin-top: 4px;
}

/* Mensaje enviado (usuario) */
.message.sent {
  background: #005c4b;
  align-self: flex-end;
  border-top-right-radius: 0;
}

.message.sent .message-time {
  color: #7fb8a8;
}

/* Mensaje recibido (agente) */
.message.received {
  background: #202c33;
  align-self: flex-start;
  border-top-left-radius: 0;
}

.message.received .sender-name {
  color: #00a884;
  font-size: 12px;
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}

/* Indicador de escritura */
.typing-indicator {
  padding: 4px 16px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.typing-indicator p {
  color: #8696a0;
  font-size: 12px;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: #8696a0;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* Sugerencias rápidas */
.suggestions-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: #111b21;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.suggestions-bar::-webkit-scrollbar {
  display: none;
}

.suggestion-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 18px;
  border: 1px solid #00a884;
  background: transparent;
  color: #00a884;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.suggestion-chip:hover {
  background: #00a884;
  color: #fff;
}

/* Barra de entrada */
.chat-input {
  background: #1f2c34;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #2a3942;
}

.chat-input input {
  flex: 1;
  background: #2a3942;
  border: none;
  border-radius: 24px;
  padding: 10px 16px;
  color: #e9edef;
  font-size: 14px;
  outline: none;
}

.chat-input input::placeholder {
  color: #8696a0;
}

.chat-input input:disabled {
  opacity: 0.5;
}

.emoji-btn {
  font-size: 22px !important;
}

.send-btn {
  background: #00a884;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: background 0.2s;
}

.send-btn:hover:not(:disabled) {
  background: #00876a;
}

.send-btn:disabled {
  background: #374045;
  cursor: not-allowed;
}

/* Check marks */
.message-checks {
  font-size: 14px;
  margin-left: 2px;
  color: #53bdeb;
}

/* Responsive */
@media (max-width: 460px) {
  .phone-frame {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    border: none;
  }
}
