/* ─────────────────────────────────────────────────────────────────────────
   nosolorol_chat — chat-front.css
   Dark theme coherente con Gamekout/Codezeel
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --nsr-color:       #e63946;
  --nsr-bg:          #1a1a2e;
  --nsr-bg-2:        #16213e;
  --nsr-bg-3:        #0f3460;
  --nsr-surface:     #1e1e30;
  --nsr-surface-2:   #252540;
  --nsr-border:      rgba(255,255,255,0.08);
  --nsr-text:        #e8e8f0;
  --nsr-text-muted:  #9090a8;
  --nsr-radius:      14px;
  --nsr-radius-sm:   8px;
  --nsr-shadow:      0 20px 60px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.3);
  --nsr-z:           99990;
  --nsr-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── BUBBLE ─────────────────────────────────────────────────────────────── */
.nsr-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--nsr-z);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--nsr-color);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 0 rgba(230,57,70,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: #fff;
  padding: 0;
}
.nsr-bubble:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0,0,0,0.4); }
.nsr-bubble:active { transform: scale(0.96); }
.nsr-bubble svg { width: 24px; height: 24px; }

.nsr-bubble.nsr-online {
  animation: nsr-pulse-ring 2.5s ease-out infinite;
}
@keyframes nsr-pulse-ring {
  0%   { box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 0 rgba(230,57,70,0.4); }
  70%  { box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 12px rgba(230,57,70,0); }
  100% { box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 0 rgba(230,57,70,0); }
}

.nsr-online-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 12px;
  height: 12px;
  background: #4caf50;
  border-radius: 50%;
  border: 2px solid #fff;
}

.nsr-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #ff4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  padding: 0 4px;
  font-family: var(--nsr-font);
}

/* ── VENTANA DE CHAT ────────────────────────────────────────────────────── */
.nsr-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: var(--nsr-z);
  width: 360px;
  max-height: 540px;
  background: var(--nsr-bg);
  border-radius: var(--nsr-radius);
  box-shadow: var(--nsr-shadow);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--nsr-border);
  font-family: var(--nsr-font);
  overflow: hidden;
  animation: nsr-slide-up 0.25s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes nsr-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}

@media (max-width: 420px) {
  .nsr-window {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  .nsr-bubble { bottom: 16px; right: 16px; }
}

/* ── HEADER ─────────────────────────────────────────────────────────────── */
.nsr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--nsr-bg-2);
  border-bottom: 1px solid var(--nsr-border);
  flex-shrink: 0;
}
.nsr-header-info { display: flex; align-items: center; gap: 10px; }
.nsr-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--nsr-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.nsr-agent-name { color: var(--nsr-text); font-weight: 600; font-size: 14px; }
.nsr-status-text {
  color: var(--nsr-text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.nsr-dot-green { width: 7px; height: 7px; border-radius: 50%; background: #4caf50; display: inline-block; }
.nsr-dot-grey  { width: 7px; height: 7px; border-radius: 50%; background: #888;    display: inline-block; }

.nsr-header-actions { display: flex; gap: 4px; }
.nsr-icon-btn {
  background: none;
  border: none;
  color: var(--nsr-text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--nsr-radius-sm);
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.nsr-icon-btn:hover { background: var(--nsr-surface-2); color: var(--nsr-text); }
.nsr-icon-btn svg { width: 16px; height: 16px; }

/* ── MENSAJES ───────────────────────────────────────────────────────────── */
.nsr-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.nsr-messages::-webkit-scrollbar { width: 4px; }
.nsr-messages::-webkit-scrollbar-track { background: transparent; }
.nsr-messages::-webkit-scrollbar-thumb { background: var(--nsr-surface-2); border-radius: 4px; }

.nsr-msg { display: flex; max-width: 88%; }
.nsr-msg-customer { align-self: flex-end; flex-direction: row-reverse; }
.nsr-msg-agent    { align-self: flex-start; }
.nsr-msg-system   { align-self: center; max-width: 100%; }

.nsr-bubble-msg {
  background: var(--nsr-surface);
  border-radius: var(--nsr-radius);
  padding: 9px 13px;
  border: 1px solid var(--nsr-border);
}
.nsr-msg-customer .nsr-bubble-msg {
  background: var(--nsr-color);
  border-color: transparent;
  border-bottom-right-radius: 4px;
}
.nsr-msg-agent .nsr-bubble-msg {
  border-bottom-left-radius: 4px;
}
.nsr-msg-text {
  color: var(--nsr-text);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0;
  word-break: break-word;
}
.nsr-msg-customer .nsr-msg-text { color: #fff; }
.nsr-msg-time {
  font-size: 10px;
  color: var(--nsr-text-muted);
  margin-top: 4px;
  display: block;
  text-align: right;
}
.nsr-msg-customer .nsr-msg-time { color: rgba(255,255,255,0.65); }

.nsr-msg-system .nsr-msg-system {
  background: var(--nsr-surface-2);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--nsr-text-muted);
  font-size: 12px;
  text-align: center;
  display: block;
}

/* ── TYPING INDICATOR ───────────────────────────────────────────────────── */
.nsr-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  flex-shrink: 0;
}
.nsr-typing-label { font-size: 12px; color: var(--nsr-text-muted); }
.nsr-typing-dots { display: flex; gap: 3px; }
.nsr-typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--nsr-text-muted);
  border-radius: 50%;
  animation: nsr-dot-bounce 1.2s infinite;
}
.nsr-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.nsr-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes nsr-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}

/* ── IDENTITY FORM ──────────────────────────────────────────────────────── */
.nsr-identity-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  border-top: 1px solid var(--nsr-border);
}
.nsr-identity-intro { color: var(--nsr-text); font-size: 13px; margin: 0; }

