/* =========================
   MAXIQUEEN CHAT
========================= */

.mq-chat {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 99999;
    display: flex;
    width: min(390px, calc(100vw - 24px));
    height: min(640px, calc(100dvh - 32px));
    overflow: hidden;
    flex-direction: column;
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 26px;
    background:
        linear-gradient(135deg, rgba(8, 13, 27, .98), rgba(19, 11, 35, .96)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, .03) 0 1px, transparent 1px 24px);
    box-shadow:
        0 26px 80px rgba(0, 0, 0, .55),
        0 0 34px rgba(45, 212, 191, .11),
        inset 0 1px 0 rgba(255, 255, 255, .09);
    backdrop-filter: blur(22px);
    transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
}

.mq-chat::before {
    position: absolute;
    inset: 0;
    z-index: -1;
    content: "";
    background:
        linear-gradient(90deg, rgba(34, 211, 238, .12), transparent 25%, rgba(244, 114, 182, .1) 62%, transparent),
        linear-gradient(0deg, rgba(250, 204, 21, .07), transparent 28%);
    opacity: .76;
}

.mq-chat-header {
    display: flex;
    min-height: 92px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    background: rgba(3, 7, 18, .64);
}

.mq-agent {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.mq-avatar {
    position: relative;
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border: 1px solid rgba(103, 232, 249, .52);
    border-radius: 18px;
    background:
        linear-gradient(145deg, rgba(15, 23, 42, .95), rgba(22, 78, 99, .78)),
        linear-gradient(45deg, rgba(251, 191, 36, .2), transparent);
    box-shadow:
        0 0 22px rgba(34, 211, 238, .22),
        inset 0 0 18px rgba(255, 255, 255, .06);
}

.mq-antenna {
    position: absolute;
    top: -9px;
    left: 50%;
    width: 2px;
    height: 10px;
    background: #facc15;
    transform: translateX(-50%);
}

.mq-antenna::after {
    position: absolute;
    top: -5px;
    left: 50%;
    width: 8px;
    height: 8px;
    content: "";
    border-radius: 99px;
    background: #22d3ee;
    box-shadow: 0 0 12px rgba(34, 211, 238, .9);
    transform: translateX(-50%);
}

.mq-eye {
    position: absolute;
    top: 20px;
    width: 9px;
    height: 9px;
    border-radius: 99px;
    background: #e0f2fe;
    box-shadow: 0 0 12px rgba(125, 211, 252, .95);
}

.mq-eye-left {
    left: 15px;
}

.mq-eye-right {
    right: 15px;
}

.mq-mouth {
    position: absolute;
    bottom: 14px;
    left: 50%;
    width: 24px;
    height: 5px;
    border-radius: 999px;
    background: #facc15;
    box-shadow: 0 0 12px rgba(250, 204, 21, .65);
    transform: translateX(-50%);
}

.mq-avatar.is-listening {
    animation: avatarListen 1s ease-in-out infinite;
    border-color: rgba(74, 222, 128, .82);
}

.mq-avatar.is-thinking {
    animation: avatarThink 1.2s linear infinite;
}

.mq-avatar.is-speaking .mq-mouth {
    animation: avatarSpeak .22s ease-in-out infinite alternate;
}

.chat-title {
    overflow: hidden;
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: .6px;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-title span {
    color: #facc15;
    text-shadow: 0 0 16px rgba(250, 204, 21, .45);
}

.mq-status {
    max-width: 210px;
    margin-top: 5px;
    overflow: hidden;
    color: #a5f3fc;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.mq-chat-controls {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.mq-chat-controls button,
.mq-chip-btn,
.mq-file-btn,
#mqSendBtn {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .12);
    color: #f8fafc;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.mq-chat-controls button {
    width: 44px;
    height: 38px;
    border-radius: 14px;
    background: rgba(15, 23, 42, .85);
    font-size: 12px;
    font-weight: 800;
}

.mq-chat-controls button:hover,
.mq-chip-btn:hover,
.mq-file-btn:hover,
#mqSendBtn:hover {
    border-color: rgba(34, 211, 238, .5);
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(34, 211, 238, .13);
}

.mq-chat-controls button.is-active {
    border-color: rgba(74, 222, 128, .55);
    background: rgba(22, 101, 52, .32);
    color: #bbf7d0;
}

.mq-signal-bar {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: rgba(15, 23, 42, .36);
}

.mq-signal-bar span {
    min-width: 0;
    overflow: hidden;
    padding: 7px 8px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 999px;
    background: rgba(2, 6, 23, .36);
    color: #dbeafe;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-align: center;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.mq-signal-bar span:nth-child(2) {
    color: #fde68a;
}

.mq-signal-bar span:nth-child(3) {
    color: #f0abfc;
}

.mq-signal-bar span:nth-child(4) {
    color: #86efac;
}

.mq-chat-body {
    display: flex !important;
    flex: 1;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
    scroll-behavior: smooth;
}

.mq-message {
    display: flex;
    width: 100%;
    animation: fadeUp .25s ease;
}

.mq-message.user {
    justify-content: flex-end;
}

.mq-message.bot {
    justify-content: flex-start;
}

.mq-bubble {
    max-width: 84%;
    padding: 14px 15px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.mq-message.bot .mq-bubble {
    color: #f8fafc;
    border: 1px solid rgba(103, 232, 249, .16);
    border-bottom-left-radius: 7px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, .94), rgba(17, 24, 39, .86)),
        linear-gradient(90deg, rgba(34, 211, 238, .12), transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.mq-message.user .mq-bubble {
    color: #111827;
    border-bottom-right-radius: 7px;
    background: linear-gradient(135deg, #fde047, #fb923c);
    font-weight: 750;
    box-shadow: 0 10px 30px rgba(251, 191, 36, .18);
}

.mq-bubble.is-thinking {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #a5f3fc;
}

.mq-bubble.is-thinking::after {
    width: 28px;
    height: 8px;
    content: "";
    border-radius: 999px;
    background:
        radial-gradient(circle at 4px 4px, #22d3ee 0 3px, transparent 4px),
        radial-gradient(circle at 14px 4px, #facc15 0 3px, transparent 4px),
        radial-gradient(circle at 24px 4px, #f472b6 0 3px, transparent 4px);
    animation: typingPulse 1s ease-in-out infinite;
}

.mq-quick-actions {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    align-self: flex-start;
    max-width: 92%;
    margin: -4px 0 4px;
    padding-left: 2px;
}

.mq-quick-action {
    display: inline-flex !important;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(34, 211, 238, .22);
    border-radius: 999px;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, .9), rgba(30, 41, 59, .78)),
        rgba(2, 6, 23, .72);
    color: #dbeafe;
    cursor: pointer;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .03em;
    padding: 8px 11px;
    margin: 0 !important;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease;
}

.mq-quick-action:hover {
    border-color: rgba(250, 204, 21, .58);
    color: #fef3c7;
    box-shadow: 0 0 18px rgba(250, 204, 21, .12);
    transform: translateY(-1px);
}

.mq-attachment-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
    max-height: 118px;
    overflow-y: auto;
    padding: 10px 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(2, 6, 23, .34);
}

.mq-attachment-tray.is-empty {
    display: none;
}

.mq-attachment {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 24px;
    gap: 8px;
    width: 100%;
    align-items: center;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: rgba(15, 23, 42, .68);
}

.mq-attachment-thumb {
    display: flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(34, 211, 238, .12);
    color: #facc15;
    font-size: 11px;
    font-weight: 900;
}

.mq-attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mq-attachment-name {
    overflow: hidden;
    color: #f8fafc;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mq-attachment-meta {
    margin-top: 2px;
    color: #94a3b8;
    font-size: 11px;
}

.mq-remove-attachment {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 8px;
    background: rgba(248, 113, 113, .16);
    color: #fecaca;
    cursor: pointer;
}

.mq-voice-panel {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 14px 0;
    background: rgba(2, 6, 23, .55);
}

.mq-chip-btn {
    height: 36px;
    border-radius: 12px;
    background: rgba(15, 23, 42, .78);
    color: #dbeafe;
    font-size: 12px;
    font-weight: 850;
}

.mq-chip-btn.is-active {
    border-color: rgba(74, 222, 128, .62);
    background: rgba(22, 101, 52, .34);
    color: #bbf7d0;
}

.mq-chat-input {
    display: grid !important;
    grid-template-columns: 46px minmax(0, 1fr) 86px;
    gap: 10px;
    align-items: center;
    padding: 12px 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(2, 6, 23, .55);
}

.mq-file-btn {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    background: rgba(34, 211, 238, .12);
    color: #a5f3fc;
    font-size: 28px;
    font-weight: 500;
    line-height: 1;
}

.mq-file-btn input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#mqInput {
    width: 100%;
    height: 46px;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 15px;
    outline: none;
    padding: 0 14px;
    background: rgba(15, 23, 42, .82);
    color: #fff;
    font-size: 14px;
}

#mqInput::placeholder {
    color: #64748b;
}

#mqInput:focus {
    border-color: rgba(250, 204, 21, .52);
    box-shadow: 0 0 0 3px rgba(250, 204, 21, .1);
}

