/**
 * mmbot — futuristic multi-language chat widget
 */

.mmbot-panel[hidden] {
    display: none !important;
    visibility: hidden !important;
}

.mmbot-root {
    position: fixed !important;
    right: 1.25rem !important;
    left: auto !important;
    bottom: 1.25rem !important;
    z-index: 100060;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.mmbot-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    box-shadow: none;
    transition: transform 0.2s ease, filter 0.2s ease;
    position: relative;
    overflow: visible;
    filter: drop-shadow(0 0 3px rgba(34, 211, 238, 0.22)) drop-shadow(0 2px 6px rgba(8, 145, 178, 0.12));
}

.mmbot-fab:hover {
    transform: translateY(-2px) scale(1.04);
    filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.3)) drop-shadow(0 4px 10px rgba(8, 145, 178, 0.18));
}

.mmbot-fab-icon {
    width: auto;
    height: auto;
    border-radius: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.mmbot-fab-icon img {
    width: 118px;
    height: auto;
    max-height: 148px;
    object-fit: contain;
    object-position: center bottom;
    display: block;
    border-radius: 0;
    border: none;
    background: transparent;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.45)) drop-shadow(0 6px 16px rgba(0, 0, 0, 0.55));
}

.mmbot-fab-label {
    display: none;
}

.mmbot-fab-pulse {
    display: none;
}

.mmbot-panel {
    position: fixed;
    right: 1.25rem;
    bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
    width: min(400px, calc(100vw - 2rem));
    height: min(620px, calc(100dvh - 1.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
    max-height: min(620px, calc(100dvh - 1.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: linear-gradient(165deg, rgba(15, 20, 32, 0.96) 0%, rgba(8, 10, 18, 0.98) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.06) inset,
        0 0 80px rgba(34, 211, 238, 0.12);
    overflow: hidden;
    z-index: 100000;
}

.mmbot-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #22d3ee, #F47D31, #8B5CF6);
}

.mmbot-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: calc(1rem + env(safe-area-inset-top, 0px)) 1rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.mmbot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mmbot-avatar img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    object-position: top center;
    border-radius: 50%;
    border: 1px solid rgba(34, 211, 238, 0.4);
}

.mmbot-header-copy {
    flex: 1;
    min-width: 0;
}

.mmbot-name {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.mmbot-status {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
}

.mmbot-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.mmbot-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.mmbot-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.mmbot-toolbar label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
}

.mmbot-lang-picker {
    flex: 1;
    position: relative;
    min-width: 0;
}

.mmbot-lang-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(20, 28, 44, 0.92);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.mmbot-lang-trigger:hover,
.mmbot-lang-trigger[aria-expanded="true"] {
    border-color: rgba(244, 125, 49, 0.55);
    background: rgba(24, 34, 52, 0.98);
    box-shadow: 0 0 0 3px rgba(244, 125, 49, 0.12);
}

.mmbot-lang-chevron {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1;
}

.mmbot-lang-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 20;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    border-radius: 12px;
    border: 1px solid rgba(244, 125, 49, 0.35);
    background: linear-gradient(165deg, #1a2438 0%, #121824 100%);
    box-shadow:
        0 16px 40px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    max-height: 220px;
    overflow-y: auto;
}

.mmbot-lang-menu[hidden] {
    display: none !important;
}

.mmbot-lang-menu [role="option"] {
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.mmbot-lang-menu [role="option"]:hover,
.mmbot-lang-menu [role="option"]:focus {
    background: rgba(34, 211, 238, 0.28);
    color: #fff;
    outline: none;
}

.mmbot-lang-menu [role="option"].is-selected {
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.85), rgba(34, 211, 238, 0.65));
    color: #fff;
    font-weight: 600;
}

.mmbot-lang-native {
    display: none !important;
}

.mmbot-gate {
    padding: 1.25rem 1rem;
    flex: 1;
    overflow-y: auto;
}

.mmbot-gate-title {
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.35rem;
}

.mmbot-gate-text {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 1rem;
}

.mmbot-gate-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.mmbot-gate-error {
    color: #fca5a5;
    font-size: 0.8125rem;
    margin: 0;
}

.mmbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

.mmbot-bubble {
    max-width: 92%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.92);
}

.mmbot-bubble p {
    margin: 0 0 0.5rem;
}

.mmbot-bubble p:last-child {
    margin-bottom: 0;
}

.mmbot-bubble ul.mmbot-list {
    margin: 0.35rem 0 0.5rem;
    padding-left: 1.1rem;
}

.mmbot-bubble-assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 4px;
}

.mmbot-bubble-user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.45), rgba(34, 211, 238, 0.25));
    border: 1px solid rgba(34, 211, 238, 0.35);
    border-bottom-right-radius: 4px;
}

.mmbot-typing {
    display: flex;
    gap: 4px;
    padding: 0.85rem 1rem;
}

.mmbot-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    animation: mmbot-dot 1.2s infinite ease-in-out;
}

.mmbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.mmbot-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes mmbot-dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.mmbot-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    align-items: center;
}

.mmbot-input {
    flex: 1;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 0.875rem;
}

.mmbot-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.mmbot-input:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.5);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

.mmbot-btn {
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mmbot-btn-primary {
    padding: 0.65rem 1rem;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(244, 125, 49, 0.95) 0%, #e06d25 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -4px 10px rgba(0, 0, 0, 0.18),
        0 4px 12px rgba(244, 125, 49, 0.28);
}

.mmbot-btn-primary:hover {
    transform: translateY(-1px);
}

.mmbot-btn-telegram {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(145deg, #2AABEE 0%, #229ED9 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 4px 12px rgba(34, 158, 217, 0.35);
}

.mmbot-btn-telegram[hidden] {
    display: none !important;
}

.mmbot-telegram-alt {
    padding: 0 1rem 0.85rem;
    flex-shrink: 0;
}

.mmbot-telegram-alt a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(42, 171, 238, 0.45);
    background: rgba(42, 171, 238, 0.12);
    color: #7dd3fc;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
}

.mmbot-telegram-alt[hidden] {
    display: none !important;
}

.mmbot-btn-send {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(34, 211, 238, 0.95) 0%, #0891b2 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        inset 0 -4px 10px rgba(0, 0, 0, 0.18),
        0 4px 12px rgba(34, 211, 238, 0.28);
}

body.mmbot-open {
    overflow: hidden;
}

@media (max-width: 480px) {
    .mmbot-root {
        right: 0.5rem;
        bottom: 0.5rem;
    }

    .mmbot-fab-icon img {
        width: 92px;
        height: auto;
        max-height: 118px;
    }

    .mmbot-panel {
        right: 0.5rem;
        left: 0.5rem;
        width: auto;
        bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
        height: min(640px, calc(100dvh - 1rem - env(safe-area-inset-top, 0px)));
        max-height: min(640px, calc(100dvh - 1rem - env(safe-area-inset-top, 0px)));
        border-radius: 20px;
    }
}
