/* ============================================================
   MOS AI Chatbot — floating widget
   ============================================================ */

.mos-chat {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 850;
    font-family: 'DM Sans', sans-serif;
}

/* ── Toggle button ───────────────────────────────────────── */
.mos-chat-toggle {
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 1px solid rgba(0, 212, 255, 0.4);
    background: radial-gradient(circle at 35% 30%, var(--ocean), var(--deep) 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.5), 0 8px 24px rgba(0, 0, 0, 0.45);
    animation: mc-breathe 3.2s ease-in-out infinite;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.25s ease, box-shadow 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.mos-chat-toggle:hover {
    transform: scale(1.08);
    border-color: var(--cyan);
}

.mos-chat-toggle:active {
    transform: scale(0.94);
}

.mos-chat-toggle-logo,
.mos-chat-toggle-close {
    position: absolute;
    transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mos-chat-toggle-logo {
    width: 30px;
    height: auto;
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.mos-chat-toggle-close {
    font-size: 26px;
    line-height: 1;
    color: var(--cyan);
    font-weight: 300;
    opacity: 0;
    transform: rotate(-90deg) scale(0.4);
}

.mos-chat.is-open .mos-chat-toggle-logo {
    opacity: 0;
    transform: rotate(90deg) scale(0.4);
}

.mos-chat.is-open .mos-chat-toggle-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.mos-chat.is-open .mos-chat-toggle {
    animation: none;
    border-color: var(--cyan);
}

@keyframes mc-breathe {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.45), 0 8px 24px rgba(0, 0, 0, 0.45);
    }

    50% {
        box-shadow: 0 0 0 12px rgba(0, 212, 255, 0), 0 8px 24px rgba(0, 0, 0, 0.45);
    }
}

.mos-chat-ping {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--amber);
    border: 2px solid var(--navy);
    animation: mc-ping-pulse 1.8s ease-in-out infinite;
}

.mos-chat-ping[hidden] {
    display: none;
}

@keyframes mc-ping-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.25);
        opacity: 0.7;
    }
}

/* ── Panel ───────────────────────────────────────────────── */
.mos-chat-panel {
    position: absolute;
    right: 0;
    bottom: 78px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 560px;
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(10, 22, 40, 0.98), rgba(5, 13, 26, 0.98));
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 212, 255, 0.05);
    backdrop-filter: blur(14px);
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0.85) translateY(16px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease, visibility 0.32s;
}

.mos-chat.is-open .mos-chat-panel {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

@media (max-width: 480px) {
    .mos-chat {
        right: 16px;
        bottom: 16px;
    }

    .mos-chat-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 110px);
        bottom: 74px;
        right: -8px;
    }
}

/* ── Header ──────────────────────────────────────────────── */
.mos-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px;
    background: linear-gradient(90deg, rgba(0, 212, 255, 0.08), transparent);
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    flex-shrink: 0;
}

.mos-chat-header-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.35));
}

.mos-chat-header-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.mos-chat-title {
    font-family: 'Oswald', sans-serif;
    font-size: 15px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--white);
}

.mos-chat-title-accent {
    color: var(--cyan);
}

.mos-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mos-chat-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4caf8a;
    box-shadow: 0 0 6px #4caf8a;
    animation: mc-status-blink 2.4s ease-in-out infinite;
}

@keyframes mc-status-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

.mos-chat-close {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}

.mos-chat-close:hover {
    color: var(--cyan);
    background: rgba(0, 212, 255, 0.08);
}

/* ── Messages ────────────────────────────────────────────── */
.mos-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.3) transparent;
}

.mos-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.mos-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 6px;
}

.mos-msg {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    font-weight: 300;
    white-space: pre-wrap;
    word-break: break-word;
    animation: mc-msg-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes mc-msg-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

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

.mos-msg-assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 212, 255, 0.12);
    color: var(--white);
    border-bottom-left-radius: 4px;
}

.mos-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--cyan), #0090c4);
    color: var(--navy);
    font-weight: 400;
    border-bottom-right-radius: 4px;
}

.mos-msg-error {
    align-self: flex-start;
    background: rgba(245, 166, 35, 0.1);
    border: 1px solid rgba(245, 166, 35, 0.35);
    color: var(--amber);
}

.mos-msg-cursor {
    display: inline-block;
    width: 2px;
    height: 13px;
    background: var(--cyan);
    margin-left: 2px;
    vertical-align: -2px;
    animation: mc-blink 0.9s step-end infinite;
}

@keyframes mc-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ── Typing indicator ────────────────────────────────────── */
.mos-msg-typing {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 212, 255, 0.12);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.mos-msg-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    opacity: 0.5;
    animation: mc-typing-bounce 1.1s ease-in-out infinite;
}

.mos-msg-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.mos-msg-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes mc-typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

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

/* ── Input row ───────────────────────────────────────────── */
.mos-chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid rgba(0, 212, 255, 0.15);
    background: rgba(5, 13, 26, 0.6);
    flex-shrink: 0;
}

.mos-chat-input {
    flex: 1;
    resize: none;
    max-height: 96px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 12px;
    padding: 10px 12px;
    color: var(--white);
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    line-height: 1.4;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.mos-chat-input:focus {
    outline: none;
    border-color: var(--cyan);
    background: rgba(0, 212, 255, 0.05);
}

.mos-chat-input::placeholder {
    color: var(--muted);
}

.mos-chat-send {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--cyan);
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, background 0.2s ease;
}

.mos-chat-send svg {
    width: 16px;
    height: 16px;
}

.mos-chat-send:hover:not(:disabled) {
    transform: scale(1.08);
}

.mos-chat-send:active:not(:disabled) {
    transform: scale(0.92);
}

.mos-chat-send:disabled {
    opacity: 0.4;
    cursor: default;
}
