/* ==========================================================================
   SEVASATHI MINI 3D INTERACTIVE MASCOT STYLES (mascot.css)
   ========================================================================== */

.sevasathi-mascot-container {
    position: fixed !important;
    bottom: 24px !important;
    right: 28px !important;
    left: auto !important;
    width: 112px !important; /* Compact floating face dimensions */
    height: 112px !important; /* 1:1 aspect ratio for floating face orb */
    z-index: 1045 !important; /* Below chat window (1055), above hero and page content */
    pointer-events: none !important; /* Never blocks clicks on page content behind it */
    user-select: none !important;
    -webkit-user-select: none !important;
    outline: none !important;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s ease,
                filter 0.25s ease !important;
}

/* When AI Copilot Chat is open on wide desktop (>=1200px), mascot glides elegantly beside chat */
@media (min-width: 1200px) {
    .sevasathi-mascot-container.chat-active {
        right: 420px !important;
        bottom: 24px !important;
    }
}

/* When AI Copilot Chat is open on tablet/mobile (<1200px), mascot gracefully tucks away */
@media (max-width: 1199.98px) {
    .sevasathi-mascot-container.chat-active {
        opacity: 0 !important;
        pointer-events: none !important;
        transform: scale(0.85) !important;
        visibility: hidden !important;
    }
}

.sevasathi-mascot-mount {
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
    pointer-events: auto !important; /* Mascot canvas receives mouse & touch interactions */
    cursor: pointer !important;
}

.sevasathi-mascot-mount canvas {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    outline: none !important;
    background: transparent !important;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
    transition: filter 0.25s ease !important;
}

/* Hover Micro-interaction: Gentle scale-up & Cyan Glow Pulse */
.sevasathi-mascot-container:hover {
    transform: scale(1.06) translateY(-2px);
}

.sevasathi-mascot-container:hover .sevasathi-mascot-mount canvas {
    filter: drop-shadow(0 10px 26px rgba(41, 182, 246, 0.55)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}

/* Keyboard Accessibility Focus Visible Ring */
.sevasathi-mascot-container:focus-visible {
    border-radius: 50% !important;
    outline: 2px solid #29B6F6 !important;
    outline-offset: 4px !important;
}

/* ==========================================================================
   MASCOT SPEECH BUBBLE WITH DYNAMIC TYPING / BACKSPACING
   ========================================================================== */

.mascot-speech-bubble {
    position: absolute;
    right: 124px; /* Floats directly beside the compact floating face */
    bottom: 16px; /* Centered with the floating face */
    width: 285px;
    max-width: calc(100vw - 160px);
    background: rgba(11, 20, 38, 0.94);
    border: 1px solid rgba(56, 189, 248, 0.45);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65), 
                0 0 20px rgba(56, 189, 248, 0.22);
    border-radius: 16px;
    padding: 10px 14px;
    pointer-events: auto !important;
    cursor: pointer;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s ease,
                border-color 0.25s ease,
                opacity 0.3s ease;
    user-select: none;
    z-index: 1046;
}

.mascot-speech-bubble:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(56, 189, 248, 0.75);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.75), 
                0 0 28px rgba(56, 189, 248, 0.38);
}

.mascot-bubble-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.mascot-bubble-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 8px #10B981;
    display: inline-block;
    animation: statusPulse 2s infinite ease-in-out;
}

@keyframes statusPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.25); opacity: 0.75; }
}

.mascot-bubble-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #007BA7;
}

/* FIX: Standard block flow ensures typewriter text and cursor remain contiguous
   inline elements, preventing the cursor from wrapping down to an empty line */
.mascot-bubble-body {
    font-size: 0.83rem !important;
    line-height: 1.42 !important;
    font-weight: 600 !important;
    color: #F8FAFC !important;
    min-height: 2.85em !important;
    display: block !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}

.mascot-typewriter-text {
    color: #FFFFFF !important;
    font-weight: 600 !important;
    display: inline !important;
}

/* FIX: Inline display locks cursor directly after the last character on the same line */
.mascot-typewriter-cursor {
    color: #FF2D95 !important;
    font-weight: 700 !important;
    margin-left: 2px !important;
    display: inline !important;
    animation: cursorBlink 0.75s infinite !important;
    vertical-align: baseline !important;
    line-height: inherit !important;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Speech arrow pointing towards the floating face */
.mascot-bubble-tail {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 8px solid rgba(56, 189, 248, 0.45);
}

.mascot-bubble-tail::after {
    content: '';
    position: absolute;
    right: 1px;
    top: -6px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 7px solid rgba(11, 20, 38, 0.94);
}

/* When chat is active, hide speech bubble smoothly */
.sevasathi-mascot-container.chat-active .mascot-speech-bubble {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.85) !important;
    display: none !important;
}

