/* ==========================================================================
   SATYAM COMPUTER EDUCATION — SMART INTERACTIVE AI MASCOT & CLOUD CHAT CSS
   ========================================================================== */

/* ── 1. FLOATING DRAGGABLE MASCOT CONTAINER ── */
#satyamMascotContainer {
    position: fixed;
    bottom: 95px;
    right: 20px;
    width: 90px;
    height: 110px;
    cursor: grab;
    z-index: 999999;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), left 0.35s cubic-bezier(0.16, 1, 0.3, 1), right 0.35s cubic-bezier(0.16, 1, 0.3, 1), top 0.35s cubic-bezier(0.16, 1, 0.3, 1), bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

#satyamMascotContainer.dragging {
    cursor: grabbing;
    transition: none !important;
    transform: scale(1.1) !important;
}

#satyamMascotContainer:hover:not(.dragging) {
    transform: translateY(-4px) scale(1.05);
}

/* Docked States */
#satyamMascotContainer.docked-left {
    right: auto !important;
    left: 20px !important;
}
#satyamMascotContainer.docked-right {
    left: auto !important;
    right: 20px !important;
}

/* Pulsing Ambient Radar Aura Ring */
.satyam-mascot-radar {
    position: absolute;
    width: 80px;
    height: 80px;
    top: 15px;
    left: 5px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.45) 0%, rgba(99, 102, 241, 0.2) 50%, transparent 70%);
    filter: blur(8px);
    animation: satyamRadarPulse 3.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes satyamRadarPulse {
    0%, 100% { transform: scale(0.85); opacity: 0.5; }
    50% { transform: scale(1.25); opacity: 0.95; filter: blur(12px); }
}

/* Scaled Mascot Body Wrapper (Compact ~0.35x scale) */
.satyam-mascot-body {
    position: relative;
    width: 90px;
    height: 110px;
    transform-origin: center center;
    z-index: 2;
    pointer-events: none;
}

/* Spherical 3D Gradient Head */
.satyam-head-sphere {
    position: absolute;
    left: 15px;
    top: 30px;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #dbe7ff 45%, #7ea3e8 80%, #1e3a8a 100%);
    border-radius: 50%;
    box-shadow: inset -5px -5px 10px rgba(0, 0, 0, 0.55),
                0 0 14px rgba(0, 110, 255, 0.5),
                0 0 25px rgba(0, 90, 255, 0.25);
    overflow: hidden;
    z-index: 2;
}

/* Eye System */
.satyam-eyes {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.satyam-eye {
    position: absolute;
    width: 6.5px;
    height: 15px;
    background: #02040a;
    border-radius: 8px;
    box-shadow: 0 0 4px rgba(0, 150, 255, 0.9), inset 0 0 2px rgba(0, 150, 255, 0.6);
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

.satyam-eye.left {
    left: 21px;
    top: 22px;
    transform: rotate(-6deg);
}

.satyam-eye.right {
    left: 33px;
    top: 22px;
    transform: rotate(-6deg);
}

.satyam-eye.blinking {
    animation: satyamBlinkAnim 0.16s ease-in-out forwards;
}

@keyframes satyamBlinkAnim {
    0% { transform: scaleY(1); }
    50% { transform: scaleY(0.1); }
    100% { transform: scaleY(1); }
}

/* Graduation Cap System */
.satyam-graduation-cap {
    position: absolute;
    top: 10px;
    left: 5px;
    width: 80px;
    height: 35px;
    pointer-events: none;
    z-index: 5;
    transform: rotate(-3deg);
}

.satyam-cap-base {
    position: absolute;
    bottom: 3px;
    left: 22px;
    width: 36px;
    height: 14px;
    background: linear-gradient(135deg, #2b2b2b 0%, #0a0a0a 100%);
    border-radius: 18px 18px 4px 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.satyam-cap-base::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #111;
    border-radius: 0 0 4px 4px;
    border-top: 1px solid #3b82f6;
}

.satyam-cap-top {
    position: absolute;
    top: 0;
    left: 4px;
    width: 72px;
    height: 13px;
    background: linear-gradient(135deg, #1f2937 0%, #030712 100%);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.satyam-cap-tassel {
    position: absolute;
    top: 6px;
    left: 61px;
    width: 2px;
    height: 15px;
    background: #3b82f6;
    box-shadow: 0 0 4px #3b82f6;
    transform-origin: top center;
    animation: satyamTasselSwing 3s ease-in-out infinite alternate;
}

.satyam-cap-tassel::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: -1.5px;
    width: 5px;
    height: 6px;
    background: linear-gradient(135deg, #60a5fa 0%, #1d4ed8 100%);
    border-radius: 2px;
    box-shadow: 0 0 5px #60a5fa;
}

@keyframes satyamTasselSwing {
    0% { transform: rotate(-12deg); }
    100% { transform: rotate(12deg); }
}

/* Quick Side-Swap Flip Control Button (Appears on Hover) */
.satyam-flip-btn {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.5);
    color: #93c5fd;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

#satyamMascotContainer:hover .satyam-flip-btn {
    opacity: 1;
    transform: scale(1);
}

.satyam-flip-btn:hover {
    background: #2563eb;
    color: #ffffff;
    transform: scale(1.15) !important;
}

/* Friendly Dynamic Speech Bubble */
.satyam-speech-bubble {
    position: absolute;
    top: -34px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(59, 130, 246, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #f1f5f9;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 0 10px rgba(59, 130, 246, 0.25);
    z-index: 20;
    opacity: 0;
    transform: scale(0.85) translateY(4px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Bubble positioning relative to docking side */
.docked-right .satyam-speech-bubble,
#satyamMascotContainer:not(.docked-left) .satyam-speech-bubble {
    right: 5px;
}
.docked-left .satyam-speech-bubble {
    left: 5px;
}

.satyam-speech-bubble.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.satyam-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -4px;
    width: 7px;
    height: 7px;
    background: rgba(15, 23, 42, 0.92);
    border-right: 1px solid rgba(59, 130, 246, 0.5);
    border-bottom: 1px solid rgba(59, 130, 246, 0.5);
    transform: rotate(45deg);
}

.docked-right .satyam-speech-bubble::after,
#satyamMascotContainer:not(.docked-left) .satyam-speech-bubble::after {
    right: 25px;
}
.docked-left .satyam-speech-bubble::after {
    left: 25px;
}


/* ── 2. CLOUD-THEMED CONVERSATIONAL CHAT POPUP WINDOW ── */
#satyamChatWindow {
    position: fixed;
    bottom: 115px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 140px);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(59, 130, 246, 0.2);
    z-index: 999998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.92) translateY(20px);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1), left 0.35s ease, right 0.35s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #f8fafc;
}

