/**
 * Bouton de chat flottant - Design moderne
 */

.chat-float-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.35);
    z-index: 9999;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation: gentle-float 4s ease-in-out infinite;
}

.chat-float-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5);
}

.chat-float-button:active {
    transform: scale(0.95);
}

.chat-float-button i {
    font-size: 18px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.chat-float-button .notification-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 9px;
    height: 9px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-dot 2s ease-in-out infinite;
    box-shadow: 0 2px 5px rgba(255, 107, 107, 0.4);
}

.chat-float-button .notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: pulse-badge 2s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

@keyframes gentle-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes pulse-dot {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.85;
    }
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

/* Chat Window - Ultra compact */
.chat-window {
    position: fixed;
    bottom: 75px;
    right: 20px;
    width: 280px;
    max-height: 380px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
}

.chat-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.chat-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.2px;
    position: relative;
    z-index: 1;
}

.chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.chat-body {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    scroll-behavior: smooth;
}

.chat-body::-webkit-scrollbar {
    width: 3px;
}

.chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.chat-message {
    margin-bottom: 10px;
    display: flex;
    align-items: flex-end;
    animation: messageIn 0.3s ease-out;
}

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

.chat-message.received {
    justify-content: flex-start;
}

.chat-message.sent {
    justify-content: flex-end;
}

.chat-message-avatar {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    margin-right: 8px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.chat-message.sent .chat-message-avatar {
    margin-right: 0;
    margin-left: 8px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.25);
}

.chat-message-content {
    background: white;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 75%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    position: relative;
}

.chat-message.received .chat-message-content {
    border-bottom-left-radius: 3px;
}

.chat-message.sent .chat-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 3px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chat-message-content p {
    margin: 0;
    line-height: 1.3;
    font-size: 12px;
}

.chat-message-time {
    font-size: 9px;
    color: #9ca3af;
    margin-top: 3px;
    font-weight: 500;
}

.chat-message.sent .chat-message-time {
    color: rgba(255, 255, 255, 0.8);
}

.chat-footer {
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    background: white;
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-footer input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    outline: none;
    transition: all 0.3s ease;
    font-size: 12px;
    background: #f9fafb;
}

.chat-footer input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-footer input::placeholder {
    color: #9ca3af;
}

.chat-footer button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
}

.chat-footer button:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
}

.chat-footer button:active {
    transform: scale(0.95);
}

/* Chat Login Form - Ultra compact */
.chat-login-form {
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 0 0 12px 12px;
}

.chat-login-form h4 {
    margin: 0 0 1px 0;
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    text-align: center;
    letter-spacing: -0.2px;
}

.chat-login-form p {
    margin: 0 0 4px 0;
    font-size: 11px;
    color: #6b7280;
    text-align: center;
    line-height: 1.3;
}

.chat-login-form .input-group {
    position: relative;
    margin-bottom: 1px;
}

.chat-login-form .input-group i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 12px;
    pointer-events: none;
    transition: all 0.3s ease;
}

.chat-login-form input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
    font-size: 12px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.chat-login-form input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-login-form input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.chat-login-form .btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    text-transform: none;
    letter-spacing: 0.1px;
    margin-top: 4px;
}

.chat-login-form .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 14px rgba(102, 126, 234, 0.4);
}

.chat-login-form .btn:active {
    transform: translateY(0);
}

/* Animation pour le formulaire */
.chat-login-form {
    animation: fadeIn 0.4s ease-out;
}

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

/* Effet de focus sur les inputs */
.chat-login-form .input-group:focus-within i {
    color: #667eea;
    transform: translateY(-50%) scale(1.1);
}

/* Chat Loading - Design moderne */
.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
}

.chat-loading i {
    margin-right: 12px;
    font-size: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Typing Indicator - Design moderne */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-12px) scale(1.2);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .chat-float-button {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }

    .chat-float-button i {
        font-size: 24px;
    }

    .chat-window {
        bottom: 80px;
        right: 20px;
        width: calc(100% - 40px);
        max-width: 350px;
    }
}
