/**
 * OstreiGest - Styles du Chatbot IA Perle
 * Conçu pour une intégration fluide, moderne et responsive
 */

#ostrei-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Bouton Déclencheur Flottant */
.ostrei-chat-launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 8px 25px rgba(2, 132, 199, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    outline: none;
}

.ostrei-chat-launcher:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 30px rgba(2, 132, 199, 0.55);
}

.ostrei-chat-launcher svg, .ostrei-chat-launcher i {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

.ostrei-chat-launcher.active svg, .ostrei-chat-launcher.active i {
    transform: rotate(90deg);
}

/* Pastille En Ligne */
.ostrei-launcher-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background-color: #10b981;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
    animation: ostreiPulse 2s infinite;
}

@keyframes ostreiPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Bulle Teaser Proactive */
.ostrei-chat-teaser {
    position: absolute;
    bottom: 72px;
    right: 0;
    background: #ffffff;
    color: #0f172a;
    padding: 12px 16px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    width: 270px;
    font-size: 0.85rem;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: ostreiFadeUp 0.4s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ostrei-chat-teaser:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.2);
}

.ostrei-teaser-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
}

.ostrei-teaser-close:hover {
    color: #0f172a;
}

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

/* Fenêtre de Conversation */
.ostrei-chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    height: 570px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.92) translateY(20px);
    transform-origin: bottom right;
}

.ostrei-chat-window.open {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

/* En-tête */
.ostrei-chat-header {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ostrei-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ostrei-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    position: relative;
}

.ostrei-avatar .status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border: 2px solid #0284c7;
    border-radius: 50%;
}

.ostrei-header-title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
}

.ostrei-header-subtitle {
    font-size: 0.75rem;
    opacity: 0.85;
}

.ostrei-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ostrei-btn-icon {
    background: transparent;
    border: none;
    color: #ffffff;
    opacity: 0.8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.ostrei-btn-icon:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.15);
}

/* Corps de discussion */
.ostrei-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #f8fafc;
}

/* Messages */
.ostrei-msg {
    display: flex;
    flex-direction: column;
    max-width: 84%;
    animation: ostreiMsgAnim 0.25s ease-out;
}

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

.ostrei-msg.user {
    align-self: flex-end;
}

.ostrei-msg.bot {
    align-self: flex-start;
}

.ostrei-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}

.ostrei-msg.user .ostrei-bubble {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.ostrei-msg.bot .ostrei-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ostrei-msg-time {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 4px;
}

.ostrei-msg.user .ostrei-msg-time {
    align-self: flex-end;
}

.ostrei-msg.bot .ostrei-msg-time {
    align-self: flex-start;
}

/* Questions rapides (Chips) */
.ostrei-quick-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.ostrei-chip {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0369a1;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.3;
}

.ostrei-chip:hover {
    background-color: #f0f9ff;
    border-color: #0284c7;
    transform: translateX(3px);
}

/* Carte contact d'aide / appel direct */
.ostrei-direct-call-card {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 10px 12px;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #166534;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ostrei-direct-call-card a {
    color: #15803d;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Indicateur de saisie / réflexion */
.ostrei-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.ostrei-typing-dot {
    width: 6px;
    height: 6px;
    background-color: #0284c7;
    border-radius: 50%;
    animation: ostreiBounce 1.4s infinite ease-in-out both;
}

.ostrei-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ostrei-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes ostreiBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* Pied du chat (Formulaire de saisie) */
.ostrei-chat-footer {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

.ostrei-input-group {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 4px 6px 4px 14px;
    transition: border-color 0.2s;
}

.ostrei-input-group:focus-within {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.ostrei-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.88rem;
    color: #0f172a;
    font-family: inherit;
    resize: none;
    max-height: 80px;
    line-height: 1.4;
}

.ostrei-chat-input::placeholder {
    color: #94a3b8;
}

.ostrei-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.ostrei-send-btn:hover {
    transform: scale(1.05);
}

.ostrei-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ostrei-chat-branding {
    text-align: center;
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 6px;
}

/* Responsive Mobile */
@media (max-width: 520px) {
    #ostrei-chat-widget {
        bottom: 16px;
        right: 16px;
    }
    
    .ostrei-chat-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}
