/* ===========================================================
   Tutor Mode Layout - Desktop Only
   When the Tutor button is clicked, UI elements shift to the left
   =========================================================== */

/* Desktop-only tutor mode styles (min-width: 769px) */
@media (min-width: 769px) {
    
    /* ============ TTS Overlay - Move to Top-Left Corner ============ */
    body.tutor-mode-active #tts-overlay-host {
        top: 20px !important;
        bottom: auto !important;
        left: 20px !important;
        right: auto !important;
        transform: none !important;
        transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    }
    
    /* Volume slider opens BELOW the button (not upward) when at top of screen */
    body.tutor-mode-active #tts-overlay-host::part(vol-box) {
        bottom: auto !important;
        top: calc(100% + 10px) !important;
        transform: translateY(0) !important;
    }
    
    /* ============ Chat UI - Constrained to Left 50% of Screen ============ */
    /* All chat-related elements fit within the left half (50vw) with 20px margin */
    
    body.tutor-mode-active .chat-container {
        left: 20px !important;
        right: auto !important;
        transform: none !important;
        width: calc(50vw - 40px) !important;
        max-width: calc(50vw - 40px) !important;
        min-width: 320px !important;
        transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    }
    
    body.tutor-mode-active .chat-container.chat-focused {
        left: 20px !important;
        transform: none !important;
    }
    
    body.tutor-mode-active .chat-header {
        left: 20px !important;
        right: auto !important;
        transform: none !important;
        width: calc(50vw - 40px) !important;
        max-width: calc(50vw - 40px) !important;
        min-width: 320px !important;
        transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    }
    
    body.tutor-mode-active .floating-mic-container {
        left: 20px !important;
        right: auto !important;
        transform: none !important;
        width: calc(50vw - 40px) !important;
        max-width: calc(50vw - 40px) !important;
        min-width: 320px !important;
        transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    }
    
    body.tutor-mode-active .standalone-action-buttons-container {
        left: 20px !important;
        right: auto !important;
        transform: none !important;
        width: calc(50vw - 40px) !important;
        max-width: calc(50vw - 40px) !important;
        min-width: 320px !important;
        transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    }
    
    /* ============ Chat Close Button - Move to Top-Left ============ */
    body.tutor-mode-active .chat-header .exit-chat-btn,
    body.tutor-mode-active #exit-chat-btn {
        position: absolute !important;
        left: 12px !important;
        right: auto !important;
        top: 6px !important;
        margin: 0 !important;
    }
    
    body.tutor-mode-active .chat-header-top {
        justify-content: flex-start !important;
        padding-left: 50px !important;
    }
    
    /* ============ Hide Timeline Event Notification ============ */
    body.tutor-mode-active .bio-notification,
    body.tutor-mode-active .timeline-notification,
    body.tutor-mode-active .bio-button .notification-dot,
    body.tutor-mode-active #bio-button .notification-dot,
    body.tutor-mode-active #bio-button-lab .notification-dot {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
    
    /* ============ Chat Header Buttons - Smaller & Compact ============ */
    body.tutor-mode-active .chat-header-buttons {
        gap: 4px !important;
        padding: 4px 8px !important;
    }
    
    body.tutor-mode-active .chat-header-buttons button,
    body.tutor-mode-active .chat-header-buttons .btn {
        font-size: 11px !important;
        padding: 4px 8px !important;
        min-width: auto !important;
        height: auto !important;
        line-height: 1.2 !important;
    }
    
    body.tutor-mode-active .chat-header-buttons button i,
    body.tutor-mode-active .chat-header-buttons .btn i {
        font-size: 11px !important;
    }
    
    /* ============ 3D Canvas/Character - Shift Left ============ */
    body.tutor-mode-active #canvas-container,
    body.tutor-mode-active canvas#viewer {
        transform: translateX(-15vw) !important;
        transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    }
    
    /* ============ Tutor Button Active State ============ */
    body.tutor-mode-active #tutor-button {
        background: rgba(201, 162, 39, 0.3) !important;
        border-color: rgba(201, 162, 39, 0.6) !important;
        box-shadow: 0 0 10px rgba(201, 162, 39, 0.3);
    }
    
    /* ============ Tutor Panel (Right 50% of Screen) ============ */
    body.tutor-mode-active #tutor-sheet {
        left: 50% !important;
        right: 0 !important;
        width: 50vw !important;
        transform: translateX(0) !important;
    }
}

/* ============ Mobile - Tutor Panel Full Width ============ */
@media (max-width: 768px) {
    /* Tutor panel takes full width on mobile */
    body.tutor-mode-active #tutor-sheet {
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        transform: translateX(0) !important;
    }
    
    /* Chat elements keep their default centered position on mobile */
    body.tutor-mode-active .chat-container,
    body.tutor-mode-active .floating-mic-container,
    body.tutor-mode-active .standalone-action-buttons-container,
    body.tutor-mode-active .chat-header {
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: auto !important;
        max-width: none !important;
    }
}

/* ============ Tutor Sheet Base Styles ============ */
#tutor-sheet {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 50vw;
    max-width: 100vw;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    pointer-events: auto;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateX(100%);
    background: #000000;
    border: 1px solid rgba(255, 255, 255, 0.2)!important;

    /* Keep right corners rounded, remove left ones */
    border-top-right-radius: 0px;
    border-bottom-right-radius: 0px;
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
}

#tutor-sheet.tutor-open {
    transform: translateX(0);
}

/* ============ Tutor Container Styles ============ */
#tutor-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ============ Tutor Close Button ============ */
.tutor-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tutor-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ============ Responsive Mobile Adjustments ============ */
@media (max-width: 768px) {
    #tutor-sheet {
        width: 100vw;
    }
}
