/* ============================================
   MAYORAZGO IA — Styles
   Fuente: Montserrat
   Colores: #4EB1B6 (teal), #444444 (gris), #FFFFFF
   ============================================ */

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

:root {
  --teal:          #4EB1B6;
  --teal-dark:     #3a9499;
  --teal-light:    #e8f7f8;
  --gray-text:     #444444;
  --gray-light:    #888888;
  --gray-border:   #e4e8ea;
  --gray-bg:       #f7f9fa;
  --white:         #ffffff;
  --green-wa:      #25D366;
  --red-hang:      #ef4444;
  --red-hang-dark: #dc2626;

  --font:          'Montserrat', sans-serif;
  --radius:        16px;
  --radius-sm:     10px;
  --shadow-sm:     0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:     0 2px 12px rgba(0,0,0,0.09);
  --shadow-lg:     0 6px 24px rgba(0,0,0,0.11);

  --header-h:      60px;
  --tabs-h:        48px;
}

html {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  color: var(--gray-text);
  background: var(--gray-bg);
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  flex-shrink: 0;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-border);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.header-inner {
  max-width: 760px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--gray-text);
  letter-spacing: -0.3px;
}

.logo-badge {
  background: var(--teal);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--green-wa);
  color: var(--white);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.18s, transform 0.18s;
  white-space: nowrap;
}

.btn-whatsapp:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

/* ============================================
   TABS NAV
   ============================================ */
.tabs-nav {
  flex-shrink: 0;
  height: var(--tabs-h);
  background: var(--white);
  border-bottom: 2px solid var(--gray-border);
  z-index: 9;
}

.tabs-nav-inner {
  max-width: 760px;
  margin: 0 auto;
  height: 100%;
  display: flex;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 28px;
  height: 100%;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-light);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
  user-select: none;
}

.tab-btn:hover {
  color: var(--teal);
}

.tab-btn.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
  font-weight: 600;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  align-self: stretch;
}

/* Full-width container trick */
body > .main-content {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

/* ============================================
   PANELS
   ============================================ */
.panel {
  display: none;
  flex: 1;
  overflow: hidden;
}

.panel.active {
  display: flex;
  flex-direction: column;
}

/* ============================================
   CHAT LAYOUT
   ============================================ */
.chat-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* ============================================
   CHAT EMPTY STATE
   ============================================ */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  gap: 28px;
}

.chat-empty__logo {
  height: 64px;
  width: auto;
  opacity: 0.85;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 520px;
}

.faq-chip {
  padding: 13px 18px;
  text-align: left;
  font-size: 13px;
  border: 1.5px solid var(--teal);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.12s;
  color: var(--teal);
  font-family: var(--font);
  font-weight: 500;
  line-height: 1.4;
}

.faq-chip:hover {
  background: var(--teal);
  color: var(--white);
  transform: translateY(-1px);
}

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

/* ============================================
   MESSAGES
   ============================================ */
.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 82%;
  animation: msgIn 0.2s ease-out;
}

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

.message--ai {
  align-self: flex-start;
}

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

.message__avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.message__bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.65;
}

.message--ai .message__bubble {
  background: var(--white);
  border: 1px solid var(--gray-border);
  border-top-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  color: var(--gray-text);
}

.message--ai .message__bubble p + p {
  margin-top: 6px;
}

.message--user .message__bubble {
  background: var(--teal);
  color: var(--white);
  border-top-right-radius: 4px;
}

/* ============================================
   TYPING INDICATOR
   ============================================ */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--gray-light);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-7px); opacity: 1; }
}

/* ============================================
   INPUT BAR
   ============================================ */
.input-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 20px;
  background: var(--white);
  border-top: 1px solid var(--gray-border);
}

.input-bar-inner {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chat-input {
  flex: 1;
  border: 1.5px solid var(--gray-border);
  border-radius: 28px;
  padding: 11px 20px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-text);
  background: var(--gray-bg);
  outline: none;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  overflow-y: hidden;
  line-height: 1.5;
  transition: border-color 0.2s, background 0.2s;
}

.chat-input:focus {
  border-color: var(--teal);
  background: var(--white);
}

.chat-input::placeholder {
  color: var(--gray-light);
}

.send-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--teal);
  border: none;
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, transform 0.18s;
}

.send-btn:hover:not(:disabled) {
  background: var(--teal-dark);
  transform: scale(1.07);
}

.send-btn:disabled {
  background: var(--gray-border);
  cursor: default;
}

.input-hint {
  font-size: 11px;
  color: var(--gray-light);
  text-align: center;
}

/* ============================================
   VOICE LAYOUT
   ============================================ */
.voice-layout {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  overflow-y: auto;
}

.voice-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 44px 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  animation: msgIn 0.25s ease-out;
}