/* WebGL Non-Available Fallback View */
.mascot-webgl-fallback {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-end !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

.mascot-fallback-avatar {
    width: 64px !important;
    height: 64px !important;
    border-radius: 50% !important;
    border: 2px solid #007BA7 !important;
    box-shadow: 0 0 16px rgba(0, 123, 167, 0.5) !important;
    background: #0A0A0A !important;
    object-fit: cover !important;
    display: block !important;
}

.mascot-fallback-billboard {
    margin-top: -8px !important;
    background: rgba(14, 14, 14, 0.94) !important;
    border: 1px solid rgba(0, 123, 167, 0.4) !important;
    border-radius: 12px !important;
    padding: 6px 10px !important;
    color: #F8FAFC !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    text-align: center !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    line-height: 1.3 !important;
    max-width: 170px !important;
}

.mascot-fallback-hint {
    display: block !important;
    font-size: 0.65rem !important;
    color: #007BA7 !important;
    margin-top: 4px !important;
    opacity: 0.8 !important;
}

/* Tablet & Mobile Responsiveness (480px - 767px) */
@media (max-width: 767.98px) {
    .sevasathi-mascot-container {
        bottom: 16px !important;
        right: 16px !important;
        bottom: max(16px, env(safe-area-inset-bottom, 0px)) !important;
        right: max(16px, env(safe-area-inset-right, 0px)) !important;
        left: auto !important;
        width: 88px !important;
        height: 88px !important;
    }
    .mascot-speech-bubble {
        right: 0 !important;
        bottom: 100% !important;
        margin-bottom: 8px !important;
        width: 230px !important;
        padding: 8px 11px !important;
    }
    .mascot-bubble-tail {
        right: 28px !important;
        top: 100% !important;
        transform: none !important;
        border-left: 7px solid transparent !important;
        border-right: 7px solid transparent !important;
        border-top: 8px solid rgba(56, 189, 248, 0.45) !important;
        border-bottom: none !important;
    }
    .mascot-bubble-tail::after {
        right: -6px !important;
        top: -8px !important;
        border-left: 6px solid transparent !important;
        border-right: 6px solid transparent !important;
        border-top: 7px solid rgba(11, 20, 38, 0.94) !important;
        border-bottom: none !important;
    }
    .mascot-fallback-avatar {
        width: 50px !important;
        height: 50px !important;
    }
    .mascot-fallback-billboard {
        font-size: 0.65rem !important;
        padding: 5px 8px !important;
    }
}

/* Compact Mobile (under 480px) - keep accessible for tapping */
@media (max-width: 479.98px) {
    .sevasathi-mascot-container {
        bottom: 12px !important;
        right: 12px !important;
        bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
        right: max(12px, env(safe-area-inset-right, 0px)) !important;
        left: auto !important;
        width: 78px !important;
        height: 78px !important;
        display: block !important;
    }
    .mascot-speech-bubble {
        width: 200px !important;
        padding: 6px 9px !important;
    }
    .mascot-bubble-body {
        font-size: 0.74rem !important;
        min-height: 2.4em !important;
    }
}

/* Respect Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .sevasathi-mascot-container {
        transition: none !important;
        transform: none !important;
    }
    .sevasathi-mascot-mount canvas {
        filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45)) !important;
    }
}

/* ==========================================================================
   THEME-AWARE MASCOT & SPEECH BUBBLE STYLING
   - Black/Dark Theme: Mascot is WHITE (Max contrast against dark theme)
   - White/Light Theme: Mascot is BLACK (Max contrast against light theme)
   ========================================================================== */

/* Dark Theme Canvas Drop Shadow (White Mascot on Dark Background) */
html.dark .sevasathi-mascot-mount canvas,
:root[data-theme="dark"] .sevasathi-mascot-mount canvas {
    filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 16px rgba(0, 242, 254, 0.45)) !important;
}

