/* ============================================================
   FAY PUBLICIDAD — Dark Chat Interface (Red Theme)
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --red: #E30613;
  --red-light: #ff4444;
  --red-glow: rgba(227, 6, 19, 0.5);
  --white: #ffffff;
  --bg-main: #0a0a0f;
  --bg-ai-bubble: #1a1a24;
  --bg-header: #ffffff;
  --text-primary: #f0f0f0;
  --text-muted: #888;
  --border-subtle: rgba(227, 6, 19, 0.15);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

html {
  height: 100%;
  height: -webkit-fill-available;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  overflow: hidden;
}

body {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  position: relative;
  height: 130px;
  flex-shrink: 0;
  background: var(--bg-header);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  overflow: hidden;
}

.particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Override particle connections for white bg */
.site-header .particle-canvas {
  opacity: 0.6;
}

.header-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  pointer-events: none;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.logo-img {
  height: 90px;
  width: auto;
  display: block;
  animation: logoFloat 4s ease-in-out infinite, logoGlow 3s ease-in-out infinite;
  transform-origin: center bottom;
  will-change: transform, filter;
}

.logo-img:hover {
  animation: logoFloatHover 0.4s ease forwards, logoGlowBurst 0.4s ease forwards;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-9px) scale(1.04); }
}

@keyframes logoFloatHover {
  to { transform: translateY(-12px) scale(1.08); }
}

@keyframes logoGlow {
  0%, 100% {
    filter:
      drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1))
      drop-shadow(0 0 6px rgba(227, 6, 19, 0.15));
  }
  50% {
    filter:
      drop-shadow(0 6px 20px rgba(0, 0, 0, 0.15))
      drop-shadow(0 0 14px rgba(227, 6, 19, 0.3));
  }
}

@keyframes logoGlowBurst {
  to {
    filter:
      drop-shadow(0 8px 24px rgba(0, 0, 0, 0.2))
      drop-shadow(0 0 18px rgba(227, 6, 19, 0.4));
  }
}

/* ============================================================
   MAIN — CHAT
   ============================================================ */

.chat-main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

/* ============================================================
   MESSAGES
   ============================================================ */

.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.messages-area::-webkit-scrollbar { width: 6px; }
.messages-area::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb {
  background: rgba(227, 6, 19, 0.2);
  border-radius: 3px;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: fadeSlideUp 0.3s ease forwards;
  opacity: 0;
}

.message-user { flex-direction: row-reverse; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Avatar */
.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), #8b0000);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.message-user .message-avatar {
  background: linear-gradient(135deg, #333, #1a1a1a);
  color: #fff;
  font-size: 0.6rem;
}

/* Bubbles */
.message-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.6;
  font-size: 0.92rem;
  word-break: break-word;
  overflow-wrap: break-word;
}

.message-ai .message-bubble {
  background: var(--bg-ai-bubble);
  border: 1px solid var(--border-subtle);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

.message-user .message-bubble {
  background: var(--red);
  border-top-right-radius: 4px;
  color: #fff;
}

.message-bubble p { margin: 0; }
.message-bubble p + p { margin-top: 8px; }
.message-bubble strong { color: var(--red-light); }
.message-user .message-bubble strong { color: #ffd1d1; }

/* ============================================================
   TYPING INDICATOR
   ============================================================ */

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  animation: fadeSlideUp 0.2s ease forwards;
  opacity: 0;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-ai-bubble);
  border: 1px solid var(--border-subtle);
  padding: 12px 16px;
  border-radius: 18px;
  border-top-left-radius: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  opacity: 0.4;
  animation: dotBounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-7px); opacity: 1; }
}

/* ============================================================
   INPUT AREA
   ============================================================ */

.input-area {
  padding: 12px 0 16px;
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #12121c;
  border: 1px solid rgba(227, 6, 19, 0.2);
  border-radius: 16px;
  padding: 10px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.1), 0 0 20px rgba(227, 6, 19, 0.05);
  animation: borderGlow 2s ease-in-out infinite;
}

@keyframes borderGlow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.1), 0 0 20px rgba(227, 6, 19, 0.05); }
  50%       { box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.2), 0 0 30px rgba(227, 6, 19, 0.12); }
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  max-height: 140px;
  overflow-y: auto;
  font-family: inherit;
}

.chat-input::placeholder { color: var(--text-muted); }
.chat-input::-webkit-scrollbar { width: 4px; }
.chat-input::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--red), #8b0000);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.send-btn:hover {
  transform: scale(1.07);
  box-shadow: 0 4px 14px rgba(227, 6, 19, 0.4);
}

.send-btn:active { transform: scale(0.95); }

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.input-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

.input-hint kbd {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 0.68rem;
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  position: relative;
  height: 70px;
  flex-shrink: 0;
  background: var(--bg-main);
  border-top: 1px solid var(--border-subtle);
  overflow: hidden;
}

.footer-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 2px;
  pointer-events: none;
}

.footer-text { font-size: 0.73rem; color: var(--text-muted); }
.footer-powered { font-size: 0.68rem; color: rgba(136, 136, 136, 0.7); }

.footer-link {
  pointer-events: all;
  color: var(--red-light);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-link:hover { opacity: 1; }

/* ============================================================
   QUICK OPTIONS — Welcome buttons
   ============================================================ */

.quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-btn {
  background: rgba(227, 6, 19, 0.08);
  border: 1px solid rgba(227, 6, 19, 0.3);
  border-radius: 20px;
  color: var(--red-light);
  font-size: 0.82rem;
  font-family: inherit;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.quick-btn:hover {
  background: rgba(227, 6, 19, 0.15);
  border-color: rgba(227, 6, 19, 0.6);
  transform: translateY(-1px);
}

/* ============================================================
   LEAD CAPTURE FORM
   ============================================================ */

.lead-bubble { max-width: 88% !important; }

.lead-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.lead-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(227, 6, 19, 0.2);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s;
}

.lead-input:focus { border-color: var(--red); }
.lead-input::placeholder { color: var(--text-muted); }

.lead-submit {
  background: linear-gradient(135deg, var(--red), #8b0000);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px 20px;
  align-self: flex-start;
  transition: opacity 0.2s, transform 0.15s;
}

.lead-submit:hover { opacity: 0.9; transform: translateY(-1px); }
.lead-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ============================================================
   INPUT FOOTER
   ============================================================ */

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.new-chat-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  padding: 2px 0;
  flex-shrink: 0;
  transition: color 0.2s;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: transparent;
}

.new-chat-btn:hover {
  color: var(--red-light);
  text-decoration-color: var(--red-light);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
  .site-header { height: 80px; }
  .logo-img { height: 56px; }
  .site-footer { display: none; }

  .messages-area { gap: 12px; padding: 14px 0 8px; }
  .message-bubble { max-width: 88%; font-size: 0.88rem; }
  .message-avatar { width: 30px; height: 30px; flex-shrink: 0; font-size: 0.45rem; }
  .chat-container { padding: 0 12px; }

  .chat-input { font-size: 16px; max-height: 100px; }
  .input-hint { display: none; }
  .input-footer { justify-content: flex-end; }
  .input-area { padding: 10px 0 calc(14px + env(safe-area-inset-bottom, 0px)); }
  .send-btn { width: 44px; height: 44px; border-radius: 12px; }
  .quick-btn { font-size: 0.8rem; padding: 8px 14px; }
  .lead-bubble { max-width: 95% !important; }
  .lead-input { font-size: 16px; padding: 12px 14px; }
  .lead-submit { padding: 12px 20px; }
}
