/* Prof IA — Chat IA « comme avec un vrai professeur » */

/* ---------- Bandeau du professeur ---------- */
#prof-ia-module .pia-prof-hero {
    display: flex; align-items: center; gap: 18px; padding: 14px 22px 0;
    border-bottom: 1px solid #e3ebf5;
    background:
        linear-gradient(180deg, rgba(255,255,255,0) 70%, rgba(255,255,255,.9)),
        radial-gradient(circle at 12% 0%, rgba(255,179,0,.12), transparent 40%);
}
#prof-ia-module .pia-prof-board {
    position: relative; width: 150px; height: 118px; flex: 0 0 auto;
    background: #2f5d46; border: 6px solid #a0703f; border-bottom: 0; border-radius: 10px 10px 0 0;
    box-shadow: inset 0 0 22px rgba(0,0,0,.35);
    overflow: hidden;
}
#prof-ia-module .pia-prof-board::before {
    content: "U = R × I"; position: absolute; left: 10px; top: 8px;
    font: 600 15px/1 "Comic Sans MS", "Chalkboard SE", "Segoe Print", cursive;
    color: rgba(255,255,255,.55); transform: rotate(-4deg);
}
#prof-ia-module .pia-prof-avatar {
    position: absolute; left: 50%; bottom: -4px; width: 112px; height: 112px; transform: translateX(-50%);
    cursor: pointer;
}
#prof-ia-module .pia-prof-id { flex: 1; min-width: 0; padding-bottom: 12px; }
#prof-ia-module .pia-prof-name { font-size: 1.35rem; font-weight: 800; color: var(--pia-title, #0f4c81); line-height: 1.2; }
#prof-ia-module .pia-prof-role { font-size: 13px; color: #64748b; margin-top: 2px; }
#prof-ia-module .pia-prof-status { display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 13.5px; font-weight: 600; color: #2e7d32; }
#prof-ia-module .pia-prof-dot { width: 9px; height: 9px; border-radius: 50%; background: #43a047; box-shadow: 0 0 0 3px rgba(67,160,71,.18); }
#prof-ia-module .pia-prof-avatar[data-state="thinking"] ~ * .pia-prof-dot { background: #ffb300; }
#prof-ia-module .pia-prof-voice {
    align-self: center; margin-bottom: 12px; border: 1px solid #c7d7ea; background: #fff; color: #0f4c81;
    border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
#prof-ia-module .pia-prof-voice.is-on { background: #0f4c81; color: #fff; border-color: #0f4c81; }

/* ---------- Animations de l'avatar ---------- */
.pia-prof-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pia-prof-svg .p-body { transform-origin: 80px 160px; animation: piaProfBreath 4.5s ease-in-out infinite; }
.pia-prof-svg .p-head { transform-origin: 80px 108px; }
.pia-prof-svg .p-eyes { transform-box: fill-box; transform-origin: center; animation: piaProfBlink 5s infinite; }
.pia-prof-svg .p-pupils { transition: transform .35s ease; }
.pia-prof-svg .p-brows { transition: transform .35s ease; }
.pia-prof-svg .p-mouth-open { display: none; transform-box: fill-box; transform-origin: center; }
.pia-prof-svg .p-thought { opacity: 0; transition: opacity .3s; }
.pia-prof-svg .p-arm { transform-origin: 118px 150px; transform: rotate(38deg); opacity: 0; transition: opacity .2s; }

[data-state="thinking"] .pia-prof-svg .p-pupils { transform: translate(3px, -4px); }
[data-state="thinking"] .pia-prof-svg .p-brows { transform: translateY(-2px); }
[data-state="thinking"] .pia-prof-svg .p-head { animation: piaProfTilt 2.4s ease-in-out infinite; }
[data-state="thinking"] .pia-prof-svg .p-thought { opacity: 1; }
[data-state="thinking"] .pia-prof-svg .p-thought .d1 { animation: piaProfDot 1.2s infinite; }
[data-state="thinking"] .pia-prof-svg .p-thought .d2 { animation: piaProfDot 1.2s .2s infinite; }
[data-state="thinking"] .pia-prof-svg .p-thought .d3 { animation: piaProfDot 1.2s .4s infinite; }

[data-state="talking"] .pia-prof-svg .p-mouth-smile { display: none; }
[data-state="talking"] .pia-prof-svg .p-mouth-open { display: inline; animation: piaProfTalk .18s ease-in-out infinite alternate; }
[data-state="talking"] .pia-prof-svg .p-head { animation: piaProfNod 1.6s ease-in-out infinite; }
[data-state="talking"] .pia-prof-svg .p-brows { transform: translateY(-1.5px); }

[data-state="wave"] .pia-prof-svg .p-arm { opacity: 1; animation: piaProfWave .5s ease-in-out 4 alternate; }
[data-state="wave"] .pia-prof-svg .p-mouth-smile { transform: scale(1.1); transform-box: fill-box; transform-origin: center; }