html.dark .sevasathi-mascot-container:hover .sevasathi-mascot-mount canvas,
:root[data-theme="dark"] .sevasathi-mascot-container:hover .sevasathi-mascot-mount canvas {
    filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 24px rgba(0, 242, 254, 0.75)) !important;
}

/* Light Theme Canvas Drop Shadow (Black Mascot on Light Background) */
html.light .sevasathi-mascot-mount canvas,
:root[data-theme="light"] .sevasathi-mascot-mount canvas,
:root:not(.dark) .sevasathi-mascot-mount canvas {
    filter: drop-shadow(0 10px 24px rgba(15, 23, 42, 0.22)) drop-shadow(0 0 14px rgba(14, 165, 233, 0.25)) !important;
}

html.light .sevasathi-mascot-container:hover .sevasathi-mascot-mount canvas,
:root[data-theme="light"] .sevasathi-mascot-container:hover .sevasathi-mascot-mount canvas,
:root:not(.dark) .sevasathi-mascot-container:hover .sevasathi-mascot-mount canvas {
    filter: drop-shadow(0 14px 28px rgba(15, 23, 42, 0.3)) drop-shadow(0 0 20px rgba(14, 165, 233, 0.45)) !important;
}

/* Light Theme Mascot Speech Bubble (High-Contrast White Frosted Glass) */
html.light .mascot-speech-bubble,
:root[data-theme="light"] .mascot-speech-bubble,
:root:not(.dark) .mascot-speech-bubble {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: rgba(14, 165, 233, 0.45) !important;
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.12), 
                0 0 18px rgba(14, 165, 233, 0.15) !important;
}

html.light .mascot-speech-bubble:hover,
:root[data-theme="light"] .mascot-speech-bubble:hover,
:root:not(.dark) .mascot-speech-bubble:hover {
    border-color: rgba(14, 165, 233, 0.75) !important;
    box-shadow: 0 14px 38px rgba(15, 23, 42, 0.18), 
                0 0 26px rgba(14, 165, 233, 0.3) !important;
}

html.light .mascot-bubble-title,
:root[data-theme="light"] .mascot-bubble-title,
:root:not(.dark) .mascot-bubble-title {
    color: #0284C7 !important;
}

html.light .mascot-bubble-body,
:root[data-theme="light"] .mascot-bubble-body,
:root:not(.dark) .mascot-bubble-body {
    color: #0F172A !important;
}

html.light .mascot-typewriter-text,
:root[data-theme="light"] .mascot-typewriter-text,
:root:not(.dark) .mascot-typewriter-text {
    color: #0F172A !important;
}

html.light .mascot-typewriter-cursor,
:root[data-theme="light"] .mascot-typewriter-cursor,
:root:not(.dark) .mascot-typewriter-cursor {
    color: #0284C7 !important;
}

html.light .mascot-bubble-tail,
:root[data-theme="light"] .mascot-bubble-tail,
:root:not(.dark) .mascot-bubble-tail {
    border-left-color: rgba(14, 165, 233, 0.45) !important;
}

html.light .mascot-bubble-tail::after,
:root[data-theme="light"] .mascot-bubble-tail::after,
:root:not(.dark) .mascot-bubble-tail::after {
    border-left-color: rgba(255, 255, 255, 0.95) !important;
}

@media (max-width: 767.98px) {
    html.light .mascot-bubble-tail,
    :root[data-theme="light"] .mascot-bubble-tail,
    :root:not(.dark) .mascot-bubble-tail {
        border-top-color: rgba(14, 165, 233, 0.45) !important;
        border-left-color: transparent !important;
    }
    html.light .mascot-bubble-tail::after,
    :root[data-theme="light"] .mascot-bubble-tail::after,
    :root:not(.dark) .mascot-bubble-tail::after {
        border-top-color: rgba(255, 255, 255, 0.95) !important;
        border-left-color: transparent !important;
    }
}

/* AI Copilot Chat Window Positioning & Responsiveness */
#consultant-chat-window {
    position: fixed !important;
    bottom: 24px !important;
    right: 28px !important;
    width: 360px !important;
    height: 530px !important;
    max-height: calc(100vh - 80px) !important;
    z-index: 1055 !important;
}

@media (max-width: 767.98px) {
    #consultant-chat-window {
        bottom: 12px !important;
        right: 12px !important;
        left: 12px !important;
        width: auto !important;
        max-width: calc(100vw - 24px) !important;
        height: calc(100vh - 60px) !important;
        max-height: 560px !important;
    }
}
