/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #f59e0b, #d97706);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #d97706, #b45309);
}

/* Firefox scrollbar */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #f59e0b rgba(255, 255, 255, 0.05);
}

/* Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

@keyframes glow {
    0% {
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
    }
    100% {
        box-shadow: 0 0 30px rgba(245, 158, 11, 0.6), 0 0 40px rgba(245, 158, 11, 0.3);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes bounceSubtle {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Message animations */
.message-enter {
    animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.message-content {
    line-height: 1.7;
}

.message-content p {
    margin-bottom: 0.75rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Code styling */
.message-content pre {
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
    overflow-x: auto;
    position: relative;
}

.message-content pre::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.5), transparent);
}

.message-content code {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.9em;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.message-content pre code {
    background: transparent;
    padding: 0;
    border: none;
    color: #e5e7eb;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f59e0b, #d97706);
    animation: typingAnimation 1.4s infinite ease-in-out;
}

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

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

.typing-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typingAnimation {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Textarea auto-resize */
textarea {
    min-height: 48px;
    max-height: 128px;
    transition: all 0.3s ease;
}

/* Hover effects */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Chat log items */
.chat-log-item {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chat-log-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.1), transparent);
    transition: left 0.5s ease;
}

.chat-log-item:hover::before {
    left: 100%;
}

.chat-log-item:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    transform: translateX(4px);
}

/* Glassmorphism effects */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Enhanced Button Styles */
button {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

/* Clear Button Specific Styles */
#clearChatBtn {
    position: relative;
    overflow: hidden;
}

#clearChatBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.1), transparent);
    transition: left 0.5s ease;
}

#clearChatBtn:hover::before {
    left: 100%;
}

#clearChatBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

/* Send Button Specific Styles */
#sendBtn {
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

#sendBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

#sendBtn:hover:not(:disabled)::before {
    left: 100%;
}

#sendBtn:hover:not(:disabled) {
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
    transform: translateY(-2px) scale(1.05);
}

#sendBtn:active:not(:disabled) {
    transform: translateY(0) scale(1.02);
}

#sendBtn:disabled {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Mobile responsive adjustments */
@media (max-width: 1024px) {
    #sidebar {
        width: 320px;
    }
    
    #sidebar.open {
        transform: translateX(0);
    }
    
    .message-content {
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    .message-content {
        font-size: 0.9rem;
    }
    
    .message-content pre {
        padding: 12px;
        font-size: 0.85rem;
    }
    
    #messagesContainer {
        padding: 1rem;
    }
    
    footer {
        padding: 1rem;
    }

    /* Mobile header adjustments */
    header {
        padding: 1rem;
    }
    
    header h2 {
        font-size: 1.125rem;
    }
    
    #clearChatBtn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    #clearChatBtn span {
        display: none;
    }
    
    #clearChatBtn svg {
        width: 1rem;
        height: 1rem;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles */
button:focus,
textarea:focus {
    outline: 2px solid rgba(245, 158, 11, 0.5);
    outline-offset: 2px;
}

/* Loading spinner enhancement */
@keyframes spinGlow {
    0% {
        transform: rotate(0deg);
        filter: hue-rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
        filter: hue-rotate(360deg);
    }
}

.loading-spinner {
    animation: spinGlow 2s linear infinite;
}

/* Kbd styling */
kbd {
    background: linear-gradient(135deg, #374151, #4b5563);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

#mobileMenuBtn {
  position: fixed;
  top: 1rem;
  left: 1rem;
}

#messageInput {
    overflow: hidden;   /* hide all scrollbars */
    resize: none;
}

/* For Firefox */
#messageInput {
    scrollbar-width: none;
}

/* For Webkit browsers (Chrome, Safari, Edge) */
#messageInput::-webkit-scrollbar {
    display: none;
}
