/* =============================================================
   PROFESSEUR TRYPHON GOLDBERG — Bulle d'accueil et avatar
   Mix Rabbi Jacob × Professeur Tournesol
   ============================================================= */

/* ============= AVATAR SVG INLINE (fallback) ============= */
.tryphon-avatar-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============= BULLE D'ACCUEIL ============= */
.tryphon-bulle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    gap: 14px;
    max-width: calc(100vw - 48px);
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tryphon-bulle.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Avatar circulaire du personnage */
.tryphon-avatar {
    width: 84px;
    height: 84px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #f4ead4 0%, #e8a532 100%);
    border: 3px solid #9b1c1c;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    animation: tryphonBalance 6s ease-in-out infinite;
}

.tryphon-avatar:hover {
    animation: tryphonAgitation 0.6s ease-in-out;
}

@keyframes tryphonBalance {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-3px) rotate(2deg); }
}

@keyframes tryphonAgitation {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-8deg); }
    40% { transform: rotate(8deg); }
    60% { transform: rotate(-5deg); }
    80% { transform: rotate(5deg); }
}

.tryphon-avatar img,
.tryphon-avatar svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Bulle de dialogue */
.tryphon-bulle-contenu {
    background: #fdf6e3;
    color: #2c1810;
    padding: 16px 20px;
    border-radius: 18px;
    border: 2px solid #9b1c1c;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    max-width: 380px;
    position: relative;
    font-family: Georgia, 'EB Garamond', serif;
    font-size: 0.95rem;
    line-height: 1.55;
}

/* Petite flèche pointant vers l'avatar */
.tryphon-bulle-contenu::after {
    content: '';
    position: absolute;
    left: -12px;
    bottom: 26px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 12px solid #9b1c1c;
}

.tryphon-bulle-contenu::before {
    content: '';
    position: absolute;
    left: -9px;
    bottom: 26px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 12px solid #fdf6e3;
    z-index: 1;
}

.tryphon-bulle-texte {
    margin: 0 0 12px 0;
    font-style: italic;
}

.tryphon-bulle-signature {
    font-size: 0.78rem;
    color: #9b1c1c;
    font-weight: 600;
    text-align: right;
    margin: 0;
    letter-spacing: 0.02em;
}

/* Actions sous le texte */
.tryphon-bulle-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.tryphon-bulle-btn {
    background: #9b1c1c;
    color: #fdf6e3;
    border: none;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.83rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, transform 0.15s;
}

.tryphon-bulle-btn:hover {
    background: #c84545;
    transform: translateY(-1px);
}

.tryphon-bulle-btn.secondaire {
    background: transparent;
    color: #9b1c1c;
    border: 1px solid #9b1c1c;
}

.tryphon-bulle-btn.secondaire:hover {
    background: rgba(155, 28, 28, 0.1);
}

/* Bouton fermer en haut à droite */
.tryphon-bulle-fermer {
    position: absolute;
    top: 6px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #9b1c1c;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.tryphon-bulle-fermer:hover {
    opacity: 1;
}

/* Animation typing dots pour suggérer une dictée progressive */
.tryphon-typing-dots {
    display: inline-block;
}

.tryphon-typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 2px;
    background: #9b1c1c;
    border-radius: 50%;
    opacity: 0.4;
    animation: tryphonTypingDot 1.2s infinite ease-in-out;
}

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

@keyframes tryphonTypingDot {
    0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* Responsive */
@media (max-width: 600px) {
    .tryphon-bulle {
        bottom: 14px;
        right: 14px;
        left: 14px;
        max-width: none;
    }
    .tryphon-avatar {
        width: 64px;
        height: 64px;
    }
    .tryphon-bulle-contenu {
        max-width: none;
        font-size: 0.9rem;
    }
}

/* ============= MODE INVITÉ (sidebar) ============= */
/* L'avatar Tryphon dans la sidebar pour les invités */
.tryphon-mini-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #f4ead4 0%, #e8a532 100%);
    border: 2px solid #9b1c1c;
    overflow: hidden;
}
