/* ====================================================
   CHAT WIDGET - Conciergerie Privée Suzosky
   Couleurs: Or (#c9ab81) / Bleu foncé (#1e2e42)
   ==================================================== */

/* Bouton flottant */
#chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9ab81 0%, #b8956f 100%);
    box-shadow: 0 4px 20px rgba(201, 171, 129, 0.4);
    cursor: pointer;
    display: none; /* Caché par défaut, montré par JS */
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    -webkit-tap-highlight-color: transparent;
}

#chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(201, 171, 129, 0.6);
}

#chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

/* Fenêtre de chat */
#chat-window {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(30, 46, 66, 0.3);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    border: 1px solid rgba(30, 46, 66, 0.1);
}

#chat-window.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

/* Header du chat */
.chat-widget__header {
    background: linear-gradient(135deg, #1e2e42 0%, #15202e 100%);
    color: #fff;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-widget__header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-widget__header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9ab81 0%, #b8956f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-widget__header-avatar svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

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

.chat-widget__header-status {
    font-size: 13px;
    color: #c9ab81;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-widget__status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chat-widget__header-actions {
    display: flex;
    gap: 10px;
}

.chat-widget__header-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #fff;
    font-size: 20px;
    -webkit-tap-highlight-color: transparent; /* Éviter le flash bleu sur mobile */
}

.chat-widget__header-btn:hover,
.chat-widget__header-btn:active {
    background: rgba(201, 171, 129, 0.3);
}

/* Zone de messages */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(201, 171, 129, 0.3);
    border-radius: 10px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 171, 129, 0.5);
}

/* Message de bienvenue */
.chat-widget__welcome {
    text-align: center;
    padding: 30px 20px;
}

.chat-widget__welcome-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, #c9ab81 0%, #b8956f 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-widget__welcome-icon svg {
    width: 30px;
    height: 30px;
    fill: #fff;
}

.chat-widget__welcome-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e2e42;
    margin-bottom: 8px;
}

.chat-widget__welcome-text {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* Messages */
.chat-widget__message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

.chat-widget__message.customer {
    flex-direction: row-reverse;
}

.chat-widget__message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9ab81 0%, #b8956f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-widget__message-avatar svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Label "Assistant Suzosky" */
.chat-widget__message-label {
    font-size: 11px;
    font-weight: 600;
    color: #c9ab81;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-widget__message.customer .chat-widget__message-label {
    display: none;
}

.chat-widget__message-bubble {
    background: #fff;
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 70%;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-widget__message.customer .chat-widget__message-bubble {
    background: linear-gradient(135deg, #c9ab81 0%, #b8956f 100%);
    color: #fff;
}

.chat-widget__message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

.chat-widget__message.customer .chat-widget__message-time {
    text-align: left;
}

/* Indicateur de frappe */
#chat-typing {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 0 20px 10px;
}

.chat-widget__typing-dots {
    display: flex;
    gap: 4px;
}

.chat-widget__typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c9ab81;
    animation: typingDot 1.4s infinite;
}

.chat-widget__typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-widget__typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Réponses rapides */
.chat-widget__quick-replies {
    display: flex;
    gap: 8px;
    padding: 0 20px 15px;
    flex-wrap: wrap;
}

.chat-widget__quick-reply {
    background: #fff;
    border: 1px solid #c9ab81;
    color: #c9ab81;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-widget__quick-reply:hover {
    background: #c9ab81;
    color: #fff;
}

/* Zone de saisie */
.chat-widget__input-area {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e5e5e5;
    display: flex;
    gap: 10px;
    align-items: center;
}

#chat-input {
    flex: 1;
    border: 1px solid #e5e5e5;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    resize: none;
    max-height: 100px;
}

#chat-input:focus {
    border-color: #c9ab81;
    box-shadow: 0 0 0 3px rgba(201, 171, 129, 0.1);
}

#chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9ab81 0%, #b8956f 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(201, 171, 129, 0.4);
}

#chat-send svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* Responsive Mobile - Full Screen */
@media (max-width: 480px) {
    #chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        margin: 0;
    }
    
    .chat-widget__header {
        padding: 15px 20px;
        border-radius: 0;
    }
    
    /* Bouton de fermeture toujours visible et accessible sur mobile */
    .chat-widget__header-btn {
        background: rgba(255, 255, 255, 0.2) !important;
        min-width: 48px !important;
        min-height: 48px !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 24px !important;
        z-index: 10001 !important;
        position: relative;
        -webkit-tap-highlight-color: transparent;
    }
    
    .chat-widget__header-btn:active {
        background: rgba(201, 171, 129, 0.5) !important;
        transform: scale(0.95);
    }
    
    #chat-toggle {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
    }
    
    #chat-messages {
        padding: 15px;
    }
    
    .chat-widget__input-area {
        padding: 15px;
    }
    
    #chat-input {
        font-size: 16px; /* Évite le zoom auto iOS */
        min-height: 44px;
    }
    
    #chat-send {
        min-width: 48px;
        min-height: 48px;
    }
}

/* Tablette */
@media (min-width: 481px) and (max-width: 768px) {
    #chat-window {
        width: 400px;
        height: 600px;
    }
}