.voice-icon-wrap {
  width: 84px;
  height: 84px;
  background: var(--teal-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 22px;
  color: var(--teal);
  transition: box-shadow 0.3s;
}

.voice-icon-wrap.is-calling {
  animation: pulsing 1.6s infinite ease-out;
}

@keyframes pulsing {
  0%   { box-shadow: 0 0 0 0 rgba(78, 177, 182, 0.45); }
  70%  { box-shadow: 0 0 0 22px rgba(78, 177, 182, 0); }
  100% { box-shadow: 0 0 0 0 rgba(78, 177, 182, 0); }
}

.voice-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-text);
  margin-bottom: 8px;
}

.voice-subtitle {
  font-size: 14px;
  color: var(--gray-light);
  margin-bottom: 22px;
  line-height: 1.5;
}

.voice-list {
  list-style: none;
  text-align: left;
  display: inline-block;
  margin-bottom: 34px;
}

.voice-list li {
  font-size: 14px;
  color: var(--gray-text);
  padding: 5px 0 5px 24px;
  position: relative;
  line-height: 1.5;
}

.voice-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--teal);
  font-weight: 700;
}

/* ============================================
   CALL BUTTON
   ============================================ */
.call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 36px;
  border-radius: 50px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.18s, box-shadow 0.18s;
  min-width: 200px;
}

.call-btn--idle {
  background: var(--teal);
  color: var(--white);
}

.call-btn--idle:hover {
  background: var(--teal-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(78, 177, 182, 0.38);
}

.call-btn--calling {
  background: var(--gray-light);
  color: var(--white);
  cursor: default;
}

.call-btn--active {
  background: var(--red-hang);
  color: var(--white);
}

.call-btn--active:hover {
  background: var(--red-hang-dark);
}

.call-status {
  margin-top: 18px;
  font-size: 13px;
  color: var(--gray-light);
  min-height: 20px;
  line-height: 1.5;
}

/* ============================================
   WAVEFORM
   ============================================ */
.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 52px;
  margin: 4px 0 20px;
  width: 100%;
}

.bar {
  flex: 1;
  max-width: 10px;
  border-radius: 3px;
  background: var(--teal);
  animation: waveBar 1s infinite ease-in-out;
  height: 8px;
}

.bar:nth-child(1) { animation-delay: 0.0s; }
.bar:nth-child(2) { animation-delay: 0.1s; }
.bar:nth-child(3) { animation-delay: 0.2s; }
.bar:nth-child(4) { animation-delay: 0.3s; }
.bar:nth-child(5) { animation-delay: 0.2s; }
.bar:nth-child(6) { animation-delay: 0.1s; }
.bar:nth-child(7) { animation-delay: 0.0s; }

@keyframes waveBar {
  0%, 100% { height: 8px;  opacity: 0.45; }
  50%       { height: 40px; opacity: 1;    }
}

.waveform.agent-talking .bar {
  animation-duration: 0.5s;
  background: var(--teal);
}

.waveform.user-talking .bar {
  animation-duration: 0.75s;
  background: var(--gray-text);
}

/* Modo live: JS controla las alturas, desactivamos la animación CSS */
.waveform.is-live .bar {
  animation: none;
  transition: height 0.06s ease-out, opacity 0.06s ease-out;
}

/* ============================================
   TRANSCRIPT
   ============================================ */
.transcript-box {
  width: 100%;
  border: 1.5px solid var(--gray-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 24px;
  text-align: left;
}

.transcript-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: var(--gray-bg);
  border-bottom: 1px solid var(--gray-border);
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.transcript-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: dotPulse 1.2s infinite;
  flex-shrink: 0;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.transcript-messages {
  max-height: 180px;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.transcript-msg {
  display: flex;
  gap: 6px;
}

.transcript-msg__role {
  font-weight: 700;
  flex-shrink: 0;
  font-size: 12px;
}

.transcript-msg--agent .transcript-msg__role { color: var(--teal); }
.transcript-msg--user  .transcript-msg__role { color: var(--gray-text); }

.transcript-msg__text { color: var(--gray-text); }

.hidden { display: none !important; }

/* ============================================
   SCROLLBAR
   ============================================ */
.messages-area::-webkit-scrollbar {
  width: 5px;
}
.messages-area::-webkit-scrollbar-track {
  background: transparent;
}
.messages-area::-webkit-scrollbar-thumb {
  background: var(--gray-border);
  border-radius: 3px;
}
.messages-area::-webkit-scrollbar-thumb:hover {
  background: #c8cdd0;
}

/* ============================================
   RESPONSIVE — Mobile
   ============================================ */
@media (max-width: 600px) {
  .logo-name {
    font-size: 17px;
  }
  .tab-btn {
    padding: 0 20px;
    font-size: 13px;
  }
  .messages-area {
    padding: 16px 14px;
  }
  .input-bar {
    padding: 10px 14px;
  }
  .message {
    max-width: 92%;
  }
  .voice-card {
    padding: 32px 22px;
  }
}