/* Dynamic window anchoring based on mascot position */
#satyamChatWindow.docked-left {
    right: auto !important;
    left: 20px !important;
}
#satyamChatWindow.docked-right {
    left: auto !important;
    right: 20px !important;
}

#satyamChatWindow.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Cloud Header */
.satyam-chat-header {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.85) 0%, rgba(49, 46, 129, 0.85) 60%, rgba(67, 56, 202, 0.85) 100%);
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.satyam-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.satyam-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff, #7ea3e8 70%, #1e3a8a 100%);
    border: 1.5px solid #60a5fa;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
    font-size: 17px;
}

.satyam-header-text h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.satyam-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #10b981;
    font-weight: 600;
}

.satyam-status-dot {
    width: 6.5px;
    height: 6.5px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
    animation: satyamDotBlink 2s infinite;
}

@keyframes satyamDotBlink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.satyam-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.satyam-header-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.satyam-header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: scale(1.08);
}

/* Rate Limit Banner */
.satyam-rate-limit-banner {
    background: rgba(245, 158, 11, 0.18);
    border-bottom: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
    padding: 7px 16px;
    font-size: 11.5px;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 6px;
}

/* Scrollable Messages Area */
.satyam-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.satyam-chat-messages::-webkit-scrollbar {
    width: 5px;
}
.satyam-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

/* Message Rows & Cloud Bubbles */
.satyam-message-row {
    display: flex;
    gap: 10px;
    max-width: 88%;
}

.satyam-message-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.satyam-message-row.bot {
    align-self: flex-start;
}

.satyam-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle, #3b82f6, #1e3a8a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.satyam-msg-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}

.satyam-message-row.user .satyam-msg-bubble {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.satyam-message-row.bot .satyam-msg-bubble {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.satyam-msg-bubble p {
    margin: 0 0 8px 0;
}
.satyam-msg-bubble p:last-child {
    margin: 0;
}
.satyam-msg-bubble strong {
    color: #ffffff;
    font-weight: 700;
}
.satyam-msg-bubble ul, .satyam-msg-bubble ol {
    margin: 6px 0 6px 18px;
    padding: 0;
}
.satyam-msg-bubble li {
    margin-bottom: 4px;
}

/* Citations & Source Tags */
.satyam-sources-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 2px 8px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 10px;
    font-size: 10.5px;
    color: #93c5fd;
    font-weight: 500;
}

/* Action Buttons Grid */
.satyam-actions-container {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 10px;
}

.satyam-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.satyam-action-btn:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.satyam-action-whatsapp {
    background: #25D366;
    color: #ffffff !important;
}
.satyam-action-primary {
    background: #2563eb;
    color: #ffffff !important;
}
.satyam-action-group {
    background: #059669;
    color: #ffffff !important;
}
.satyam-action-portal {
    background: #4f46e5;
    color: #ffffff !important;
}
.satyam-action-subscribe {
    background: #8b5cf6;
    color: #ffffff !important;
}

/* Suggestion Chips Container */
.satyam-suggestions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.satyam-chip {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    padding: 6px 12px;
    border-radius: 14px;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.satyam-chip:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: #3b82f6;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Typing Indicator Animation */
.satyam-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
}

.satyam-dot {
    width: 6px;
    height: 6px;
    background: #60a5fa;
    border-radius: 50%;
    animation: satyamBounce 1.4s infinite ease-in-out both;
}

.satyam-dot:nth-child(1) { animation-delay: -0.32s; }
.satyam-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes satyamBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chat Input Footer */
.satyam-chat-footer {
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.satyam-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 4px 6px 4px 14px;
    transition: border-color 0.2s ease;
}

.satyam-input-form:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.satyam-input-field {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-size: 13.5px;
    padding: 6px 0;
    font-family: inherit;
}

.satyam-input-field::placeholder {
    color: #64748b;
}

.satyam-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.satyam-send-btn:hover {
    transform: scale(1.08);
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

.satyam-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── 3. RESPONSIVE MOBILE VIEWPORTS (< 480px) ── */
@media (max-width: 480px) {
    #satyamMascotContainer {
        bottom: 85px !important;
        width: 75px;
        height: 95px;
    }
    
    .satyam-mascot-body {
        transform: scale(0.85);
    }
    
    #satyamChatWindow {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
    }
}
