/* JB Agent - Floating Chat Assistant */

/* Google Colors for consistency */
:root {
    --google-red: #ea4335;
    --google-yellow: #fbbc05;
    --google-green: #34a853;
    --google-blue: #4285f4;
    --google-pink: #e91e63;
}

/* Main agent container */
.jb-agent {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10000;
    font-family: 'Apple Garamond', Garamond, serif;
}

/* Agent circle body */
.jb-agent-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.4) 15%, rgba(255, 255, 255, 0.1) 40%, transparent 70%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -1px 0 rgba(255, 255, 255, 0.1),
        inset -1px 0 0 rgba(255, 255, 255, 0.1),
        inset 1px 0 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

/* Glass bubble glimmer effect */
.jb-agent-circle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.8) 50%,
        transparent 70%
    );
    transform: rotate(45deg) translate(-100%, -100%);
    animation: jb-glimmer 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes jb-glimmer {
    0% {
        transform: rotate(45deg) translate(-200%, -200%);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: rotate(45deg) translate(100%, 100%);
        opacity: 0;
    }
}

.jb-agent-circle:hover {
    transform: scale(1.05) translateZ(0);
    background: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.5) 15%, rgba(255, 255, 255, 0.15) 40%, transparent 70%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 2px 0 rgba(255, 255, 255, 0.7),
        inset 0 -2px 0 rgba(255, 255, 255, 0.1),
        inset -2px 0 0 rgba(255, 255, 255, 0.1),
        inset 2px 0 0 rgba(255, 255, 255, 0.1);
}

