/* Metalcasting Chatbot Widget Styles */

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

/* Chat Toggle Button */
#sfs-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

#sfs-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

#sfs-chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

#sfs-chat-toggle.open svg.chat-icon {
    display: none;
}

#sfs-chat-toggle svg.close-icon {
    display: none;
}

#sfs-chat-toggle.open svg.close-icon {
    display: block;
}

/* Chat Window */
#sfs-chat-window {
    display: none;
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    height: 480px;
    min-width: 280px;
    min-height: 300px;
    max-width: 600px;
    max-height: 80vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    flex-direction: column;
    resize: both;
}

#sfs-chat-window.open {
    display: flex;
}

/* Chat Header */
#sfs-chat-header {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

#sfs-chat-header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sfs-chat-header-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

#sfs-chat-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#sfs-chat-header-text p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.8;
}

/* Chat Messages Area */
#sfs-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f7fa;
}

.sfs-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.sfs-message.user {
    align-items: flex-end;
}

.sfs-message.assistant {
    align-items: flex-start;
}

.sfs-message-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

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

.sfs-message.assistant .sfs-message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Markdown formatting in assistant messages */
.sfs-message.assistant .sfs-message-bubble strong {
    font-weight: 600;
}

.sfs-message.assistant .sfs-message-bubble em {
    font-style: italic;
}

.sfs-message.assistant .sfs-message-bubble code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 13px;
}

.sfs-message.assistant .sfs-message-bubble ul,
.sfs-message.assistant .sfs-message-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.sfs-message.assistant .sfs-message-bubble li {
    margin: 4px 0;
}

/* Typing Indicator */
.sfs-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.sfs-typing-dot {
    width: 8px;
    height: 8px;
    background: #e67e22;
    border-radius: 50%;
    animation: sfs-typing-bounce 1.4s infinite ease-in-out;
}

.sfs-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.sfs-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.sfs-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes sfs-typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chat Input Area */
#sfs-chat-input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

#sfs-chat-form {
    display: flex;
    gap: 8px;
}

#sfs-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#sfs-chat-input:focus {
    border-color: #e67e22;
}

#sfs-chat-input:disabled {
    background: #f5f5f5;
}

#sfs-chat-submit {
    width: 40px;
    height: 40px;
    border: none;
    background: #e67e22;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#sfs-chat-submit:hover:not(:disabled) {
    background: #d35400;
}

#sfs-chat-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#sfs-chat-submit svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Remaining Messages Counter */
#sfs-chat-remaining {
    text-align: center;
    font-size: 11px;
    color: #888;
    padding: 4px 0 0;
}

/* Welcome Message */
.sfs-welcome-message {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

.sfs-welcome-message strong {
    color: #e67e22;
}

/* Signup prompt in welcome message */
#sfs-signup-prompt {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

#sfs-signup-prompt p {
    margin: 0 0 8px;
    font-weight: 500;
    color: #555;
}

#sfs-signup-form {
    display: flex;
    gap: 8px;
}

#sfs-signup-email {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 16px;
    font-size: 13px;
    outline: none;
}

#sfs-signup-email:focus {
    border-color: #e67e22;
}

#sfs-signup-form button {
    padding: 8px 14px;
    background: #e67e22;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

#sfs-signup-form button:hover:not(:disabled) {
    background: #d35400;
}

#sfs-signup-form button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#sfs-signup-message {
    margin-top: 8px;
    font-size: 12px;
    min-height: 16px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #sfs-chatbot-container {
        bottom: 10px;
        right: 10px;
    }

    #sfs-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        max-height: 500px;
        right: 0;
        bottom: 70px;
    }

    #sfs-chat-toggle {
        width: 54px;
        height: 54px;
    }
}

/* Scrollbar Styling */
#sfs-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

#sfs-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#sfs-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
