/* Chatbox - Style moderne */
.chatbox-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Arial', sans-serif;
}

/* Bouton de chat flottant */
.chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0062cc, #00a8ff);
    box-shadow: 0 5px 20px rgba(0, 98, 204, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    overflow: hidden;
}

.chat-button::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #00a8ff, #0062cc);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 98, 204, 0.5);
}

.chat-button:hover::before {
    opacity: 1;
}

.chat-button i {
    color: white;
    font-size: 24px;
    position: relative;
    z-index: 2;
}

/* Notification */
.chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    background: #ff3366;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    animation: pulse-notification 1.5s infinite;
}

/* Boîte de chat principale */
.chatbox {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 450px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.chatbox.active {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}

/* En-tête du chat */
.chat-header {
    background: linear-gradient(135deg, #0062cc, #00a8ff);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    position: relative;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header-title h4 {
    font-size: 16px;
    margin: 0;
    font-weight: 600;
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #42d392;
    box-shadow: 0 0 0 2px rgba(66, 211, 146, 0.3);
    animation: pulse-status 1.5s infinite;
}

.chat-header-actions i {
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
}

.chat-header-actions i:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

/* Corps du chat */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9fafc;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.chat-message.agent {
    align-self: flex-start;
    background: #e6f3ff;
    border-bottom-left-radius: 0;
    color: #333;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #0062cc, #00a8ff);
    color: white;
    border-bottom-right-radius: 0;
    box-shadow: 0 2px 5px rgba(0, 98, 204, 0.2);
}

.chat-time {
    font-size: 11px;
    margin-top: 5px;
    opacity: 0.7;
    display: block;
}

.agent .chat-time {
    text-align: left;
}

.user .chat-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.8);
}

/* Formulaire de saisie */
.chat-input-area {
    padding: 15px;
    border-top: 1px solid #eaeaea;
    background: white;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.chat-input-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, transparent, rgba(0, 162, 255, 0.1), transparent);
}

.chat-input {
    flex: 1;
    border: 1px solid #e1e1e1;
    border-radius: 30px;
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: #00a8ff;
    box-shadow: 0 0 0 2px rgba(0, 162, 255, 0.1);
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0062cc, #00a8ff);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 98, 204, 0.2);
}

.chat-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 98, 204, 0.3);
}

.chat-send i {
    color: white;
    font-size: 18px;
}

/* Icône d'action supplémentaire */
.chat-action {
    color: #888;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-action:hover {
    color: #00a8ff;
    transform: scale(1.1);
}

/* Indicateur de frappe */
.typing-indicator {
    background: rgba(230, 243, 255, 0.7) !important;
    padding: 12px !important;
}

.typing-dots {
    display: flex;
    align-items: center;
    height: 15px;
}

.typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #0062cc;
    margin-right: 4px;
    animation: typing-dot 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

@keyframes typing-dot {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Animations */
@keyframes pulse-notification {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.5);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(255, 51, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 51, 102, 0);
    }
}

@keyframes pulse-status {
    0% {
        box-shadow: 0 0 0 0 rgba(66, 211, 146, 0.5);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(66, 211, 146, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(66, 211, 146, 0);
    }
}

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

/* Responsive */
@media (max-width: 480px) {
    .chatbox-container {
        bottom: 20px;
        right: 20px;
    }
    
    .chatbox {
        width: 300px;
        height: 400px;
        bottom: 70px;
        right: 0;
    }
    
    .chat-message {
        max-width: 85%;
        font-size: 13px;
    }
}