/* Eyes container */
.jb-agent-eyes {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Individual eye base */
.jb-agent-eye {
    width: 14px;
    height: 14px;
    position: relative;
    transition: all 0.3s ease;
}

/* Eye states */
/* Happy eyes (default) - crescent shape */
.jb-agent-eyes.happy .jb-agent-eye {
    width: 16px;
    height: 8px;
    background: #000000;
    border-radius: 16px 16px 0 0;
    transform: translateY(-2px);
    animation: jb-happy-blink 4s infinite;
    box-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

/* Surprised eyes - wide circles */
.jb-agent-eyes.surprised .jb-agent-eye {
    width: 18px;
    height: 18px;
    background: #000000;
    border-radius: 50%;
    animation: jb-surprised-blink 2s infinite;
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

/* Confused eyes - asymmetrical */
.jb-agent-eyes.confused .jb-agent-eye:first-child {
    width: 14px;
    height: 14px;
    background: #000000;
    border-radius: 50%;
    transform: translateY(-2px);
    animation: jb-confused-blink-left 3.5s infinite;
}

.jb-agent-eyes.confused .jb-agent-eye:last-child {
    width: 16px;
    height: 8px;
    background: #000000;
    border-radius: 50%;
    transform: translateY(1px) scaleY(0.6);
    animation: jb-confused-blink-right 3.5s infinite;
}

/* Thinking eyes - solid black circles */
.jb-agent-eyes.thinking .jb-agent-eye {
    width: 15px;
    height: 15px;
    background: #000000;
    border-radius: 50%;
    animation: jb-thinking-blink 5s infinite;
}

/* Remove the pupil pseudo-element for thinking eyes */
.jb-agent-eyes.thinking .jb-agent-eye::before {
    display: none;
}

/* Excited eyes - very happy crescents */
.jb-agent-eyes.excited .jb-agent-eye {
    width: 18px;
    height: 9px;
    background: #000000;
    border-radius: 18px 18px 0 0;
    transform: translateY(-3px);
    animation: jb-excited-blink 2s infinite;
    box-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.jb-agent-eyes.excited .jb-agent-eye::after {
    display: none;
}

/* Sleepy eyes - droopy */
.jb-agent-eyes.sleepy .jb-agent-eye {
    width: 16px;
    height: 6px;
    background: #000000;
    border-radius: 16px;
    transform: translateY(3px);
    animation: jb-sleepy-blink 6s infinite;
}

/* Focused/working eyes - smaller, concentrated */
.jb-agent-eyes.focused .jb-agent-eye {
    width: 10px;
    height: 10px;
    background: #000000;
    border-radius: 50%;
    animation: jb-focused-blink 1.5s infinite;
}

/* Error/concerned eyes */
.jb-agent-eyes.concerned .jb-agent-eye {
    width: 14px;
    height: 14px;
    background: #000000;
    border-radius: 50%;
    transform: scaleX(0.7);
    animation: jb-concerned-blink 4s infinite;
}

/* Blinking animations for each state */
@keyframes jb-happy-blink {
    0%, 92%, 100% {
        transform: translateY(-2px) scaleY(1);
    }
    96% {
        transform: translateY(-2px) scaleY(0.1);
    }
}

@keyframes jb-surprised-blink {
    0%, 85%, 100% {
        transform: scaleY(1);
    }
    90% {
        transform: scaleY(0.1);
    }
}

@keyframes jb-confused-blink-left {
    0%, 88%, 100% {
        transform: translateY(-2px) scaleY(1);
    }
    94% {
        transform: translateY(-2px) scaleY(0.1);
    }
}

@keyframes jb-confused-blink-right {
    0%, 90%, 100% {
        transform: translateY(1px) scaleY(0.6);
    }
    95% {
        transform: translateY(1px) scaleY(0.1);
    }
}

@keyframes jb-thinking-blink {
    0%, 94%, 100% {
        transform: scaleY(1);
    }
    97% {
        transform: scaleY(0.1);
    }
}

@keyframes jb-excited-blink {
    0%, 80%, 100% {
        transform: translateY(-3px) scaleY(1);
    }
    85% {
        transform: translateY(-3px) scaleY(0.1);
    }
}

@keyframes jb-sleepy-blink {
    0%, 70%, 100% {
        transform: translateY(3px) scaleY(1);
    }
    75%, 85% {
        transform: translateY(3px) scaleY(0.1);
    }
}

@keyframes jb-focused-blink {
    0%, 85%, 100% {
        transform: scaleY(1);
    }
    90% {
        transform: scaleY(0.1);
    }
}

@keyframes jb-concerned-blink {
    0%, 88%, 100% {
        transform: scaleX(0.7) scaleY(1);
    }
    94% {
        transform: scaleX(0.7) scaleY(0.1);
    }
}

@keyframes jb-sparkle {
    0%, 100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

/* Chat bubble container */
.jb-chat-bubble {
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 320px;
    height: 400px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat bubble tail */
.jb-chat-bubble::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
    border-radius: 0 0 4px 0;
}

/* Show state */
.jb-chat-bubble.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat header */
.jb-chat-header {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.jb-chat-title {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    margin: 0;
}

.jb-chat-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #333333;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.jb-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages area */
.jb-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Individual message */
.jb-message {
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.jb-message.user {
    background: rgba(255, 255, 255, 0.25);
    color: #333333;
    align-self: flex-end;
    margin-left: auto;
    font-weight: 500;
}

.jb-message.assistant {
    background: rgba(255, 255, 255, 0.15);
    color: #333333;
    align-self: flex-start;
    white-space: pre-wrap;
    font-weight: 400;
}

/* Input area */
.jb-chat-input-area {
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 8px;
    align-items: center;
}

.jb-chat-input {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #333333;
    font-family: 'Apple Garamond', Garamond, serif;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.jb-chat-input::placeholder {
    color: rgba(51, 51, 51, 0.6);
    font-style: italic;
}

.jb-chat-input:focus {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.3);
}

.jb-chat-send {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--google-blue);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jb-chat-send svg {
    width: 14px;
    height: 14px;
}

.jb-chat-send:hover {
    background: #3367d6;
    transform: translateY(-1px);
}

.jb-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Custom scrollbar for messages */
.jb-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.jb-chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.jb-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.jb-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .jb-agent {
        bottom: 15px;
        left: 15px;
    }
    
    .jb-agent-circle {
        width: 50px;
        height: 50px;
    }
    
    .jb-agent-eye {
        width: 6px;
        height: 6px;
    }
    
    .jb-chat-bubble {
        width: calc(100vw - 40px);
        max-width: 300px;
        height: 350px;
    }
    
    .jb-chat-title {
        font-size: 14px;
    }
    
    .jb-message {
        font-size: 12px;
    }
    
    .jb-chat-input {
        font-size: 12px;
    }
    
    .jb-chat-send {
        width: 28px;
        height: 28px;
    }
    
    .jb-chat-send svg {
        width: 12px;
        height: 12px;
    }
}

/* Notification gradient ring for new messages */
.jb-notification-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: 
        radial-gradient(circle, transparent 26px, transparent 26px),
        conic-gradient(
            from 0deg,
            var(--google-red) 0deg,
            var(--google-yellow) 90deg,
            var(--google-green) 180deg,
            var(--google-blue) 270deg,
            var(--google-red) 360deg
        );
    mask: radial-gradient(circle, transparent 26px, black 30px);
    -webkit-mask: radial-gradient(circle, transparent 26px, black 30px);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: jb-ring-shimmer 3s linear infinite;
    pointer-events: none;
    z-index: -1;
}

.jb-notification-ring.show {
    opacity: 1;
    transform: scale(1);
}

@keyframes jb-ring-shimmer {
    0% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1) saturate(1);
    }
    25% {
        filter: brightness(1.2) saturate(1.3);
    }
    50% {
        transform: scale(1) rotate(180deg);
        filter: brightness(1.4) saturate(1.5);
    }
    75% {
        filter: brightness(1.2) saturate(1.3);
    }
    100% {
        transform: scale(1) rotate(360deg);
        filter: brightness(1) saturate(1);
    }
}

/* Typing indicator */
.jb-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #333333;
    font-style: italic;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.jb-typing-indicator.show {
    opacity: 1;
}

.jb-typing-dots {
    display: flex;
    gap: 2px;
}

.jb-typing-dot {
    width: 4px;
    height: 4px;
    background: #333333;
    border-radius: 50%;
    animation: jb-typing 1.4s infinite ease-in-out;
}

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

@keyframes jb-typing {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Built-in highlighting system - glow on every interactive element */

/* Base glow setup for all highlightable elements */
.button,
a[href],
input:not([type="hidden"]),
textarea,
select,
[id]:not(.jb-agent):not(.jb-agent *) {
    position: relative;
}

.button::before,
a[href]::before,
input:not([type="hidden"])::before,
textarea::before,
select::before,
[id]:not(.jb-agent):not(.jb-agent *)::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    box-shadow: var(--jb-highlight-glow, 0 0 8px rgba(255, 255, 255, 0.7));
}

/* Active highlighting state */
.jb-highlight-active::before {
    opacity: 1;
    animation: jb-highlight-pulse 3s ease-in-out;
}

/* Button-specific color glows */
.button:nth-child(1).jb-highlight-active::before {
    box-shadow: 
        0 0 4px rgba(234, 67, 53, 0.9),
        0 0 8px rgba(234, 67, 53, 0.7),
        0 0 12px rgba(234, 67, 53, 0.5);
}

.button:nth-child(2).jb-highlight-active::before {
    box-shadow: 
        0 0 4px rgba(251, 188, 5, 0.9),
        0 0 8px rgba(251, 188, 5, 0.7),
        0 0 12px rgba(251, 188, 5, 0.5);
}

.button:nth-child(3).jb-highlight-active::before {
    box-shadow: 
        0 0 4px rgba(52, 168, 83, 0.9),
        0 0 8px rgba(52, 168, 83, 0.7),
        0 0 12px rgba(52, 168, 83, 0.5);
}

.button:nth-child(4).jb-highlight-active::before {
    box-shadow: 
        0 0 4px rgba(66, 133, 244, 0.9),
        0 0 8px rgba(66, 133, 244, 0.7),
        0 0 12px rgba(66, 133, 244, 0.5);
}

.button:nth-child(5).jb-highlight-active::before {
    box-shadow: 
        0 0 4px rgba(233, 30, 99, 0.9),
        0 0 8px rgba(233, 30, 99, 0.7),
        0 0 12px rgba(233, 30, 99, 0.5);
}

/* Default glows for other elements */
a[href].jb-highlight-active::before {
    box-shadow: 
        0 0 4px rgba(66, 133, 244, 0.8),
        0 0 8px rgba(66, 133, 244, 0.6),
        0 0 12px rgba(66, 133, 244, 0.4);
}

input.jb-highlight-active::before,
textarea.jb-highlight-active::before,
select.jb-highlight-active::before {
    box-shadow: 
        0 0 4px rgba(52, 168, 83, 0.8),
        0 0 8px rgba(52, 168, 83, 0.6),
        0 0 12px rgba(52, 168, 83, 0.4);
}

/* Fallback for any other elements that might be highlighted */
.jb-highlight-active:not(.button):not(a[href]):not(input):not(textarea):not(select)::before {
    box-shadow: 
        0 0 4px rgba(255, 255, 255, 0.9),
        0 0 8px rgba(255, 255, 255, 0.7),
        0 0 12px rgba(255, 255, 255, 0.5);
}

/* Ensure glow appears above other content but below jb agent */
.jb-highlight-active::before {
    z-index: 1000;
}

/* Social icons specific styling */
.social-icon.jb-highlight-active::before {
    border-radius: 50% !important; /* Force circular glow for social icons */
    box-shadow: 
        0 0 4px rgba(51, 51, 51, 0.8),
        0 0 8px rgba(51, 51, 51, 0.6),
        0 0 12px rgba(51, 51, 51, 0.4);
}

/* Pulse animation */
@keyframes jb-highlight-pulse {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    15%, 85% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.005);
    }
}

