/* ── AI Chat Widget Styles (Digital Dustak Theme) ────────────────────────── */

:root {
    --chat-accent: #f57c2c;
    --chat-bg: rgba(13, 13, 15, 0.95);
    --chat-text: #e0e0e0;
    --chat-panel: #1a1a1d;
}

#celestial-chat-container {
    position: fixed;
    bottom: -60px;   /* Push down so legs go below screen edge */
    right: 20px;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
    transition: none;
    pointer-events: none;
}

/* Re-enable pointer events for actual interactive children */
#celestial-chat-container * {
    pointer-events: auto;
}

/* Launcher Button (The Robot Mascot) */
#chat-launcher {
    width: 180px;
    height: 220px;   /* Taller so more robot body is visible */
    cursor: pointer;
    position: relative;
    overflow: visible;
    display: flex;
    align-items: flex-end;  /* Anchor to bottom so legs clip below */
    justify-content: center;
}

#chat-launcher img {
    width: 130%;
    height: 130%;
    object-fit: contain;
    /* White background PNG — no blend mode needed */
    mix-blend-mode: normal;
    animation: breathing 4s ease-in-out infinite;
    will-change: transform;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 15px rgba(245, 124, 44, 0.15));
}

@keyframes breathing {
    0%   { transform: scale(1)    translateY(0px)  rotate(0deg); }
    20%  { transform: scale(1.01) translateY(-3px) rotate(-1deg); }
    40%  { transform: scale(1.02) translateY(-5px) rotate(1deg); }
    60%  { transform: scale(1.01) translateY(-3px) rotate(-1deg); }
    80%  { transform: scale(1.01) translateY(-2px) rotate(0.5deg); }
    100% { transform: scale(1)    translateY(0px)  rotate(0deg); }
}

#chat-launcher:hover img {
    transform: scale(1.08) translateY(-10px);
    filter: drop-shadow(0 0 20px rgba(245, 124, 44, 0.6));
    animation-play-state: paused;
}

/* Autonomous Speech Bubble */
.chat-speech-bubble {
    position: absolute;
    top: -75px; 
    right: 20px;
    transform: translateY(20px) scale(0.8);
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(245, 124, 44, 0.4);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5), 0 0 15px rgba(245, 124, 44, 0.2);
    border-radius: 12px;
    padding: 12px 18px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    z-index: 100;
}

.chat-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 60px; /* Triangle aligned with launcher icon center */
    transform: rotate(45deg);
    width: 12px;
    height: 12px;
    background: rgba(20, 20, 20, 0.95);
    border-right: 1px solid rgba(245, 124, 44, 0.4);
    border-bottom: 1px solid rgba(245, 124, 44, 0.4);
}

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

/* Chat Window */
#chat-window {
    position: absolute;
    /* Fixed offset relative to the launcher */
    bottom: 100%;
    right: 0; /* Align with right edge of launcher container */
    margin-bottom: 20px;
    width: 320px;
    height: 460px;
    background: var(--chat-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(245, 124, 44, 0.2);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

#chat-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Chat Header */
.chat-header {
    padding: 15px 20px;
    background: linear-gradient(90deg, #1a1a1d, #252528);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #000;
    border: 1px solid var(--chat-accent);
    padding: 2px;
}

.header-info h4 {
    margin: 0;
    color: #fff;
    font-size: 15px;
    letter-spacing: 0.5px;
}

.header-info span {
    font-size: 11px;
    color: #00ff88;
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-info span::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 5px #00ff88;
}

/* Chat Body */
.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.chat-body::-webkit-scrollbar {
    width: 4px;
}
.chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.chat-body::-webkit-scrollbar-thumb {
    background: rgba(245, 124, 44, 0.3);
    border-radius: 10px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: fade-slide 0.3s ease;
}

@keyframes fade-slide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bot-message {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    color: var(--chat-text);
    border-bottom-left-radius: 4px;
}

.user-message {
    align-self: flex-end;
    background: var(--chat-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 10px 20px rgba(245, 124, 44, 0.2);
}

/* Chat Footer */
.chat-footer {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 10px;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    outline: none;
    transition: border 0.3s;
}

#chat-input:focus {
    border-color: var(--chat-accent);
}

#send-msg-btn {
    background: var(--chat-accent);
    color: #fff;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

#send-msg-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Typing Indicator */
.typing {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-top: -10px;
    margin-left: 5px;
}

/* ── Developer Image Frame (Premium) ────────────────────────── */
.dev-image-frame {
    margin-top: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(245, 124, 44, 0.3);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: frame-entrance 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3), inset 0 0 15px rgba(245, 124, 44, 0.05);
}

@keyframes frame-entrance {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.dev-image-frame img {
    width: 100%;
    max-width: 200px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}

.dev-image-frame:hover img {
    transform: scale(1.03);
    border-color: var(--chat-accent);
}

.dev-image-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--chat-accent);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(245, 124, 44, 0.4);
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    #chat-window {
        width: calc(100vw - 40px);
        height: 70vh;
        bottom: 90px;
    }
}