#mqSendBtn {
    width: 86px;
    height: 46px;
    border-radius: 15px;
    background: linear-gradient(135deg, #fde047, #22d3ee);
    color: #020617;
    font-size: 13px;
    font-weight: 950;
}

#mqSendBtn:disabled {
    cursor: wait;
    opacity: .62;
    transform: none;
}

.mq-chat-body::-webkit-scrollbar,
.mq-attachment-tray::-webkit-scrollbar {
    width: 6px;
}

.mq-chat-body::-webkit-scrollbar-thumb,
.mq-attachment-tray::-webkit-scrollbar-thumb {
    border-radius: 20px;
    background: rgba(34, 211, 238, .45);
}

.mq-chat.minimized {
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px) scale(.96);
    visibility: hidden;
}

.mq-chat.minimized .mq-signal-bar,
.mq-chat.minimized .mq-chat-body,
.mq-chat.minimized .mq-attachment-tray,
.mq-chat.minimized .mq-voice-panel,
.mq-chat.minimized .mq-chat-input {
    display: none;
}

.mq-burbuja-v2 {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99998;
    width: 86px;
    height: 86px;
    overflow: hidden;
    border: 1px solid rgba(250, 204, 21, .42);
    border-radius: 999px;
    background:
        radial-gradient(circle at 50% 35%, rgba(250, 204, 21, .18), transparent 55%),
        rgba(2, 6, 23, .92);
    box-shadow:
        0 18px 42px rgba(0, 0, 0, .42),
        0 0 30px rgba(250, 204, 21, .22);
    cursor: pointer;
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.mq-chat:not(.minimized) + .mq-burbuja-v2 {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(12px) scale(.92);
}

.mq-burbuja-v2:hover {
    transform: translateY(-3px) scale(1.03);
}

.mq-burbuja-v2.is-hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(12px) scale(.92);
}

