@charset "UTF-8";
/* Teacher Chat / Wizard Animation Styles */

/* --- Streaming Cursor Animation --- */
/* 直接插入的游標 span：顯示 ...| */
.streaming-cursor::before {
    content: '...';
    color: #94a3b8;
}

.streaming-cursor::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: #6366f1;
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: cursor-blink 0.8s ease-in-out infinite;
}

@keyframes cursor-blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* --- Wizard Animation --- */
/* 使用 data-state 來控制狀態 */
#wizard-wrapper,
#wizard-wrapper-new {
    transform-origin: bottom center;
}

/* 呼吸 (Idle) */
#wizard-wrapper[data-state="idle"],
#wizard-wrapper-new[data-state="idle"] {
    animation: wizard-breathe 3s ease-in-out infinite;
}

@keyframes wizard-breathe {

    0%,
    100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(1.02);
    }
}

/* 思考 (Thinking) */
#wizard-wrapper[data-state="thinking"],
#wizard-wrapper-new[data-state="thinking"] {
    animation: wizard-think 1.2s ease-in-out infinite;
}

@keyframes wizard-think {

    0%,
    100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(1.03);
    }
}

/* 說話 (Speaking) */
#wizard-wrapper[data-state="speaking"],
#wizard-wrapper-new[data-state="speaking"] {
    transform: scaleY(1);
}

/* 聆聽 (Listening) */
#wizard-wrapper[data-state="listening"],
#wizard-wrapper-new[data-state="listening"] {
    transform: scaleY(1);
}

/* --- Idea Bulb Animation (Thinking) --- */
.wizard-idea-bulb {
    transform-origin: bottom left;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    opacity: 0;
    transform: scale(0.5);
}

#wizard-wrapper[data-state="thinking"] .wizard-idea-bulb,
#wizard-wrapper-new[data-state="thinking"] .wizard-idea-bulb {
    opacity: 1;
    transform: scale(1);
    animation: bulb-float 1.5s ease-in-out infinite;
}

#wizard-wrapper[data-state="thinking"] .bulb-rays,
#wizard-wrapper-new[data-state="thinking"] .bulb-rays {
    animation: rays-flash 1s infinite alternate;
}

@keyframes bulb-float {

    0%,
    100% {
        transform: scale(1) translateY(0);
    }

    50% {
        transform: scale(1) translateY(-3px);
    }
}

@keyframes rays-flash {
    0% {
        opacity: 0.5;
        stroke-width: 2;
    }

    100% {
        opacity: 1;
        stroke-width: 4;
    }
}

/* --- Listening Ear Animation --- */
.wizard-listen-ear {
    transform-origin: center;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    opacity: 0;
    transform: scale(0.5);
}

#wizard-wrapper[data-state="listening"] .wizard-listen-ear,
#wizard-wrapper-new[data-state="listening"] .wizard-listen-ear {
    opacity: 1;
    transform: scale(1);
    animation: ear-pulse 1.2s ease-in-out infinite;
}

@keyframes ear-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* --- Mouth Animation --- */
.wizard-mouth {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.2s;
}

#wizard-wrapper[data-state="speaking"] .wizard-mouth,
#wizard-wrapper-new[data-state="speaking"] .wizard-mouth {
    animation: mouth-talk 0.2s infinite;
}

@keyframes mouth-talk {

    0%,
    100% {
        transform: scaleY(0.8);
    }

    50% {
        transform: scaleY(1.5);
    }
}

/* --- Eyelids Animation (Blink) --- */
.wizard-eyelids {
    transform-box: fill-box;
    transform-origin: top;
    animation: blink 4s infinite;
}

@keyframes blink {

    0%,
    92%,
    100% {
        transform: scaleY(0);
    }

    95% {
        transform: scaleY(1);
    }

    96% {
        transform: scaleY(0.2);
    }
}

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {

    #wizard-wrapper,
    #wizard-wrapper-new,
    .wizard-mouth,
    .wizard-eyelids,
    .wizard-idea-bulb,
    .wizard-listen-ear {
        animation: none !important;
        transition: none !important;
    }
}

