/* TarvaaBot Custom Styles */

/* Chat button animations */
#tarvaa-chat-button {
    animation: pulse-glow 2s infinite;
    background: #131313 !important;
    border: 2px solid #333;

}

#tarvaa-chat-button svg {
    color: #E5E7EB !important;
}

#tarvaa-chat-button:hover {
    background: #1a1a1a !important;
    border-color: #444;
}

/* Welcome popup message */
.welcome-popup {
    position: absolute;
    right: 80px;
    top: 30%;
    transform: translateY(-50%);
    background-color: #131313;
    color: #E5E7EB;
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    min-width: 300px;
    opacity: 0;
    transform: translateY(-50%) translateX(10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.welcome-popup.show {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.welcome-popup::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid #131313;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.welcome-popup .close-popup {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
}

.welcome-popup .close-popup:hover {
    color: #E5E7EB;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(51, 51, 51, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(51, 51, 51, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(51, 51, 51, 0);
    }
}

/* Floating chat interface */
#tarvaa-chat-interface {
    z-index: 1000;
}

#chat-panel {
    max-height: 40rem;
    min-height: 50rem;
    width: 50rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: #030303;
    color: #E5E7EB;
    position: relative;
}

/* Minimized chat icon */
#minimized-chat {
    animation: bounce-subtle 2s infinite;
}

@keyframes bounce-subtle {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Chat panel entrance animation */
.chat-entrance {
    animation: slideInFromBottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Custom scrollbar for chat messages */
#chat-messages {
    scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Message animations */
.message-enter {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing indicator animation */
.typing-dot {
    animation: typingBounce 1.5s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Button hover effects */
.create-project-btn {
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    transition: all 0.3s ease;
}

.create-project-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

.open-project-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    transition: all 0.3s ease;
}

.open-project-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.3);
}

/* Code block styling */
.chat-code {
    background-color: #1f2937;
    color: #e5e7eb;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    margin: 8px 0;
    overflow-x: auto;
}

/* Loading spinner */
.loading-spinner {
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments for floating chat */
@media (max-width: 768px) {
    #tarvaa-chat-interface {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
    }
    
    #chat-panel {
        width: 100% !important;
        height: 70vh;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
        margin: 0;
        bottom: 0;
        right: 0;
        left: 0;
        position: fixed;
    }
    
    #minimized-chat {
        bottom: 20px;
        right: 20px;
    }
    
    /* Welcome popup responsive */
    .welcome-popup {
        right: 80px;
        max-width: 300px;
        min-width: 250px;
        font-size: 13px;
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .welcome-popup {
        right: 75px;
        max-width: 280px;
        min-width: 200px;
        padding: 12px 15px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #chat-panel {
        height: 80vh;
        max-height: 80vh;
    }
    
    #chat-messages {
        padding: 12px;
    }
    
    #chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    #chat-messages {
        background-color: #030303;
        color: #E5E7EB;
    }
    
    #chat-panel {
        background-color: #030303;
        border-left-color: #374151;
    }
}

/* Custom dark theme for chat interface */
#chat-panel {
    background-color: #030303;
    color: #E5E7EB;
}

#chat-messages {
    background-color: #030303;
    color: #E5E7EB;
}

/* Chat header with custom color */
#chat-panel .bg-gradient-to-r.from-blue-500.to-purple-600 {
    background: #131313 !important;
    color: #E5E7EB;
}

/* Message bubbles styling */
.bg-white.rounded-lg.p-3.shadow-sm {
    background-color: #131313 !important;
    color: #E5E7EB !important;
    border: 1px solid #333;
}

/* User message bubbles */
.bg-gradient-to-r.from-blue-500.to-purple-600.text-white {
    background: #131313 !important;
    color: #E5E7EB !important;
    border: 1px solid #333;
}

/* Input field styling */
#chat-input {
    background-color: #131313;
    color: #E5E7EB;
    border: 1px solid #333;
}

#chat-input::placeholder {
    color: #888;
}

/* Send button */
#send-btn {
    background: #131313 !important;
    border: 1px solid #333;
}

/* Chat session sidebar styles */
.chat-session-item:hover .session-menu-btn {
    opacity: 1 !important;
}

.session-menu-btn {
    opacity: 0.5 !important;
    transition: opacity 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.session-menu-btn:hover {
    opacity: 1 !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
}

.session-menu-btn svg {
    pointer-events: none;
}

.session-context-menu {
    background-color: #131313 !important;
    border: 1px solid #333 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999 !important;
    position: absolute !important;
    min-width: 150px;
}

.session-context-menu button {
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.session-context-menu button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Active session highlighting */
.chat-session-item.bg-white\/10 {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Edit title dialog styles */
.edit-title-dialog {
    backdrop-filter: blur(4px);
}

.edit-title-input:focus {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5);
}

.save-btn:hover {
    background-color: #1d4ed8 !important;
}

/* Responsive chat panel */
@media (max-width: 1024px) {
    #chat-panel {
        width: 90vw !important;
        height: 80vh !important;
        max-width: 900px;
    }
    
    #chat-sidebar {
        width: 200px;
    }
}

@media (max-width: 768px) {
    #chat-panel {
        width: 95vw !important;
        height: 50vh !important;
    }
    
    #chat-sidebar {
        width: 180px;
    }
}