.nsr-input {
  background: var(--nsr-surface);
  border: 1px solid var(--nsr-border);
  border-radius: var(--nsr-radius-sm);
  color: var(--nsr-text);
  font-size: 14px;
  padding: 9px 12px;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--nsr-font);
  transition: border-color 0.15s;
  outline: none;
}
.nsr-input:focus { border-color: var(--nsr-color); }
.nsr-input.nsr-input-error { border-color: #ff4444; }
.nsr-input::placeholder { color: var(--nsr-text-muted); }

.nsr-btn-primary {
  background: var(--nsr-color);
  color: #fff;
  border: none;
  border-radius: var(--nsr-radius-sm);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--nsr-font);
  transition: opacity 0.15s, transform 0.1s;
  width: 100%;
}
.nsr-btn-primary:hover   { opacity: 0.9; }
.nsr-btn-primary:active  { transform: scale(0.98); }

.nsr-btn-secondary {
  background: var(--nsr-surface);
  color: var(--nsr-text);
  border: 1px solid var(--nsr-border);
  border-radius: var(--nsr-radius-sm);
  padding: 9px 18px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--nsr-font);
  transition: background 0.15s;
}
.nsr-btn-secondary:hover { background: var(--nsr-surface-2); }

/* ── INPUT AREA ─────────────────────────────────────────────────────────── */
.nsr-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: var(--nsr-bg-2);
  border-top: 1px solid var(--nsr-border);
  flex-shrink: 0;
}
.nsr-textarea {
  flex: 1;
  background: var(--nsr-surface);
  border: 1px solid var(--nsr-border);
  border-radius: var(--nsr-radius-sm);
  color: var(--nsr-text);
  font-size: 14px;
  line-height: 1.4;
  padding: 9px 12px;
  resize: none;
  font-family: var(--nsr-font);
  max-height: 120px;
  overflow-y: auto;
  outline: none;
  transition: border-color 0.15s;
}
.nsr-textarea:focus   { border-color: var(--nsr-color); }
.nsr-textarea::placeholder { color: var(--nsr-text-muted); }

.nsr-send-btn {
  background: var(--nsr-color);
  border: none;
  border-radius: var(--nsr-radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
}
.nsr-send-btn:hover  { opacity: 0.9; }
.nsr-send-btn:active { transform: scale(0.94); }
.nsr-send-btn svg { width: 18px; height: 18px; }

/* ── CLOSED AREA ────────────────────────────────────────────────────────── */
.nsr-closed-area {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--nsr-border);
  flex-shrink: 0;
}
.nsr-closed-area p { color: var(--nsr-text-muted); font-size: 13px; margin: 0; text-align: center; }

/* ── ERROR ──────────────────────────────────────────────────────────────── */
.nsr-error-msg {
  align-self: center;
  background: rgba(255,68,68,0.15);
  border: 1px solid rgba(255,68,68,0.3);
  border-radius: 20px;
  color: #ff8888;
  font-size: 12px;
  padding: 6px 14px;
}
