/* ============================================================
   VOICE WIDGET (Llamada con IA)
   Extraído de style.css para que las páginas rediseñadas
   puedan conservar el widget sin cargar el CSS legacy completo.
   No modificar la funcionalidad: solo estilos del botón/modal.
   ============================================================ */
.voice-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}

.voice-widget__btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #663399, #9D6CFF);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(102, 51, 153, 0.5), 0 0 40px rgba(157, 108, 255, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: voice-widget-pulse 2s ease-in-out infinite;
}

.voice-widget__btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(102, 51, 153, 0.6), 0 0 50px rgba(157, 108, 255, 0.4);
}

.voice-widget__btn .voice-widget__btn-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: #fff;
}

@keyframes voice-widget-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(102, 51, 153, 0.5), 0 0 40px rgba(157, 108, 255, 0.3); }
  50% { box-shadow: 0 4px 24px rgba(102, 51, 153, 0.65), 0 0 55px rgba(157, 108, 255, 0.45); }
}

.voice-widget__modal {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 320px;
  display: none;
  flex-direction: column;
  background: rgba(20, 18, 32, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(157, 108, 255, 0.35);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.05);
  overflow: hidden;
}

.voice-widget__modal.is-open {
  display: flex;
}

.voice-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(157, 108, 255, 0.2);
}

.voice-widget__title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.voice-widget__close {
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  line-height: 1 !important;
  padding: 0 !important;
  margin: 0 !important;
  margin-top: -2px !important;
  border: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  font-size: 1.4rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.voice-widget__close *,
.voice-widget__close span,
.voice-widget__close i,
.voice-widget__close svg {
  margin: 0 !important;
  padding: 0 !important;
  display: block;
}

.voice-widget__close:hover {
  background: rgba(255,255,255,0.15);
}

.voice-widget__body {
  padding: 28px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-widget__circle-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-widget__wave {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(157, 108, 255, 0.4);
  animation: none;
  opacity: 0;
  pointer-events: none;
}

.voice-widget__circle-wrap.llamada-activa .voice-widget__wave {
  animation: voice-widget-wave 2.5s ease-out infinite;
  opacity: 1;
}

.voice-widget__circle-wrap.llamada-activa .voice-widget__wave--1 { animation-delay: 0s; }
.voice-widget__circle-wrap.llamada-activa .voice-widget__wave--2 { animation-delay: 0.5s; }
.voice-widget__circle-wrap.llamada-activa .voice-widget__wave--3 { animation-delay: 1s; }
.voice-widget__circle-wrap.llamada-activa .voice-widget__wave--4 { animation-delay: 1.5s; }

@keyframes voice-widget-wave {
  0% {
    transform: scale(0.4);
    opacity: 0.9;
    border-color: rgba(157, 108, 255, 0.5);
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
    border-color: rgba(157, 108, 255, 0.15);
  }
}

.voice-widget__circle {
  position: relative;
  z-index: 2;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(102, 51, 153, 0.5), rgba(157, 108, 255, 0.35));
  border: 2px solid rgba(157, 108, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: inset 0 2px 12px rgba(255,255,255,0.1), 0 4px 20px rgba(102, 51, 153, 0.3);
  padding: 0;
  overflow: hidden;
}

.voice-widget__circle .modal-robot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transform: scale(1.2);
}

.voice-widget__footer {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(157, 108, 255, 0.2);
}

.voice-widget__end {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #663399, #9D6CFF);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s, background 0.25s;
}

.voice-widget__end:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.voice-widget__end.voice-widget__end--active {
  background: linear-gradient(180deg, #dc3545, #c82333);
}

.voice-widget__send {
  width: 100%;
  margin-top: 8px;
  padding: 10px 16px;
  border: 2px solid rgba(157, 108, 255, 0.6);
  border-radius: 12px;
  background: transparent;
  color: rgba(255,255,255,0.9);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, background 0.2s;
}

.voice-widget__send:hover:not(:disabled) {
  background: rgba(157, 108, 255, 0.2);
}

.voice-widget__send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.voice-widget__hint {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  text-align: center;
}

/* ===== Voice widget: bottom sheet en móvil (< 768px) ===== */
@media (max-width: 767px) {
  .voice-widget {
    bottom: 16px;
    right: 16px;
  }

  .voice-widget__btn {
    width: 52px;
    height: 52px;
    bottom: 16px;
    right: 16px;
  }

  .voice-widget__btn .voice-widget__btn-icon {
    width: 24px;
    height: 24px;
  }

  .voice-widget__modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    top: auto;
    border-radius: 20px 20px 0 0;
    padding: 12px 16px  max(12px, env(safe-area-inset-bottom));
    display: none;
    flex-direction: column;
    gap: 0;
  }

  .voice-widget__modal.is-open {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "avatar header header"
      "avatar hint   hint"
      "button button button";
    align-items: center;
  }

  .voice-widget__header {
    grid-area: header;
    padding: 0 0 0 8px;
    border-bottom: none;
    align-items: center;
    justify-content: space-between;
  }

  .voice-widget__body {
    grid-area: avatar;
    padding: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
  }

  .voice-widget__circle-wrap {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }

  .voice-widget__circle {
    width: 44px;
    height: 44px;
  }

  .voice-widget__circle .modal-robot-img {
    transform: scale(1);
  }

  .voice-widget__footer {
    display: contents;
    padding: 0;
    border-top: none;
  }

  .voice-widget__hint {
    grid-area: hint;
    margin: 0;
    padding-left: 8px;
    text-align: left;
    font-size: 0.7rem;
    line-height: 1.3;
  }

  .voice-widget__end {
    grid-area: button;
    margin-top: 10px;
    padding: 14px 16px;
    border-radius: 12px;
    min-height: 48px;
  }

  .voice-widget__title {
    font-size: 0.9rem;
  }

  .voice-widget__close {
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 18px !important;
    line-height: 1 !important;
    border: none !important;
    cursor: pointer !important;
  }

  .voice-widget__close *,
  .voice-widget__close span,
  .voice-widget__close i {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    line-height: 0.8 !important;
  }
}