.mq-video-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes avatarSpeak {
    from {
        height: 4px;
        width: 18px;
    }

    to {
        height: 12px;
        width: 28px;
    }
}

@keyframes avatarListen {
    0%,
    100% {
        box-shadow: 0 0 16px rgba(74, 222, 128, .2), inset 0 0 18px rgba(255, 255, 255, .06);
    }

    50% {
        box-shadow: 0 0 30px rgba(74, 222, 128, .38), inset 0 0 18px rgba(255, 255, 255, .06);
    }
}

@keyframes avatarThink {
    from {
        filter: hue-rotate(0deg);
    }

    to {
        filter: hue-rotate(45deg);
    }
}

@keyframes typingPulse {
    0%,
    100% {
        opacity: .35;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(-1px);
    }
}

@media (max-width: 560px) {
    .mq-chat {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
    }

    .mq-chat-header {
        min-height: 84px;
        padding: 13px 12px;
    }

    .mq-avatar {
        width: 50px;
        height: 50px;
        border-radius: 16px;
    }

    .chat-title {
        font-size: 18px;
    }

    .mq-status {
        max-width: 160px;
    }

    .mq-chat-controls button {
        width: 40px;
        height: 36px;
    }

    .mq-signal-bar {
        gap: 6px;
        padding: 9px 10px;
    }

    .mq-signal-bar span {
        padding: 6px 4px;
        font-size: 9px;
        letter-spacing: .05em;
    }

    .mq-chat-body {
        padding: 14px 12px;
    }

    .mq-bubble {
        max-width: 90%;
        font-size: 13.5px;
    }

    .mq-voice-panel {
        gap: 6px;
        padding: 10px 10px 0;
    }

    .mq-chip-btn {
        height: 34px;
        font-size: 11px;
    }

    .mq-chat-input {
        grid-template-columns: 42px minmax(0, 1fr) 76px;
        gap: 8px;
        padding: 10px;
    }

    .mq-file-btn,
    #mqInput,
    #mqSendBtn {
        height: 44px;
        border-radius: 14px;
    }

    .mq-file-btn {
        width: 42px;
    }

    #mqSendBtn {
        width: 76px;
        font-size: 12px;
    }

    .mq-burbuja-v2 {
        right: 16px;
        bottom: 16px;
        width: 72px;
        height: 72px;
    }
}