/* --- Wizard Container Fixed Position (Draggable to 8 positions) --- */
.wizard-fixed-container {
    position: fixed;
    z-index: 40;
    width: 100px;
    height: 100px;
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: top 0.3s ease, bottom 0.3s ease, left 0.3s ease, right 0.3s ease, transform 0.2s ease;
}

.wizard-fixed-container:active {
    cursor: grabbing;
}

.wizard-fixed-container.dragging {
    cursor: grabbing;
    transition: none;
    transform: scale(1.1);
    z-index: 100;
}

/* 螢幕四個角落 */
.wizard-fixed-container[data-position="bottom-right"] {
    right: 1rem;
    bottom: 6rem;
    left: auto;
    top: auto;
}

.wizard-fixed-container[data-position="bottom-left"] {
    left: 1rem;
    bottom: 6rem;
    right: auto;
    top: auto;
}

.wizard-fixed-container[data-position="top-right"] {
    right: 1rem;
    top: 5rem;
    left: auto;
    bottom: auto;
}

.wizard-fixed-container[data-position="top-left"] {
    left: 1rem;
    top: 5rem;
    right: auto;
    bottom: auto;
}

/* 左右中間 */
.wizard-fixed-container[data-position="middle-right"] {
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    left: auto;
    bottom: auto;
}

.wizard-fixed-container[data-position="middle-left"] {
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    right: auto;
    bottom: auto;
}

/* 聊天視窗內的左上和左下 (桌面版 sidebar 右邊) */
.wizard-fixed-container[data-position="chat-top-left"] {
    left: 1rem;
    top: 5rem;
    right: auto;
    bottom: auto;
}

.wizard-fixed-container[data-position="chat-bottom-left"] {
    left: 1rem;
    bottom: 6rem;
    right: auto;
    top: auto;
}

@media (min-width: 640px) {
    .wizard-fixed-container {
        width: 120px;
        height: 120px;
    }

    .wizard-fixed-container[data-position="bottom-right"] {
        right: 1.5rem;
        bottom: 7rem;
    }

    .wizard-fixed-container[data-position="bottom-left"] {
        left: 1.5rem;
        bottom: 7rem;
    }

    .wizard-fixed-container[data-position="top-right"] {
        right: 1.5rem;
        top: 5rem;
    }

    .wizard-fixed-container[data-position="top-left"] {
        left: 1.5rem;
        top: 5rem;
    }

    .wizard-fixed-container[data-position="middle-right"] {
        right: 1.5rem;
    }

    .wizard-fixed-container[data-position="middle-left"] {
        left: 1.5rem;
    }

    .wizard-fixed-container[data-position="chat-top-left"] {
        left: 1.5rem;
        top: 5rem;
    }

    .wizard-fixed-container[data-position="chat-bottom-left"] {
        left: 1.5rem;
        bottom: 7rem;
    }
}

@media (min-width: 1024px) {
    .wizard-fixed-container {
        width: 140px;
        height: 140px;
    }

    .wizard-fixed-container:hover:not(.dragging) {
        transform: scale(1.05);
    }

    .wizard-fixed-container[data-position="middle-right"]:hover:not(.dragging),
    .wizard-fixed-container[data-position="middle-left"]:hover:not(.dragging) {
        transform: translateY(-50%) scale(1.05);
    }

    .wizard-fixed-container[data-position="bottom-right"] {
        right: 2.5rem;
        bottom: 8rem;
    }

    .wizard-fixed-container[data-position="bottom-left"] {
        left: 2.5rem;
        bottom: 8rem;
    }

    .wizard-fixed-container[data-position="top-right"] {
        right: 2.5rem;
        top: 6rem;
    }

    .wizard-fixed-container[data-position="top-left"] {
        left: 2.5rem;
        top: 6rem;
    }

    .wizard-fixed-container[data-position="middle-right"] {
        right: 2.5rem;
    }

    .wizard-fixed-container[data-position="middle-left"] {
        left: 2.5rem;
    }

    /* 聊天視窗內：考慮 sidebar 寬度 (18rem = 288px) */
    .wizard-fixed-container[data-position="chat-top-left"] {
        left: calc(18rem + 3rem);
        top: 6rem;
    }

    .wizard-fixed-container[data-position="chat-bottom-left"] {
        left: calc(18rem + 3rem);
        bottom: 8rem;
    }
}

