/* Widget de Luna (chat + voz + llamada Vapi) y popup — extraído sin cambios de la home anterior (2026-10-01). */
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes fdot { 0%,60%,100% { transform: translateY(0); opacity: .3; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes floatGlow { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-30px) scale(1.06); } }
    /* ══════════════════════════════════════════════ LUNA POPUP MÓVIL */
    .luna-popup {
      display: none; position: fixed; bottom: 104px; right: 16px; z-index: 998;
      width: min(310px, calc(100vw - 32px));
      background: var(--bg2); border: 1px solid rgba(0,212,255,.3);
      border-radius: var(--r-lg); padding: 20px 18px;
      box-shadow: var(--shadow-lg), 0 0 44px rgba(0,212,255,.12);
    }
    .luna-popup.show { display: block; animation: lunaUp .42s cubic-bezier(.34,1.56,.64,1) both; }
    @keyframes lunaUp { from { opacity:0; transform:translateY(20px) scale(.93); } to { opacity:1; transform:none; } }
    .luna-popup__x { position:absolute; top:10px; right:12px; background:none; border:none; color:var(--soft); cursor:pointer; font-size:.85rem; padding:4px; line-height:1; transition:color .2s; }
    .luna-popup__x:hover { color:var(--white); }
    .luna-popup__row { display:flex; align-items:center; gap:11px; margin-bottom:10px; }
    .luna-popup__av { width:42px; height:42px; border-radius:50%; background:var(--grad-main); display:flex; align-items:center; justify-content:center; font-weight:900; color:#000; font-size:.9rem; flex-shrink:0; box-shadow:0 0 18px rgba(0,212,255,.4); animation:floatGlow 4s ease-in-out infinite; }
    .luna-popup__hname { font-size:.82rem; font-weight:800; color:var(--white); }
    .luna-popup__hstatus { font-size:.64rem; color:var(--c4); font-weight:600; display:flex; align-items:center; gap:4px; margin-top:2px; }
    .luna-popup__hstatus::before { content:''; width:5px; height:5px; border-radius:50%; background:var(--c4); box-shadow:0 0 5px var(--c4); animation:blink 2s infinite; }
    .luna-popup__msg { font-size:.84rem; color:var(--text); line-height:1.6; margin-bottom:14px; }
    .luna-popup__btn { width:100%; background:var(--grad-main); border:none; border-radius:999px; padding:11px; font-family:inherit; font-size:.85rem; font-weight:700; color:#000; cursor:pointer; transition:filter .2s,transform .2s; }
    .luna-popup__btn:hover { filter:brightness(1.1); transform:translateY(-1px); }
    /* popup visible en todos los dispositivos */
    /* ══════════════════════════════════════════════ FERNANDO WIDGET */
    #fw { position: fixed; bottom: 28px; right: 28px; z-index: 999; }
    .fw-btn {
      position: relative; width: 62px; height: 62px; border-radius: 50%;
      background: var(--grad-main); border: none; cursor: pointer;
      box-shadow: 0 4px 28px rgba(0,212,255,.5); transition: transform .2s, box-shadow .2s;
      display: flex; align-items: center; justify-content: center;
    }
    .fw-btn:hover { transform: scale(1.1); box-shadow: 0 8px 36px rgba(0,212,255,.65); }
    .fw-btn-av { font-size: 1.3rem; font-weight: 900; color: #000; }
    .fw-pulse { position: absolute; inset: -5px; border-radius: 50%; border: 2px solid rgba(0,212,255,.45); animation: fwPulse 2.5s ease-in-out infinite; pointer-events: none; }
    @keyframes fwPulse { 0%,100% { transform: scale(1); opacity: .7; } 65% { transform: scale(1.25); opacity: 0; } }
    .fw-badge { position: absolute; top: -2px; right: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--c5); border: 2px solid var(--bg0); display: none; }
    .fw-badge.on { display: block; animation: fwBadge .4s ease; }
    @keyframes fwBadge { from { transform: scale(0); } to { transform: scale(1); } }

    .fw-panel {
      position: absolute; bottom: 74px; right: 0; width: 350px;
      background: var(--bg2); border: 1px solid var(--border2);
      border-radius: var(--r-lg); box-shadow: var(--shadow-lg), 0 0 50px rgba(0,212,255,.08);
      display: none; flex-direction: column; overflow: hidden;
    }
    .fw-panel.open { display: flex; animation: fwSlide .22s ease; }
    @keyframes fwSlide { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }

    .fw-head {
      display: flex; align-items: center; gap: 12px; padding: 16px 18px;
      background: rgba(0,212,255,.05); border-bottom: 1px solid var(--border);
    }
    .fw-hav { width: 40px; height: 40px; border-radius: 50%; background: var(--grad-main); display: flex; align-items: center; justify-content: center; font-weight: 900; color: #000; font-size: .88rem; flex-shrink: 0; box-shadow: 0 0 14px rgba(0,212,255,.3); }
    .fw-hname   { font-size: .88rem; font-weight: 800; color: var(--white); }
    .fw-hstatus { font-size: .66rem; color: var(--c4); font-weight: 600; display: flex; align-items: center; gap: 5px; }
    .fw-hstatus::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c4); box-shadow: 0 0 6px var(--c4); animation: blink 2s infinite; }
    .fw-close { margin-left: auto; background: none; border: none; color: var(--soft); cursor: pointer; font-size: .9rem; padding: 4px; transition: color .2s; line-height: 1; }
    .fw-close:hover { color: var(--white); }

    .fw-msgs { flex: 1; min-height: 220px; max-height: 320px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.06) transparent; }
    .fw-m { display: flex; }
    .fw-m--bot  { justify-content: flex-start; }
    .fw-m--user { justify-content: flex-end; }
    .fw-b { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: .82rem; line-height: 1.55; }
    .fw-m--bot  .fw-b { background: rgba(255,255,255,.07); color: var(--text); border-bottom-left-radius: 4px; }
    .fw-m--user .fw-b { background: var(--grad-main); color: #000; font-weight: 600; border-bottom-right-radius: 4px; }
    .fw-typing { display: flex; align-items: center; gap: 4px; padding: 10px 14px; background: rgba(255,255,255,.07); border-radius: 16px; border-bottom-left-radius: 4px; width: fit-content; }
    .fw-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--soft); animation: fdot 1.2s infinite; }
    .fw-typing span:nth-child(2) { animation-delay: .18s; }
    .fw-typing span:nth-child(3) { animation-delay: .36s; }
    .fw-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
    .fw-chip { background: rgba(0,212,255,.08); border: 1px solid rgba(0,212,255,.28); border-radius: 999px; padding: 5px 13px; font-size: .76rem; font-family: inherit; color: var(--c1); cursor: pointer; transition: background .18s, transform .12s; white-space: nowrap; }
    .fw-chip:hover { background: rgba(0,212,255,.18); transform: translateY(-1px); }

    .fw-foot { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-top: 1px solid var(--border); }
    .fw-inp { flex: 1; background: rgba(255,255,255,.05); border: 1.5px solid var(--border); border-radius: 999px; padding: 9px 15px; font-family: inherit; font-size: .83rem; color: var(--white); outline: none; transition: border-color .2s; }
    .fw-inp:focus { border-color: var(--c1); }
    .fw-inp::placeholder { color: rgba(255,255,255,.2); }
    .fw-send { width: 36px; height: 36px; border-radius: 50%; background: var(--grad-main); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #000; flex-shrink: 0; transition: transform .2s, box-shadow .2s; }
    .fw-send:hover { transform: scale(1.1); box-shadow: 0 4px 16px rgba(0,212,255,.4); }
    .fw-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }
    .fw-mic { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.06); border: 1.5px solid rgba(255,255,255,.12); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .2s, border-color .2s, box-shadow .2s; }
    .fw-mic:hover { background: rgba(0,212,255,.1); border-color: rgba(0,212,255,.3); }
    .fw-mic.listening { background: rgba(220,53,69,.15); border-color: rgba(220,53,69,.4); animation: fw-mic-pulse .8s ease-in-out infinite; }
    @keyframes fw-mic-pulse { 0%,100%{box-shadow:none} 50%{box-shadow:0 0 14px rgba(220,53,69,.45)} }

    @media (max-width: 768px) {
      .fw-panel {
        position: fixed !important;
        bottom: 86px !important;
        right: 12px !important;
        left: 12px !important;
        width: auto !important;
        max-height: 72vh;
      }
      .fw-msgs { max-height: calc(72vh - 150px); }
      #fw { bottom: 16px; right: 16px; }
      .fw-btn { width: 54px; height: 54px; }
      /* Evita zoom automático en iOS y mantiene botón visible */
      .fw-inp {
        font-size: 16px !important;
        min-width: 0;
      }
      .fw-foot {
        flex-wrap: nowrap;
        overflow: hidden;
        gap: 6px;
      }
      .fw-send {
        flex-shrink: 0 !important;
        min-width: 36px;
      }
    }
@media (prefers-reduced-motion: reduce) { .luna-popup__av, .fw-pulse, .fw-mic.listening, .fw-typing span, .fw-hstatus::before, .luna-popup__hstatus::before { animation-play-state: paused !important; } .luna-popup.show, .fw-panel.open, .fw-badge.on { animation-duration: .01ms !important; } }
    .fw-btn img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; display: block; }
    .fw-hav img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
    .luna-popup__av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
    .fd-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
