/* ЧАТ-ВИДЖЕТ - КАСТОМНЫЙ ДИЗАЙН В СТИЛЕ FOOTER */
.chat-widget {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 320px;
    height: 480px;
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.95), rgba(20, 20, 30, 0.95));
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 255, 136, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #e0e0e0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0;
    backdrop-filter: blur(10px);
}

.chat-widget.show {
    opacity: 1;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50%) translateX(30px);
        opacity: 0;
    }
    to {
        transform: translateY(-50%) translateX(0);
        opacity: 1;
    }
}

/* Заголовок */
.chat-header {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 204, 255, 0.05));
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    padding: 16px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
    user-select: none;
    color: #00ff88;
    position: relative;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="dots" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="0.5" fill="rgba(255,255,255,0.02)"/></pattern></defs><rect width="100" height="100" fill="url(%23dots)"/></svg>');
    pointer-events: none;
    border-radius: 20px 20px 0 0;
}

.chat-header span {
    position: relative;
    z-index: 2;
}

.chat-close {
    font-size: 24px;
    font-weight: 300;
    opacity: 0.6;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    z-index: 2;
}

.chat-close:hover {
    opacity: 1;
    color: #00ff88;
}

/* Тело чата */
#chat {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #0a0a0a;
    font-size: 13px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msg {
    padding: 10px 14px;
    border-radius: 14px;
    max-width: 85%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg.user {
    background: linear-gradient(135deg, #00ff88, #00ccff);
    color: #0a0a0a;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

.msg.bot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-bottom-left-radius: 4px;
    color: rgba(255, 255, 255, 0.9);
    align-self: flex-start;
}

.msg p {
    margin: 0;
}

/* Прокрутка */
#chat::-webkit-scrollbar {
    width: 6px;
}

#chat::-webkit-scrollbar-track {
    background: transparent;
}

#chat::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 3px;
}

#chat::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.5);
}

/* Поле ввода */
.input-area {
    display: flex;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(0, 255, 136, 0.1);
    gap: 8px;
    border-radius: 0 0 20px 20px;
}


.input-area input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    font-size: 13px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.input-area input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.input-area input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 255, 136, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1);
}

.input-area button {
    padding: 10px 16px;
    background: linear-gradient(135deg, #00ff88, #00ccff);
    color: #0a0a0a;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.2);
}

.input-area button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.input-area button:hover::before {
    left: 100%;
}

.input-area button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.35);
}

.input-area button:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-widget {
        width: 280px;
        height: 420px;
        bottom: auto;
        top: 50%;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        width: 100%;
        height: 100vh;
        right: 0;
        top: 0;
        transform: none;
        border-radius: 0;
    }

    .chat-widget.show {
        animation: slideUp 0.4s ease;
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
}