/* Стили для чатов */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(5px);
}
.overlay.active {
    display: block;
}

.chat-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    z-index: 1000;
    padding: 20px;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.chat-popup.active {
    display: flex;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
.chat-header h2 {
    color: var(--primary);
    font-size: 1.3rem;
    margin: 0;
    font-weight: 600;
}
.close-chat {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 20px;
    cursor: pointer;
    color: var(--primary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}
.close-chat:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

.chat-messages {
    flex-grow: 1;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(249, 249, 249, 0.7);
    backdrop-filter: blur(10px);
    padding: 15px;
    overflow-y: auto;
    margin-bottom: 15px;
    border-radius: 12px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    margin-bottom: 10px;
    line-height: 1.4;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-in;
    backdrop-filter: blur(5px);
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user {
    background: rgba(0, 91, 170, 0.8);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.manager {
    background: rgba(230, 242, 255, 0.8);
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(209, 227, 255, 0.5);
}
.ai {
    background: rgba(240, 240, 240, 0.8);
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(224, 224, 224, 0.5);
}

.chat-input {
    display: flex;
    gap: 10px;
    align-items: center;
}
.chat-input input {
    flex-grow: 1;
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}
.chat-input input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 2px rgba(0, 91, 170, 0.1);
}
.chat-input button {
    background: rgba(255, 107, 0, 0.9);
    color: white;
    border: none;
    padding: 14px 22px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.chat-input button:hover {
    background: rgba(224, 90, 0, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 0, 0.3);
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(76, 175, 80, 0.9);
    backdrop-filter: blur(15px);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    display: none;
    z-index: 1001;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Адаптивность для чатов */
@media (max-width: 768px) {
    .chat-popup {
        width: 95%;
        height: 90vh;
        max-height: none;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(255, 255, 255, 0.9);
    }
    
    .chat-messages {
        max-height: calc(90vh - 150px);
        background: rgba(249, 249, 249, 0.8);
    }
    
    .message {
        max-width: 90%;
        font-size: 14px;
    }
    
    .chat-input {
        flex-direction: column;
    }
    
    .chat-input button {
        border-radius: 12px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .chat-popup {
        padding: 15px;
        border-radius: 12px;
    }
    
    .chat-header h2 {
        font-size: 1.1rem;
    }
    
    .message {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .chat-input input {
        padding: 12px 16px;
    }
    
    .chat-input button {
        padding: 12px 18px;
    }
}