/* ==================== Основной виджет ==================== */

/* ==================== Кнопка открытия мини-чата ==================== */
#mini-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10000;

    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);

    transition: background 0.3s ease, transform 0.2s ease;
}

#mini-chat-button:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.08);
}

#mini-chat-button i {
    color: #25D366;
    font-size: 28px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* Основной контейнер виджета */
#mini-chat-widget {
    position: fixed;
    bottom: 0px;
    right: 20px;
    width: 355px;
    height: 600px;
    background: rgba(42, 0, 112, 0.45); 
    border-radius: 25px;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Виджет открыт */
#mini-chat-widget.open {
    transform: translateY(-90px);
}

/* ==================== Шапка виджета ==================== */
#mini-chat-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 10px;
    gap: 12px;
    background: rgba(42,0,112,0.45);
    backdrop-filter: blur(8px);
    border-bottom: 0.5px solid rgba(255,255,255,0.12);
    border-radius: 25px 25px 0 0;
}

#mini-chat-header button {
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    width: 36px; /* Установлено равенство ширины и высоты */
    height: 36px; /* Установлено равенство ширины и высоты */
    border-radius: 50%;
    transition: background 0.2s ease;
}

#mini-chat-header button:hover {
    background: rgba(37, 211, 102, 0.15);
}

#mini-chat-video-button {
    color: #fff;
}

/* ==================== Контейнер сообщений ==================== */
#mini-chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    scroll-behavior: smooth;

    /* Фиолетовый фон с прозрачностью + паттерн с прозрачностью */
    background: 
        rgba(200, 170, 255, 0.5) /* Светлый фиолетовый фон с прозрачностью */
        url('https://otvet-dz.online/wp-content/uploads/2026/01/pattern.png') repeat; /* Твой паттерн */
    
    backdrop-filter: blur(8px); /* Размытие фона для мягкости */
    background-size: auto; /* Повторение паттерна */
    background-blend-mode: multiply; /* Смешивание фиолетового цвета с паттерном */
    
    justify-content: flex-end; /* Расположение сообщений снизу */
}

@media (max-width: 480px) {
    #mini-chat-messages {
        background: 
            rgba(200, 170, 255, 0.50) /* Светлый фиолетовый фон с прозрачностью */
            url('https://otvet-dz.online/wp-content/uploads/2026/01/pattern.png') repeat; /* Твой паттерн */
        background-size: 120px 120px; /* Размер паттерна для мобильных устройств */
        backdrop-filter: none; /* Убираем размытие для мобильных */
    }
}

/* ==================== Пузырьки сообщений ==================== */

/* Входящие */
.incoming-msg {
    background: linear-gradient(135deg, rgba(91,61,184,0.85) 0%, rgba(63,26,158,0.85) 100%);
    color: #f2f2f2;
    padding: 10px 14px;
    word-break: break-word;
    max-width: 75%;
    align-self: flex-start;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

/* Исходящие */
.outgoing-msg {
    background: linear-gradient(135deg, rgba(155,124,255,0.85) 0%, rgba(111,77,255,0.85) 100%);
    color: #ffffff;
    padding: 10px 14px;
    word-break: break-word;
    max-width: 75%;
    align-self: flex-end;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

/* Текст сообщения */
.msg-text {
    margin-bottom: 2px;
}

/* Хвостики динамически */
.incoming-msg.first-msg { border-radius: 14px 14px 14px 4px; }
.incoming-msg.middle-msg { border-radius: 14px; }
.incoming-msg.last-msg { border-radius: 14px 4px 14px 14px; }

.outgoing-msg.first-msg { border-radius: 14px 14px 4px 14px; }
.outgoing-msg.middle-msg { border-radius: 14px; }
.outgoing-msg.last-msg { border-radius: 14px 4px 14px 14px; }

/* Время сообщений */
.msg-time-divider {
    text-align: center;
    font-size: 10px;
    color: rgba(42, 0, 112, 0.8);  /* Фиолетовый цвет с прозрачностью */
    margin: 4px 0;
}

/* ==================== Блок ввода сообщения ==================== */
#mini-chat-input-block {
    display: flex;
    gap: 6px;
    padding: 12px 10px;
    background: rgba(42,0,112,0.45);
    backdrop-filter: blur(8px);
    border-radius: 0 0 25px 25px;
    align-items: center;
    justify-content: space-between;
    border-top: 0.5px solid rgba(255,255,255,0.12);
}

#mini-chat-add-file,
#mini-chat-send {
    display: flex;
    align-items: center;
    justify-content: center;
}

#mini-chat-message {
    flex: 1;
    margin: 0 6px;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(42,0,112,0.25);
    color: #ccc;
    outline: none;
    backdrop-filter: blur(6px);
}

#mini-chat-message::placeholder {
    color: rgba(255,255,255,0.5);
}

#mini-chat-add-file {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #fffc00;
}

#mini-chat-send {
    background: transparent !important;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
    backdrop-filter: none !important;
}

/* ==================== Блок звонка ==================== */
#mini-chat-call-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 30px;
    margin: 6px 10px;

    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;

    border: none;

    color: #fff;
    position: relative;
}

#mini-chat-call-status.call-closed {
    display: none;
}

/* ==================== Кнопки звонка (исправленные) ==================== */
#mini-chat-call-status button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
    border: none;
    margin-left: 5px;
}

#call-end-button {
    background-color: #ff3b30;
    color: #fff;
}

#mini-chat-answer-button {
    background-color: green;
    color: #fff;
}

/* ==================== Адаптивность для мобильных ==================== */
@media (max-width: 480px) {
    #mini-chat-widget {
        width: 90vw;
        right: 5vw;
        bottom: 10px;
        height: 70vh;
        border-radius: 25px;
    }

    #mini-chat-header {
        padding: 6px 8px;
        gap: 8px;
    }

    #mini-chat-input-block {
        padding: 8px 6px;
        gap: 4px;
    }

    #mini-chat-message {
        font-size: 14px;
        padding: 6px 10px;
    }

    #mini-chat-send,
    #mini-chat-add-file,
    #mini-chat-header button {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    #mini-chat-messages {
        padding: 6px;
        gap: 6px;
    }
}
