/**
 * MF Chatbot Styles v4.0
 * Matches Mystic Fantasy theme aesthetics
 */

/* Container */
#mf-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Toggle Button */
#mf-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6b4c9a 0%, #4a3570 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(107, 76, 154, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

#mf-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(107, 76, 154, 0.6);
}

#mf-chatbot-toggle .mf-chat-icon,
#mf-chatbot-toggle .mf-close-icon {
    font-size: 28px;
    position: absolute;
    transition: all 0.3s ease;
}

#mf-chatbot-toggle .mf-close-icon {
    opacity: 0;
    transform: rotate(-90deg);
    color: #fff;
    font-size: 24px;
}

#mf-chatbot-toggle.active .mf-chat-icon {
    opacity: 0;
    transform: rotate(90deg);
}

#mf-chatbot-toggle.active .mf-close-icon {
    opacity: 1;
    transform: rotate(0);
}

/* Notification badge */
#mf-chatbot-toggle::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 12px;
    height: 12px;
    background: #C9A227;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

#mf-chatbot-toggle.active::after {
    display: none;
}

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

/* Chat Window */
#mf-chatbot-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #1a1625;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(107, 76, 154, 0.3);
}

#mf-chatbot-window.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

/* Header */
.mf-chat-header {
    background: linear-gradient(135deg, #6b4c9a 0%, #4a3570 100%);
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mf-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mf-chat-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.mf-chat-header-text h4 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Cinzel', serif;
}

.mf-chat-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.mf-chat-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    margin-right: 6px;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* AI Badge */
.mf-ai-badge {
    display: inline-block;
    background: linear-gradient(135deg, #6b4c9a, #C9A227);
    color: #fff;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.mf-chat-minimize {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.mf-chat-minimize:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Messages Area */
.mf-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #0d0d1a;
}

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

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

.mf-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(107, 76, 154, 0.4);
    border-radius: 3px;
}

/* Message Bubbles */
.mf-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

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

.mf-message.bot {
    background: #252542;
    color: #e8e0f0;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.mf-message.user {
    background: linear-gradient(135deg, #6b4c9a 0%, #4a3570 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.mf-message strong {
    color: #C9A227;
}

.mf-message a {
    color: #C9A227;
    text-decoration: underline;
}

/* Typing Indicator */
.mf-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #252542;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 70px;
}

.mf-typing span {
    width: 8px;
    height: 8px;
    background: #6b4c9a;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Product Cards */
.mf-products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.mf-product-card {
    background: #1a1625;
    border: 1px solid rgba(107, 76, 154, 0.3);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mf-product-card:hover {
    border-color: #C9A227;
    transform: translateY(-2px);
}

.mf-product-card img {
    width: 100%;
    height: 80px;
    object-fit: contain;
    background: #fff;
    padding: 5px;
}

.mf-product-card-info {
    padding: 8px;
}

.mf-product-card-name {
    font-size: 11px;
    color: #e8e0f0;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.mf-product-card-price {
    font-size: 12px;
    color: #C9A227;
    font-weight: 700;
}

/* Quick Actions */
.mf-chat-quick-actions {
    padding: 10px 15px;
    background: #1a1625;
    border-top: 1px solid rgba(107, 76, 154, 0.2);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mf-quick-btn {
    padding: 8px 12px;
    background: #252542;
    border: 1px solid rgba(107, 76, 154, 0.3);
    border-radius: 20px;
    color: #e8e0f0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mf-quick-btn:hover {
    background: #6b4c9a;
    border-color: #6b4c9a;
}

/* Action Buttons (Contact, Transcript) */
.mf-action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-self: flex-start;
}

.mf-contact-btn,
.mf-transcript-btn {
    padding: 10px 18px;
    background: linear-gradient(135deg, #6b4c9a 0%, #4a3570 100%);
    border: none;
    border-radius: 25px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mf-contact-btn:hover,
.mf-transcript-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(107, 76, 154, 0.4);
}

/* Contact Form Container */
.mf-contact-form-container {
    background: #1a1625;
    border: 1px solid rgba(107, 76, 154, 0.4);
    border-radius: 12px;
    padding: 16px;
    margin-top: 10px;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.mf-contact-form h4 {
    margin: 0 0 8px;
    color: #C9A227;
    font-size: 16px;
    font-family: 'Cinzel', serif;
}

.mf-contact-form > p {
    margin: 0 0 15px;
    color: #b8a9c9;
    font-size: 13px;
}

.mf-form-group {
    margin-bottom: 12px;
}

.mf-form-group label {
    display: block;
    margin-bottom: 5px;
    color: #e8e0f0;
    font-size: 12px;
    font-weight: 500;
}

.mf-form-group input[type="text"],
.mf-form-group input[type="email"],
.mf-form-group select,
.mf-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: #252542;
    border: 1px solid rgba(107, 76, 154, 0.3);
    border-radius: 8px;
    color: #e8e0f0;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.mf-form-group input:focus,
.mf-form-group select:focus,
.mf-form-group textarea:focus {
    border-color: #6b4c9a;
}

.mf-form-group input::placeholder,
.mf-form-group textarea::placeholder {
    color: #6c6980;
}

.mf-form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b4c9a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.mf-form-group select option {
    background: #1a1625;
    color: #e8e0f0;
}

.mf-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Checkbox Group */
.mf-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: #b8a9c9;
}

.mf-checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6b4c9a;
    cursor: pointer;
}

/* Form Buttons */
.mf-form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.mf-contact-cancel {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid rgba(107, 76, 154, 0.4);
    border-radius: 8px;
    color: #b8a9c9;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mf-contact-cancel:hover {
    background: rgba(107, 76, 154, 0.1);
    border-color: #6b4c9a;
}

.mf-contact-submit {
    flex: 2;
    padding: 10px 16px;
    background: linear-gradient(135deg, #6b4c9a 0%, #4a3570 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mf-contact-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(107, 76, 154, 0.4);
}

.mf-contact-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Transcript Form */
.mf-transcript-form-container {
    background: #252542;
    border: 1px solid rgba(107, 76, 154, 0.3);
    border-radius: 12px;
    padding: 12px;
    margin-top: 10px;
    animation: fadeIn 0.3s ease;
}

.mf-transcript-form p {
    margin: 0 0 10px;
    color: #b8a9c9;
    font-size: 12px;
}

.mf-form-inline {
    display: flex;
    gap: 8px;
}

.mf-form-inline input {
    flex: 1;
    padding: 10px 12px;
    background: #1a1625;
    border: 1px solid rgba(107, 76, 154, 0.3);
    border-radius: 8px;
    color: #e8e0f0;
    font-size: 13px;
    outline: none;
}

.mf-form-inline input:focus {
    border-color: #6b4c9a;
}

.mf-form-inline button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #6b4c9a 0%, #4a3570 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mf-form-inline button:hover {
    transform: translateY(-1px);
}

.mf-form-inline button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Input Form */
.mf-chat-input-form {
    padding: 15px;
    background: #1a1625;
    border-top: 1px solid rgba(107, 76, 154, 0.2);
    display: flex;
    gap: 10px;
}

#mf-chat-input {
    flex: 1;
    padding: 12px 16px;
    background: #252542;
    border: 1px solid rgba(107, 76, 154, 0.3);
    border-radius: 25px;
    color: #e8e0f0;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

#mf-chat-input::placeholder {
    color: #6c6980;
}

#mf-chat-input:focus {
    border-color: #6b4c9a;
}

#mf-chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mf-chat-input-form button[type="submit"] {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #6b4c9a 0%, #4a3570 100%);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.mf-chat-input-form button[type="submit"]:hover {
    transform: scale(1.05);
}

.mf-chat-input-form button[type="submit"] svg {
    width: 18px;
    height: 18px;
}

/* Mobile Responsive */
@media screen and (max-width: 480px) {
    #mf-chatbot-container {
        bottom: 15px;
        right: 15px;
    }
    
    #mf-chatbot-toggle {
        width: 55px;
        height: 55px;
    }
    
    #mf-chatbot-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -5px;
        border-radius: 12px;
    }
    
    .mf-products-grid {
        grid-template-columns: 1fr;
    }
    
    .mf-quick-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .mf-contact-form-container {
        padding: 12px;
    }
    
    .mf-form-buttons {
        flex-direction: column;
    }
    
    .mf-contact-cancel,
    .mf-contact-submit {
        flex: none;
        width: 100%;
    }
}

/* Print - Hide chatbot */
@media print {
    #mf-chatbot-container {
        display: none !important;
    }
}
