/* book-widget.css - Clean Animated Book */

#book-widget-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    cursor: pointer;
    animation: gentleFloat 3s ease-in-out infinite;
    transition: filter 0.2s;
}

@keyframes gentleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

#book-widget-wrapper:hover {
    animation-play-state: paused;
    filter: brightness(1.15) drop-shadow(0 0 20px rgba(59,130,246,0.4));
}

/* Click = open state */
#book-widget-wrapper.is-open {
    animation-play-state: paused;
}

#book-widget-wrapper.is-open #book-container {
    animation: bookOpen 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#book-widget-wrapper:not(.is-open) #book-container.was-open {
    animation: bookClose 0.35s ease-in-out forwards;
}

@keyframes bookOpen {
    0%   { transform: scale(1) rotateY(0deg); }
    40%  { transform: scale(1.25) rotateY(-20deg); }
    70%  { transform: scale(1.3) rotateY(5deg); }
    100% { transform: scale(1.2) rotateY(0deg); }
}

@keyframes bookClose {
    0%   { transform: scale(1.2) rotateY(0deg); }
    100% { transform: scale(1) rotateY(0deg); }
}

/* ─── Book Container (now icon container) ─── */
#book-container {
    width: 60px;
    height: 60px;
    position: relative;
}

/* ─── Floating Chat Icon ─── */
.floating-chat-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 16px;
    box-shadow:
        0 8px 24px rgba(59, 130, 246, 0.35),
        inset 0 0 20px rgba(255,255,255,0.1);
    border: 1.5px solid rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Responsive hover effect - scales up slightly */
#book-widget-wrapper:hover .floating-chat-icon {
    transform: scale(1.12);
    box-shadow:
        0 12px 32px rgba(59, 130, 246, 0.5),
        inset 0 0 20px rgba(255,255,255,0.15);
}

.floating-chat-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
    border-radius: 16px;
    pointer-events: none;
}

/* ─── Cursor Tracker Avatar ─── */
.cursor-tracker-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 1;
}

/* Avatar Head */
.avatar-head {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 0 8px rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.4);
}

/* Eyes Container */
.avatar-eyes {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

/* Single Eye */
.avatar-eye {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

/* Pupil (follows cursor) */
.avatar-pupil {
    width: 3px;
    height: 3px;
    background: #1f2937;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease-out;
}

/* Smile */
.avatar-smile {
    width: 10px;
    height: 5px;
    border: 1.5px solid #1f2937;
    border-top: none;
    border-radius: 0 0 10px 10px;
    margin-top: 2px;
}

/* Avatar Body */
.avatar-body {
    width: 18px;
    height: 14px;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-radius: 50% 50% 30% 30%;
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    border: 0.5px solid rgba(255,255,255,0.3);
}

/* Wave/greeting animation on hover */
#book-widget-wrapper:hover .avatar-head {
    animation: avatarWave 0.6s ease-in-out infinite;
}

@keyframes avatarWave {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-3px) rotate(-3deg); }
    50% { transform: translateY(-6px) rotate(0deg); }
    75% { transform: translateY(-3px) rotate(3deg); }
}

/* ─── Ask Me Bubble ─── */
#ask-bubble {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #1e293b;
    padding: 8px 18px;
    border-radius: 18px;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 1001;
    animation: bubbleBounce 2s ease-in-out infinite;
}

@keyframes bubbleBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
}

#ask-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid white;
}

/* ─── Glow ─── */
.magic-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 160%;
    height: 160%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 65%);
    transform: translate(-50%, -50%);
    z-index: -1;
    pointer-events: none;
    animation: glowPulse 3s infinite alternate;
}

@keyframes glowPulse {
    from { opacity: 0.5; }
    to { opacity: 1; }
}