@media (min-width: 1280px) {
    .wizard-fixed-container {
        width: 160px;
        height: 160px;
    }

    .wizard-fixed-container[data-position="bottom-right"] {
        right: 3rem;
        bottom: 9rem;
    }

    .wizard-fixed-container[data-position="bottom-left"] {
        left: 3rem;
        bottom: 9rem;
    }

    .wizard-fixed-container[data-position="top-right"] {
        right: 3rem;
        top: 6rem;
    }

    .wizard-fixed-container[data-position="top-left"] {
        left: 3rem;
        top: 6rem;
    }

    .wizard-fixed-container[data-position="middle-right"] {
        right: 3rem;
    }

    .wizard-fixed-container[data-position="middle-left"] {
        left: 3rem;
    }

    .wizard-fixed-container[data-position="chat-top-left"] {
        left: calc(18rem + 3.5rem);
        top: 6rem;
    }

    .wizard-fixed-container[data-position="chat-bottom-left"] {
        left: calc(18rem + 3.5rem);
        bottom: 9rem;
    }
}

/* 拖曳時的提示區域 */
.wizard-drop-zone {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    border: 2px dashed rgba(99, 102, 241, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
    z-index: 39;
}

.wizard-drop-zone.visible {
    opacity: 1;
}

.wizard-drop-zone.active {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.7);
    transform: scale(1.2);
}

/* 螢幕四角的 drop zone */
.wizard-drop-zone[data-position="bottom-right"] {
    right: 0.5rem;
    bottom: 5.5rem;
}

.wizard-drop-zone[data-position="bottom-left"] {
    left: 0.5rem;
    bottom: 5.5rem;
}

.wizard-drop-zone[data-position="top-right"] {
    right: 0.5rem;
    top: 4.5rem;
}

.wizard-drop-zone[data-position="top-left"] {
    left: 0.5rem;
    top: 4.5rem;
}

/* 左右中間的 drop zone */
.wizard-drop-zone[data-position="middle-right"] {
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.wizard-drop-zone[data-position="middle-left"] {
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.wizard-drop-zone[data-position="middle-right"].active,
.wizard-drop-zone[data-position="middle-left"].active {
    transform: translateY(-50%) scale(1.2);
}

/* 聊天視窗內的 drop zone */
.wizard-drop-zone[data-position="chat-top-left"] {
    left: 0.5rem;
    top: 4.5rem;
}

.wizard-drop-zone[data-position="chat-bottom-left"] {
    left: 0.5rem;
    bottom: 5.5rem;
}

@media (min-width: 1024px) {
    .wizard-drop-zone[data-position="bottom-right"] {
        right: 2rem;
        bottom: 7.5rem;
    }

    .wizard-drop-zone[data-position="bottom-left"] {
        left: 2rem;
        bottom: 7.5rem;
    }

    .wizard-drop-zone[data-position="top-right"] {
        right: 2rem;
        top: 5.5rem;
    }

    .wizard-drop-zone[data-position="top-left"] {
        left: 2rem;
        top: 5.5rem;
    }

    .wizard-drop-zone[data-position="middle-right"] {
        right: 2rem;
    }

    .wizard-drop-zone[data-position="middle-left"] {
        left: 2rem;
    }

    .wizard-drop-zone[data-position="chat-top-left"] {
        left: calc(18rem + 2.5rem);
        top: 5.5rem;
    }

    .wizard-drop-zone[data-position="chat-bottom-left"] {
        left: calc(18rem + 2.5rem);
        bottom: 7.5rem;
    }
}

.wizard-fixed-container #wizard-wrapper,
.wizard-fixed-container #wizard-wrapper-new {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 12px rgba(91, 94, 166, 0.3));
}