@keyframes piaProfBreath { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes piaProfBlink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes piaProfTalk { from { transform: scaleY(.25); } to { transform: scaleY(1.05); } }
@keyframes piaProfNod { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-2deg); } 70% { transform: rotate(1.5deg); } }
@keyframes piaProfTilt { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(4deg); } }
@keyframes piaProfWave { from { transform: rotate(20deg); } to { transform: rotate(55deg); } }
@keyframes piaProfDot { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* ---------- Zone de discussion façon cahier ---------- */
#prof-ia-module .pia-chatbox-shell .pia-chat-history {
    background-color: #fdfdfb;
    background-image:
        linear-gradient(90deg, transparent 47px, rgba(229, 115, 115, .35) 47px, rgba(229, 115, 115, .35) 49px, transparent 49px),
        repeating-linear-gradient(180deg, transparent 0 27px, rgba(144, 180, 220, .28) 27px 28px);
    padding-left: 64px;
}
#prof-ia-module .pia-chat-row { align-items: flex-end; gap: 10px; }
#prof-ia-module .pia-chat-row.user { flex-direction: row-reverse; justify-content: flex-start; }
#prof-ia-module .pia-chat-avatar {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; overflow: hidden;
    background: #e8f1fb; border: 2px solid #fff; box-shadow: 0 3px 8px rgba(15, 76, 129, .15);
}
#prof-ia-module .pia-chat-avatar .pia-prof-svg { width: 150%; height: 150%; margin: -6px 0 0 -11px; }
#prof-ia-module .pia-chat-avatar .pia-prof-svg * { animation: none !important; }
#prof-ia-module .pia-chat-avatar .p-thought, #prof-ia-module .pia-chat-avatar .p-arm { display: none; }
#prof-ia-module .pia-chat-avatar.is-student {
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px;
    color: #fff; background: linear-gradient(135deg, #ff9f1c, #ef6c00);
}
#prof-ia-module .pia-chat-row.assistant .pia-chat-bubble {
    background: #fff; border: 1px solid #dbe5f0; border-left: 4px solid #ffb300;
    border-radius: 4px 18px 18px 18px; font-size: 15px;
}
#prof-ia-module .pia-chat-row.user .pia-chat-bubble { border-radius: 18px 4px 18px 18px; font-size: 15px; }
#prof-ia-module .pia-chat-row.assistant .pia-chat-content strong { color: #0f4c81; }
#prof-ia-module .pia-chat-meta { font-weight: 600; }

/* Apparition des paragraphes au rythme de la parole */
#prof-ia-module .pia-reveal { display: none; }
#prof-ia-module .pia-reveal.is-in { display: block; animation: piaProfIn .35s ease; }
@keyframes piaProfIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Accueil ---------- */
#prof-ia-module .pia-prof-welcome {
    text-align: left; max-width: 680px; margin: 10px 0 0; padding: 0; background: none; border: 0; box-shadow: none;
}
#prof-ia-module .pia-prof-welcome-bubble {
    background: #fff; border: 1px solid #dbe5f0; border-left: 4px solid #ffb300; border-radius: 4px 18px 18px 18px;
    padding: 16px 18px; color: #1f2937; line-height: 1.6; box-shadow: 0 10px 22px rgba(15, 76, 129, .06);
}
#prof-ia-module .pia-prof-welcome-bubble strong { color: #0f4c81; font-size: 1.05rem; }
#prof-ia-module .pia-prof-welcome-bubble p { margin: 8px 0 0; }
#prof-ia-module .pia-prof-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
#prof-ia-module .pia-prof-chip {
    border: 1px solid #c7d7ea; background: #fff; color: #0f4c81; border-radius: 999px; padding: 8px 14px;
    font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; transition: background .15s, transform .15s;
}
#prof-ia-module .pia-prof-chip:hover { background: #f1f7ff; transform: translateY(-1px); }

@media (max-width: 768px) {
    #prof-ia-module .pia-prof-hero { padding: 10px 12px 0; gap: 10px; flex-wrap: wrap; }
    #prof-ia-module .pia-prof-board { width: 110px; height: 92px; }
    #prof-ia-module .pia-prof-avatar { width: 88px; height: 88px; }
    #prof-ia-module .pia-prof-name { font-size: 1.1rem; }
    #prof-ia-module .pia-prof-voice { margin-bottom: 8px; }
    #prof-ia-module .pia-chatbox-shell .pia-chat-history { padding-left: 14px; background-image: repeating-linear-gradient(180deg, transparent 0 27px, rgba(144, 180, 220, .25) 27px 28px); }
    #prof-ia-module .pia-chat-avatar { width: 34px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
    .pia-prof-svg *, .pia-prof-svg { animation: none !important; transition: none !important; }
}

/* Boutons d'action superposés (ne réservent plus de place sous le message) */
#prof-ia-module .pia-chatbox-shell .pia-chat-bubble { padding-bottom: 12px; }
#prof-ia-module .pia-chatbox-shell .pia-chat-actions { position: absolute; right: 10px; bottom: 6px; margin: 0; }
#prof-ia-module .pia-chatbox-shell .pia-chat-row.user .pia-chat-actions { display: none; }
#prof-ia-module.pia-chat-mode .pia-topbar-title { display: none; }
@media (hover: none) {
    #prof-ia-module .pia-chatbox-shell .pia-chat-row.assistant .pia-chat-actions { opacity: 1; position: static; margin-top: 6px; }
}
