.metrtv-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000000;
    font-family: system-ui, -apple-system, sans-serif;
}

.metrtv-widget-button {
    background: linear-gradient(135deg, #10b981, #059669, #0d9488);
    color: white;
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transform: scale(1);
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    max-width: 280px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: none;
}

.metrtv-widget-button:hover {
    transform: scale(1.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.metrtv-widget-icon {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 12px;
    transition: background 0.3s;
}

.metrtv-widget-icon svg {
    width: 22px;
    height: 22px;
}

.metrtv-widget-button:hover .metrtv-widget-icon {
    background: rgba(255, 255, 255, 0.3);
}

.metrtv-widget-text h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.metrtv-widget-text h3 br {
    display: none;
}

.metrtv-widget-text p {
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.4;
    margin: 0;
}

.metrtv-online-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.metrtv-ping {
    position: absolute;
    inset: 0;
    background: #f87171;
    border-radius: 50%;
    animation: metrtv-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.metrtv-ping-dot {
    position: absolute;
    inset: 4px;
    background: #ef4444;
    border-radius: 50%;
}

@keyframes metrtv-ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

@media screen and (max-width: 640px) {

    .metrtv-widget-button {
        background: linear-gradient(135deg, #10b981, #059669, #0d9488);
        color: white;
        padding: 6px 12px 6px 8px;
        border-radius: 12px;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        cursor: pointer;
        transform: scale(1);
        transition: all 0.3s;
        border: 1px solid rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(4px);
        max-width: 280px;
        display: flex;
        align-items: flex-start;
        gap: 12px;
        border: none;
    }

    .metrtv-widget-button:hover {
        transform: scale(1.05);
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }

    .metrtv-widget-icon {
        background: rgba(255, 255, 255, 0.2);
        padding: 6px 6px 4px 6px;
        border-radius: 8px;
        transition: background 0.3s;
    }

    .metrtv-widget-icon svg {
        width: 16px;
        height: 16px;
    }

    .metrtv-widget-button:hover .metrtv-widget-icon {
        background: rgba(255, 255, 255, 0.3);
    }

    .metrtv-widget-text h3 {
        font-size: 11px;
        font-weight: 600;
        margin: 2px 0 4px 0;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }

    .metrtv-widget-text h3 br {
        display: inline;
    }

    .metrtv-widget-text p {
        display: none;
    }

    .metrtv-online-indicator {
        position: absolute;
        top: -5px;
        right: -5px;
        width: 14px;
        height: 14px;
        background: #ef4444;
        border-radius: 50%;
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    }

    .metrtv-ping {
        position: absolute;
        inset: 0;
        background: #f87171;
        border-radius: 50%;
        animation: metrtv-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
    }

    .metrtv-ping-dot {
        position: absolute;
        inset: 4px;
        background: #ef4444;
        border-radius: 50%;
    }

}

@keyframes metrtv-ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.metrtv-chat-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items:flex-end;
    justify-content:right;
    padding: 16px;
    z-index: 1000001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    width: 500px; /* Увеличено на 25% с 400px до 500px для десктопа */
    height: 600px;
    margin: auto 0 0 auto;

}


@media screen and (max-width: 640px) {
    .metrtv-chat-modal {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 16px;
        z-index: 1000001;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
        width: auto;
        height: auto;
        margin: auto;

    }
}


.metrtv-chat-modal.show {
    opacity: 1;
    visibility: visible;
}

.metrtv-chat-container {
    background: linear-gradient(135deg, #10b981, #059669, #0d9488);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 500px; /* Увеличено на 25% с 400px до 500px для десктопа */
    height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.metrtv-chat-modal.show .metrtv-chat-container {
    transform: scale(1);
}

.metrtv-chat-header {
    background: #c71c81;
    color: white;
    padding: 16px 24px;
    text-align: center;
    position: relative;
}

.metrtv-chat-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.metrtv-chat-header p {
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0;
}

.metrtv-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: metrtv-pulse 2s infinite;
}

@keyframes metrtv-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.metrtv-close-btn {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metrtv-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.metrtv-chat-messages {
    flex: 1;
    background: #f9fafb;
    margin: 12px;
    border-radius: 12px;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.metrtv-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.metrtv-message.user {
    flex-direction: row-reverse;
}

.metrtv-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.metrtv-message.bot .metrtv-message-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
}

.bot .metrtv-message-time::after { content: " • Помощник может ошибаться. Пожалуйста перепроверяйте ответы."; } 

.metrtv-message.user .metrtv-message-avatar {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.metrtv-message-content {
    flex: 1;
    max-width: 85%; /* Увеличено с 70% до 85% для максимальной ширины */
}

.metrtv-message.user .metrtv-message-content {
    text-align: right;
}

.metrtv-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: inline-block;
    max-width: 100%;
    word-wrap: break-word;
}

.metrtv-message.bot .metrtv-message-bubble {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.metrtv-message.user .metrtv-message-bubble {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-bottom-right-radius: 4px;
}

.metrtv-message-time {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 4px;
    line-height: 12px;
}

.metrtv-typing-indicator {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.metrtv-typing-bubble {
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.metrtv-typing-dots {
    display: flex;
    gap: 4px;
}

.metrtv-typing-dot {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: metrtv-typing 1.4s infinite ease-in-out;
}

.metrtv-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.metrtv-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes metrtv-typing {
    0%, 60%, 100% { transform: scale(1); }
    30% { transform: scale(1.3); }
}

.metrtv-chat-input {
    padding: 16px;
}

/* === НОВЫЕ СТИЛИ ДЛЯ PDF ФУНКЦИЙ === */

/* Превью выбранного файла */
.metrtv-file-preview {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.metrtv-file-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.metrtv-file-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.metrtv-file-details {
    flex: 1;
    min-width: 0;
}

.metrtv-file-name {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metrtv-file-size {
    font-size: 10px;
    color: #6b7280;
    margin-top: 2px;
}

.metrtv-file-remove {
    background: rgba(239, 68, 68, 0.1);
    border: none;
    color: #ef4444;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metrtv-file-remove:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Контейнер ввода с кнопками */
.metrtv-input-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: flex-end;
    gap: 8px;
    position: relative; /* Добавлено для позиционирования PDF */
}

.metrtv-message-input {
    flex: 1;
    border: none;
    background: transparent;
    color: #374151;
    font-size: 14px;
    resize: none;
    outline: none;
    min-height: 20px;
    max-height: 100px;
    overflow-y: auto;
    font-family: inherit;
}

.metrtv-message-input::placeholder {
    color: #9ca3af;
}

/* Кнопка скрепки для загрузки файлов - теперь такого же размера как стрелочка */
.metrtv-attach-btn {
    width: 40px; /* Увеличено с 36px до 40px */
    height: 40px; /* Увеличено с 36px до 40px */
    margin-bottom: 0;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px; /* Увеличено с 10px до 12px для соответствия */
    color: #10b981;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    flex-direction: column;
}

.metrtv-attach-btn-svg {
    margin: 8px 0 -8px 0;
}

.metrtv-attach-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.metrtv-attach-btn:active {
    transform: translateY(0);
}

.metrtv-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
    flex-shrink: 0;
}

.metrtv-send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

.metrtv-send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    box-shadow: none;
}


/* Подпись под кнопками */
.metrtv-attach-hint {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    margin-top: 8px; /* Увеличено для размещения PDF над футером */
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metrtv-footer-info {
    color: rgba(255, 255, 255, 0.6);
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

.metrtv-logo-dev {
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.metrtv-logo {
    background: #c71c81;
    color: white;
    padding: 2px 2px 0 2px;
    border-radius: 2px;
    font-size: 9px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    text-align: center;
    min-width: 18px;
    height: 14px;
    margin-top: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.metrtv-hidden {
    display: none !important;
}

/* Мобильные стили */
@media (max-width: 640px) {
    .metrtv-chat-container {
        height: 90vh;
        margin: 16px;
        max-width: 400px; /* На мобильных остается 400px */
    }
    
    .metrtv-widget-button {
        max-width: 240px;
    }

    /* Адаптация для мобильной версии */
    .metrtv-attach-btn {
        width: 36px; /* На мобильных чуть меньше */
        height: 36px;
    }

    .metrtv-send-btn {
        width: 36px;
        height: 36px;
    }


    .metrtv-footer-info {
        /* font-size: 9px; */
    }

    .metrtv-logo {
        /* min-width: 16px;
        height: 10px;
        font-size: 9px; */
    }
}