/* Chatbot Styles */

/* Floating button hidden — chat is triggered via header nav + mobile nav */
#chatbot-button {
    display: none !important;
}

#theory-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(42, 42, 42, 0.52);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #1a1a1a;
    border: 2px solid #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    opacity: 1;
    animation: bee-idle 3s ease-in-out infinite;
}

/* Bee idle floating animation */
@keyframes bee-idle {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

@media (max-width: 768px) {
    #theory-chatbot {
        bottom: 90px;
    }
    
    #chatbot-button {
        width: 56px;
        height: 56px;
    }
}

#chatbot-button.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

#chatbot-button:hover {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #1a1a1a;
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.3);
    animation: bee-hover 0.6s ease-in-out infinite;
}

/* Bee excited hover animation */
@keyframes bee-hover {
    0%, 100% {
        transform: scale(1.1) translateY(-2px) rotate(-2deg);
    }
    50% {
        transform: scale(1.1) translateY(-4px) rotate(2deg);
    }
}

/* Bee icon styles */
.bee-icon {
    display: block;
}

/* Wing flapping animation */
.bee-icon .wing-left,
.bee-icon .wing-right {
    transform-origin: center;
    animation: wing-flap 0.4s ease-in-out infinite;
}

.bee-icon .wing-right {
    animation-delay: 0.2s;
}

@keyframes wing-flap {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 0.9;
    }
}

/* Enhanced wing flapping on hover */
#chatbot-button:hover .wing-left,
#chatbot-button:hover .wing-right {
    animation: wing-flap-fast 0.2s ease-in-out infinite;
}

@keyframes wing-flap-fast {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

#chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: rgba(26, 26, 26, 0.75);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 215, 0, 0.1) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatbot-slide-up 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes chatbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#chatbot-header {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #1a1a1a;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.2);
}

#chatbot-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.5), transparent);
}

#chatbot-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

#chatbot-header h3::before {
    content: '🐝';
    font-size: 22px;
    animation: bee-wiggle 2s ease-in-out infinite;
}

@keyframes bee-wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-10deg);
    }
    75% {
        transform: rotate(10deg);
    }
}

#chatbot-close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    color: #1a1a1a;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-weight: bold;
}

#chatbot-close:hover {
    background: rgba(0, 0, 0, 0.25);
    color: #0a0a0a;
    transform: rotate(90deg) scale(1.1);
}

#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: transparent;
    position: relative;
}

/* Subtle glass pattern background */
#chatbot-messages::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 215, 0, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 183, 0, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 14px;
    word-wrap: break-word;
    animation: message-pop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

@keyframes message-pop {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.chat-message.user {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #1a1a1a;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.chat-message.assistant {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f1f5f9;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.chat-message.typing {
    background: rgba(255, 255, 255, 0.1);
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

#chatbot-input-area {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 215, 0, 0.2);
    position: relative;
}

#chatbot-input-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.3), transparent);
}

#chatbot-input {
    flex: 1;
    padding: 12px 18px;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f1f5f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) inset;
}

#chatbot-input:focus {
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1) inset;
    transform: translateY(-1px);
}

#chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #1a1a1a;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

#chatbot-send:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffdb58 0%, #ffc400 100%);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}

#chatbot-send:active:not(:disabled) {
    transform: scale(1.05) rotate(15deg);
}

#chatbot-send:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    transform: scale(1);
    box-shadow: none;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
    }
}

/* Scrollbar styling */
#chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

#chatbot-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin: 8px 0;
}

#chatbot-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ffd700, #ffb700);
    border-radius: 10px;
    border: 2px solid rgba(26, 26, 26, 0.5);
}

#chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ffdb58, #ffc400);
}
