/* Hero Point Systems - Optimized Chatbot Styles */

/* Remove all theme-related transitions for instant theme switching */
* {
    transition-property: transform, opacity, box-shadow, width, height, top, left, right, bottom !important;
}

/* Chat Container - Fixed at bottom */
.chat-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5000;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.chat-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

/* Shared Input Styles */
.chat-input-field,
.chat-input-expanded {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: box-shadow 0.2s ease;
}

.chat-input-field:focus,
.chat-input-expanded:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 2px rgba(179, 152, 89, 0.2);
}

.chat-input-field::placeholder,
.chat-input-expanded::placeholder {
    color: var(--text-secondary);
}

.chat-input-expanded {
    background: var(--bg-primary);
    border-radius: 20px;
}

/* Shared Button Styles */
.chat-send-btn,
.chat-send-expanded {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--text-accent);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.chat-send-expanded {
    width: 36px;
    height: 36px;
}

.chat-send-btn:hover,
.chat-send-expanded:hover {
    background: #c4a764;
}

.chat-send-btn:disabled,
.chat-send-expanded:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

/* Minimized Chat Interface */
.chat-input-minimal {
    display: flex;
    align-items: center;
    padding: 1rem;
    gap: 0.75rem;
    transition: opacity 0.3s ease;
}

.chat-input-minimal.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Expanded Chat Interface */
.chat-interface {
    display: none;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    max-height: 500px;
    overflow: hidden;
    flex-direction: column;
}

.chat-interface.visible {
    display: flex;
    animation: slideUp 0.3s ease;
}

/* Chat Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.chat-minimize-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
}

.chat-minimize-btn:hover {
    background: var(--bg-card);
    color: var(--text-accent);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-accent);
}

/* Message Styles */
.message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    animation: messageSlide 0.3s ease;
}

.message.user {
    background: var(--text-accent);
    color: var(--primary-black);
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

.message.bot {
    background: var(--bg-card);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    border: 1px solid var(--border-color);
}

.message.error {
    background: #dc3545;
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    max-width: 80%;
    align-self: flex-start;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-accent);
    animation: typing 1.4s infinite;
}

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

/* Chat Input Area */
.chat-input-area {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-input-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Chat Disclaimer */
.chat-disclaimer {
    text-align: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* Loading States */
.chat-send-btn.loading::after,
.chat-send-expanded.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.chat-send-btn.loading svg,
.chat-send-expanded.loading svg {
    opacity: 0;
}

/* Animations */
@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

@keyframes typing {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.4;
    }
    30% {
        transform: scale(1.3);
        opacity: 1;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-input-minimal {
        padding: 0.75rem;
    }
    
    .chat-input-field,
    .chat-input-expanded {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .chat-interface {
        max-height: 400px;
    }
    
    .chat-messages {
        max-height: 250px;
        padding: 0.75rem;
    }
    
    .chat-input-area {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .chat-input-minimal {
        padding: 0.5rem;
    }
    
    .chat-input-field,
    .chat-input-expanded {
        font-size: 16px;
        padding: 0.65rem 0.85rem;
    }
    
    .chat-send-btn,
    .chat-send-expanded {
        width: 36px;
        height: 36px;
    }
    
    .chat-messages {
        padding: 0.5rem;
        gap: 0.5rem;
        max-height: 200px;
    }
    
    .chat-input-area {
        padding: 0.5rem;
    }
    
    .message {
        font-size: 0.9rem;
        padding: 0.65rem 0.85rem;
        max-width: 85%;
    }
    
    .chat-interface {
        max-height: 350px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .chat-interface,
    .message,
    .typing-indicator {
        animation: none !important;
    }
    
    * {
        transition-duration: 0.01ms !important;
    }
}

/* Focus States */
.chat-input-field,
.chat-input-expanded {
    outline: none; /* Remove default outline since we use box-shadow */
}

.chat-send-btn:focus-visible,
.chat-send-expanded:focus-visible,
.chat-minimize-btn:focus-visible {
    outline: 2px solid var(--text-accent);
    outline-offset: 2px;
}