/* 🤖 AI Chatbot Styles for vlasits.dev */
/* Optimized for vlasits.dev branding */

#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#chatbot-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    text-align: center;
    line-height: 60px;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0px 4px 12px rgba(220, 38, 38, 0.4);
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

#chatbot-icon:hover {
    transform: scale(1.1);
    box-shadow: 0px 6px 16px rgba(220, 38, 38, 0.6);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0px 4px 12px rgba(220, 38, 38, 0.4); }
    50% { box-shadow: 0px 4px 20px rgba(220, 38, 38, 0.6); }
}

#chatbot-window {
    width: 380px;
    height: 600px;
    background: white;
    position: absolute;
    bottom: 80px;
    right: 0;
    border-radius: 12px;
    box-shadow: 0px 8px 24px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    border: 1px solid #e5e7eb;
}

#chatbot-window[style*="display: flex"] {
    opacity: 1;
}

/* Header */
#chatbot-header {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.offline-header {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%) !important;
}

#chatbot-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

#chatbot-status-icon {
    font-size: 12px;
    animation: pulseGreen 1.5s infinite ease-in-out;
}

.chatbot-title {
    font-weight: 600;
    font-size: 16px;
}

.header-buttons {
    display: flex;
    gap: 12px;
}

.header-button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.header-button svg {
    width: 16px;
    height: 16px;
}

/* Messages Area */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px 8px 16px;
    background: #f9fafb;
}

#chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

#chatbot-messages::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

#chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

#chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.message-container {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.message-time {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    text-align: center;
}

.message-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.message-wrapper.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.avatar.ai {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
}

.avatar.user {
    background: #6b7280;
    color: white;
}

.avatar svg {
    width: 18px;
    height: 18px;
}

.message-bubble {
    max-width: 280px;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.message-bubble.ai {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 6px;
}

.message-bubble.user {
    background: #4b5563;
    color: white;
    border-bottom-right-radius: 6px;
}

/* Typing Indicator */
#chatbot-typing-indicator {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 16px;
    gap: 8px;
}

.typing-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.typing-avatar svg {
    width: 18px;
    height: 18px;
}

.typing-bubble {
    background: #f3f4f6;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    display: flex;
    gap: 4px;
}

.typing-bubble span {
    width: 6px;
    height: 6px;
    background-color: #6b7280;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.5s infinite ease-in-out;
}

.typing-bubble span:nth-child(1) { animation-delay: 0s; }
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
    100% { opacity: 0.3; transform: scale(1); }
}

.hidden {
    display: none !important;
}

/* Input Area */
.input-area {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    position: relative;
}

#chatbot-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 12px 50px 12px 16px;
    font-size: 14px;
    color: #1f2937;
    resize: none;
    min-height: 20px;
    max-height: 80px;
    line-height: 1.4;
    font-family: inherit;
    outline: none;
    overflow-y: hidden;
    background: #f9fafb;
}

#chatbot-input.scrollable {
    overflow-y: auto;
}

#chatbot-input::-webkit-scrollbar {
    width: 6px;
}

#chatbot-input::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

#chatbot-input::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
    border: 1px solid #f9fafb;
}

#chatbot-input::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

#chatbot-input:focus {
    border-color: #dc2626;
    background: white;
}

#chatbot-input:disabled {
    background: #f3f4f6;
    color: #6b7280;
}

#chatbot-send-button {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    transform: scale(0.8);
}

#chatbot-send-button.visible {
    opacity: 1;
    transform: scale(1);
}

#chatbot-send-button:hover {
    transform: scale(1.05);
    box-shadow: 0px 4px 12px rgba(220, 38, 38, 0.3);
}

#chatbot-send-button:disabled {
    background: #6b7280;
    cursor: not-allowed;
    transform: scale(0.8);
    opacity: 0.5;
}

#chatbot-send-button svg {
    width: 16px;
    height: 16px;
}

/* Disclaimer */
.disclaimer {
    padding: 12px 16px;
    font-size: 12px;
    color: #6b7280;
    background: #f9fafb;
    text-align: center;
    line-height: 1.3;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 12px 12px;
}

/* Animations */
@keyframes pulseGreen {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulseRed {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

.offline #chatbot-status-icon {
    animation: pulseRed 1.5s infinite ease-in-out;
}

/* Responsive */
@media (max-width: 420px) {
    #chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 20px;
    }
}

/* Hide password manager autofill popups - Nuclear option */
#chatbot-input::-webkit-credentials-auto-fill-button,
#chatbot-input::-webkit-textfield-decoration-container {
    display: none !important;
    visibility: hidden !important;
}

/* Hide Chrome/Safari autofill dropdown */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
textarea:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px white inset !important;
    -webkit-text-fill-color: #1f2937 !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Disable all form autofill UI elements */
.input-container {
    position: relative;
    isolation: isolate;
}
