/* ============================================
   GANPIA CHAT WIDGET - Mikeno v2.0
   CSS Premium avec animations fluides
   ============================================ */

/* ============================================
   WIDGET CONTAINER
   ============================================ */
.ganpia-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    font-family: 'Syne', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 1s both;
}

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

/* ============================================
   BOUTON FLOTTANT
   ============================================ */
.ganpia-chat-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 54px;
    padding: 0 24px;
    background: linear-gradient(135deg, #0066FF 0%, #8B5CF6 100%);
    border-radius: 27px;
    border: none;
    cursor: pointer;
    color: white;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 
        0 8px 32px rgba(0, 102, 255, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: btnPulse 3s ease-in-out infinite;
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(0, 102, 255, 0.35); }
    50% { box-shadow: 0 8px 40px rgba(139, 92, 246, 0.45); }
}

.ganpia-chat-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 102, 255, 0.45);
}

.ganpia-chat-btn svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.ganpia-chat-btn-text {
    white-space: nowrap;
}

/* ============================================
   FENÊTRE DE CHAT
   ============================================ */
.ganpia-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 140px);
    background: #0a0a0f;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(24px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ganpia-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ============================================
   HEADER
   ============================================ */
.ganpia-chat-header {
    background: linear-gradient(135deg, #0066FF 0%, #8B5CF6 100%);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.ganpia-chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.ganpia-chat-avatar {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    position: relative;
    z-index: 1;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.ganpia-chat-info {
    flex: 1;
    position: relative;
    z-index: 1;
}

.ganpia-chat-name {
    font-weight: 700;
    font-size: 1.15rem;
    color: white;
    margin-bottom: 4px;
}

.ganpia-chat-status {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ganpia-chat-status .status-dot {
    width: 8px;
    height: 8px;
    background: #10B981;
    border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

.ganpia-chat-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
    z-index: 1;
}

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

.ganpia-chat-close svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

/* ============================================
   ZONE DE MESSAGES
   ============================================ */
.ganpia-chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #0a0a0f;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(0, 102, 255, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.03) 0%, transparent 40%);
}

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

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

.ganpia-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.ganpia-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   MESSAGES
   ============================================ */
.ganpia-msg {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 0.92rem;
    line-height: 1.55;
    animation: msgSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.ganpia-msg-bot {
    background: linear-gradient(135deg, #16161f 0%, #1a1a24 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    color: #e8e8e8;
}

.ganpia-msg-user {
    background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    color: white;
    box-shadow: 0 4px 16px rgba(0, 102, 255, 0.25);
}

.ganpia-msg-text {
    word-wrap: break-word;
}

.ganpia-msg-text strong {
    font-weight: 600;
    color: inherit;
}

.ganpia-msg-time {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 8px;
    text-align: right;
}

.ganpia-msg-user .ganpia-msg-time {
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   INDICATEUR DE FRAPPE
   ============================================ */
.ganpia-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #16161f 0%, #1a1a24 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    align-self: flex-start;
    max-width: 80px;
}

.ganpia-typing span {
    width: 8px;
    height: 8px;
    background: #6B7280;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { 
        transform: translateY(0); 
        background: #6B7280;
    }
    30% { 
        transform: translateY(-10px); 
        background: #0066FF;
    }
}

/* ============================================
   RÉPONSES RAPIDES
   ============================================ */
.ganpia-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    animation: msgSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ganpia-quick-reply {
    padding: 10px 18px;
    background: rgba(0, 102, 255, 0.08);
    border: 1px solid rgba(0, 102, 255, 0.25);
    border-radius: 20px;
    color: #3385FF;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ganpia-quick-reply:hover {
    background: rgba(0, 102, 255, 0.15);
    border-color: #0066FF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
}

/* ============================================
   ZONE DE SAISIE
   ============================================ */
.ganpia-chat-input {
    padding: 18px 20px;
    background: #0f0f14;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 14px;
    align-items: center;
}

.ganpia-chat-input input {
    flex: 1;
    background: #1a1a24;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 25px;
    padding: 14px 22px;
    color: white;
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: all 0.3s;
}

.ganpia-chat-input input:focus {
    border-color: #0066FF;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.ganpia-chat-input input::placeholder {
    color: #6B7280;
}

.ganpia-chat-send {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0066FF 0%, #8B5CF6 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.ganpia-chat-send:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 102, 255, 0.4);
}

.ganpia-chat-send:active {
    transform: scale(0.95);
}

.ganpia-chat-send svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .ganpia-chat-widget {
        bottom: 16px;
        right: 16px;
    }
    
    .ganpia-chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        bottom: 90px;
        right: 16px;
        left: 16px;
        border-radius: 20px;
    }
    
    .ganpia-chat-btn {
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }
    
    .ganpia-chat-btn-text {
        display: none;
    }
    
    .ganpia-chat-messages {
        padding: 16px;
    }
    
    .ganpia-chat-header {
        padding: 16px 20px;
    }
}
