/* ============================================
   Asistente macOS Store — Widget de chat flotante
   Paleta: negro profundo + dorado metálico
   ============================================ */

#macos-ai-root { display: none; }

.mos-ai-gold {
    --ai-gold: #d4af37;
    --ai-gold-light: #f7e7a3;
    --ai-gold-dark: #b8860b;
}

.mos-brand-mark { font-weight: 800; font-family: "Segoe UI", system-ui, sans-serif; letter-spacing: .3px; }
.mos-brand-mark .mos-label { color: #f7e7a3; }
.mos-brand-mark .num { color: #d4af37; }

/* Avatar del pato (mascota macOS Store) */
.mos-duck {
    width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block;
}
.mos-toggle-logo {
    width: 46px; height: 46px; border-radius: 50%; overflow: hidden; display: block;
    border: 1px solid rgba(247, 231, 163, .55);
}

/* Botón flotante */
.mos-toggle {
    position: fixed; right: 20px; bottom: 20px; z-index: 2147483000;
    width: 62px; height: 62px; border-radius: 50%; cursor: pointer;
    border: 1px solid rgba(212, 175, 55, .55);
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    box-shadow: 0 8px 26px rgba(212, 175, 55, .34);
    display: flex; align-items: center; justify-content: center; padding: 0;
    transition: transform .18s ease, box-shadow .18s ease;
}
.mos-toggle:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 34px rgba(212, 175, 55, .5); }
.mos-badge {
    position: absolute; top: 8px; right: 8px; width: 11px; height: 11px;
    background: #22c55e; border-radius: 50%; border: 2px solid #0a0a0a;
}

/* Ventana de chat */
.mos-chat {
    position: fixed; right: 20px; bottom: 92px; z-index: 2147483000;
    width: 380px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 120px);
    background: #0d0d10; border-radius: 18px; overflow: hidden;
    border: 1px solid rgba(212, 175, 55, .28);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .7);
    display: flex; flex-direction: column;
    opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
    color: #ececf1;
}
.mos-chat.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.mos-header {
    background: linear-gradient(135deg, #1b1608 0%, #0a0a0a 100%);
    border-bottom: 1px solid rgba(212, 175, 55, .3);
    color: #f7e7a3;
    padding: 14px 16px; display: flex; align-items: center; gap: 12px;
}
.mos-header-avatar {
    width: 42px; height: 42px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
    border: 1px solid rgba(212, 175, 55, .6);
    display: flex; align-items: center; justify-content: center;
}
.mos-header-info { flex: 1; }
.mos-header-info h4 { margin: 0; font-size: 15px; font-weight: 700; color: #f7e7a3; }
.mos-header-info span { font-size: 12px; color: #9a9aa4; }
.mos-header-info span::before {
    content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: #22c55e; margin-right: 6px;
}
.mos-header-minimize {
    background: transparent; border: none; color: #d4af37; cursor: pointer;
    width: 32px; height: 32px; border-radius: 8px; opacity: .9;
}
.mos-header-minimize:hover { background: rgba(212, 175, 55, .16); }
.mos-header-minimize svg { width: 22px; height: 22px; fill: currentColor; }

.mos-body { flex: 1; display: flex; flex-direction: column; background: #0d0d10; overflow: hidden; }
.mos-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.mos-msg { display: flex; gap: 8px; max-width: 88%; }
.mos-msg.user { align-self: flex-end; }
.mos-msg.bot { align-self: flex-start; }
.mos-msg-avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
    border: 1px solid rgba(212, 175, 55, .5);
    display: flex; align-items: center; justify-content: center;
}
.mos-bubble {
    padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45; word-wrap: break-word;
}
.mos-msg.bot .mos-bubble {
    background: #17171b; color: #ececf1; border: 1px solid rgba(212, 175, 55, .16);
    border-bottom-left-radius: 4px;
}
.mos-msg.bot .mos-bubble strong { color: #f7e7a3; }
.mos-msg.user .mos-bubble {
    background: linear-gradient(135deg, #b8860b 0%, #d4af37 50%, #f7e7a3 100%);
    color: #0a0a0a; font-weight: 600; border-bottom-right-radius: 4px;
}
.mos-time { font-size: 10px; color: #6f6f78; margin-top: 3px; padding: 0 4px; }
.mos-msg.user .mos-time { text-align: right; }

.mos-typing { display: none; align-items: center; gap: 8px; padding: 0 16px 6px; }
.mos-typing.show { display: flex; }
.mos-typing-dots {
    background: #17171b; border: 1px solid rgba(212, 175, 55, .16);
    border-radius: 14px; padding: 12px 14px; display: flex; gap: 4px;
}
.mos-typing-dots span { width: 7px; height: 7px; background: #d4af37; border-radius: 50%; animation: mosBounce 1.2s infinite; }
.mos-typing-dots span:nth-child(2) { animation-delay: .2s; }
.mos-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes mosBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.mos-quick { padding: 0 16px 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.mos-quick-btn {
    background: rgba(212, 175, 55, .07); border: 1px solid rgba(212, 175, 55, .34); color: #f7e7a3;
    border-radius: 18px; padding: 7px 13px; font-size: 13px; cursor: pointer; transition: all .15s ease;
}
.mos-quick-btn:hover {
    background: linear-gradient(135deg, #b8860b 0%, #d4af37 100%); color: #0a0a0a; border-color: #d4af37;
}

.mos-input-area {
    display: flex; align-items: flex-end; gap: 8px; padding: 12px;
    background: #0a0a0c; border-top: 1px solid rgba(212, 175, 55, .18);
}
.mos-input {
    flex: 1; resize: none; border: 1px solid rgba(212, 175, 55, .26); border-radius: 14px;
    padding: 10px 14px; background: #131316; color: #ececf1;
    font-size: 14px; font-family: inherit; max-height: 96px; outline: none;
}
.mos-input::placeholder { color: #6f6f78; }
.mos-input:focus { border-color: #d4af37; }
.mos-send {
    width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0;
    background: linear-gradient(135deg, #b8860b 0%, #d4af37 50%, #f7e7a3 100%); color: #0a0a0a;
    display: flex; align-items: center; justify-content: center;
}
.mos-send svg { width: 20px; height: 20px; fill: currentColor; }
.mos-send:hover { filter: brightness(1.08); }

.mos-chat-footer {
    text-align: center; font-size: 11px; color: #6f6f78; padding: 6px;
    background: #0a0a0c; border-top: 1px solid rgba(212, 175, 55, .1);
}
.mos-chat-footer strong { color: #d4af37; }

@media (max-width: 480px) {
    .mos-chat {
        right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0;
    }
    .mos-chat.mos-keyboard-open { height: var(--mos-vv-height, 100dvh); }
    body.mos-chat-open { overflow: hidden; }
}
