/* Modern Professional Chatbot Design with Branding Colors */
/* Primary Brand Color: #9D5248 (Warm Brown/Rust) */
/* Secondary Color: #FFFFFF (White) */

/* Reset and prevent theme conflicts */
.fabric-chatbot-container *,
.fabric-chatbot-container *::before,
.fabric-chatbot-container *::after {
    box-sizing: border-box;
}

/* Prevent WordPress theme interference */
.fabric-chatbot-fullpage-container,
.fabric-chatbot-fullpage-container * {
    position: static !important;
}

.fabric-chatbot-fullpage-container {
    position: relative !important;
}

.fabric-chatbot-sidebar {
    position: relative !important;
}

.fabric-chatbot-main {
    position: relative !important;
}

/* CSS Variables for consistent theming */
:root {
    --primary-color: #9D5248;
    --primary-hover: #8A453A;
    --primary-light: #B86B5F;
    --secondary-color: #FFFFFF;
    --text-dark: #2C2C2C;
    --text-light: #666666;
    --border-color: #E5E5E5;
    --shadow-light: 0 2px 8px rgba(157, 82, 72, 0.1);
    --shadow-medium: 0 4px 16px rgba(157, 82, 72, 0.15);
    --shadow-heavy: 0 8px 32px rgba(157, 82, 72, 0.2);
    --border-radius: 12px;
    --border-radius-small: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Container Styles */
.fabric-chatbot-container {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #FAFAFA 100%);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    font-size: 14px;
    line-height: 1.5;
    contain: layout style;
    border-radius: 0;
    display: flex;
    height: 100vh;
}

/* Fullpage Container with Sidebar */
.fabric-chatbot-fullpage-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: 600px;
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
    margin: 0 auto;
    contain: layout style;
    isolation: isolate;
}

/* Sidebar Styles */
.fabric-chatbot-sidebar {
    width: 280px;
    min-width: 280px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
    flex-shrink: 0;
}

.fabric-chatbot-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="rgba(255,255,255,0.03)"/><circle cx="80" cy="40" r="1" fill="rgba(255,255,255,0.03)"/><circle cx="40" cy="80" r="1" fill="rgba(255,255,255,0.03)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}
img.fabric-chatbot-preview-image{
    width: 70px;
}
.fabric-chatbot-sidebar-header {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    z-index: 1;
    color: white;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px 0;
    letter-spacing: -0.02em;
}
.fabric-chatbot-history-empty {
    color: white;
}

.fabric-chatbot-sidebar-header h3 {
    color: var(--secondary-color);
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Chat History Container */
.fabric-chatbot-sidebar-history {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    position: relative;
    z-index: 1;
}

.fabric-chatbot-sidebar-history::-webkit-scrollbar {
    width: 6px;
}

.fabric-chatbot-sidebar-history::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.fabric-chatbot-sidebar-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.fabric-chatbot-sidebar-history::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Chat History Items */
.fabric-chatbot-history-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius-small);
    padding: 12px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    backdrop-filter: blur(10px);
}

.fabric-chatbot-history-item:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(4px);
}

.fabric-chatbot-history-item.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.fabric-chatbot-history-title {
    color: var(--secondary-color);
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fabric-chatbot-history-date {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    margin: 0;
    font-weight: 400;
}

.fabric-chatbot-history-actions {
    position: absolute;
    top: 18px;
    right: 8px;
    opacity: 0;
    transition: var(--transition);
}

.fabric-chatbot-history-item:hover .fabric-chatbot-history-actions {
    opacity: 1;
}

.fabric-chatbot-history-menu-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 4px;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    transition: var(--transition);
}

.fabric-chatbot-history-menu-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* New Chat Button */
.fabric-chatbot-new-chat-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #F5F5F5 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius-small);
    color: var(--primary-color);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin: 16px 12px;
    padding: 14px 20px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.fabric-chatbot-new-chat-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.fabric-chatbot-new-chat-btn:active {
    transform: translateY(0);
}

/* Main Chat Area */
.fabric-chatbot-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--secondary-color);
    height: 100%;
    min-width: 0;
}

/* Chat Header */
.fabric-chatbot-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: var(--secondary-color);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
}

.fabric-chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="dots" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23dots)"/></svg>');
    pointer-events: none;
}

.fabric-chatbot-header-content {
    position: relative;
    z-index: 1;
}

.fabric-chatbot-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px 0;
    letter-spacing: -0.02em;
}

.fabric-chatbot-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
    font-weight: 400;
}

/* Messages Container */
.fabric-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: linear-gradient(180deg, #FAFAFA 0%, var(--secondary-color) 100%);
    position: relative;
}

.fabric-chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.fabric-chatbot-messages::-webkit-scrollbar-track {
    background: #F0F0F0;
    border-radius: 4px;
}

.fabric-chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

.fabric-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Message Styles */
.fabric-chatbot-message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    animation: fadeInUp 0.4s ease-out;
}

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

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

.fabric-chatbot-message-content {
    /* max-width: 75%; */
    padding: 10px 12px;
    border-radius: 18px;
    position: relative;
    /* word-wrap: break-word; */
    line-height: 1.5;
}

.fabric-chatbot-message.bot .fabric-chatbot-message-content {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #F8F8F8 100%);
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    border-bottom-left-radius: 6px;
    box-shadow: var(--shadow-light);
    font-size: 16px;
}

.fabric-chatbot-message.user .fabric-chatbot-message-content {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: var(--secondary-color);
    border-bottom-right-radius: 6px;
    box-shadow: var(--shadow-medium);
}

.fabric-chatbot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: var(--shadow-light);
}

.fabric-chatbot-message.bot .fabric-chatbot-avatar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: var(--secondary-color);
}

.fabric-chatbot-message.user .fabric-chatbot-avatar {
    background: linear-gradient(135deg, #E0E0E0 0%, #D0D0D0 100%);
    color: var(--text-dark);
}

/* Input Area */
.fabric-chatbot-input-area {
    padding: 20px 24px;
    background: var(--secondary-color);
    border-top: 1px solid var(--border-color);
    position: relative;
}

.fabric-chatbot-generated-image img {
    width: 100%;
}
.fabric-chatbot-input-container {
    display: flex;
    align-items: center;
    gap: 12px;
    /* background: #F8F8F8; */
    border: 2px solid var(--border-color);
    border-radius: 24px;
    padding: 8px 16px;
    transition: var(--transition);
    position: relative;
    margin-left: 20px;
    margin-bottom: 20px;
    margin-right: 20px;
}
button.fabric-chatbot-history-menu-item.delete{
    color: white !important;
}
.fabric-chatbot-input-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(157, 82, 72, 0.1);
}

.fabric-chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    line-height: 1.5;
    padding: 12px 0;
    resize: none;
    outline: none;
    color: var(--text-dark);
    font-family: inherit;
    max-height: 120px;
    min-height: 20px;
}

.fabric-chatbot-input::placeholder {
    color: var(--text-light);
}

.fabric-chatbot-send-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    border: none;
    border-radius: 50%;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 16px;
    height: 40px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
    flex-shrink: 0;
}

.fabric-chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-medium);
}

.fabric-chatbot-send-btn:active {
    transform: scale(0.95);
}

.fabric-chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Floating Chat Button */
.fabric-chatbot-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-heavy);
    transition: var(--transition);
    border: none;
    font-size: 24px;
    z-index: 1000;
}

.fabric-chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(157, 82, 72, 0.3);
}

.fabric-chatbot-button:active {
    transform: scale(1.05);
}

/* Loading Animation */
.fabric-chatbot-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: transparent;
}

.fabric-chatbot-loading-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fabric-chatbot-loading-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: typingDots 1.8s ease-in-out infinite;
}

.fabric-chatbot-loading-dot:nth-child(1) { 
    animation-delay: 0s; 
}

.fabric-chatbot-loading-dot:nth-child(2) { 
    animation-delay: 0.3s; 
}

.fabric-chatbot-loading-dot:nth-child(3) { 
    animation-delay: 0.6s; 
}

@keyframes typingDots {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px) scale(1.2);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .fabric-chatbot-fullpage-container {
        flex-direction: column;
        height: 100vh;
    }
    
    .fabric-chatbot-sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .fabric-chatbot-sidebar-history {
        padding: 12px 16px;
    }
    
    .fabric-chatbot-messages {
        padding: 16px;
    }
    
    .fabric-chatbot-input-area {
        padding: 16px;
    }
    
    .fabric-chatbot-button {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        font-size: 20px;
    }
}

/* Widget Mode Styles */
.fabric-chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 600px;
    z-index: 9999;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
}

.fabric-chatbot-widget .fabric-chatbot-messages {
    height: calc(100% - 140px);
}

/* Hidden and Minimized States */
.fabric-chatbot-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

.fabric-chatbot-minimized {
    height: 60px !important;
    overflow: hidden;
}

/* Utility Classes */
.fabric-chatbot-fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fabric-chatbot-slide-up {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Login Prompt Styles */
.fabric-chatbot-login-prompt {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.9);
}

.fabric-chatbot-login-prompt h4 {
    color: var(--secondary-color);
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
}


.fabric-chatbot-product-list {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    margin-top: 10px;
}

.fabric-chatbot-product-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    border: 1px solid #eee;
    width: 260px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
}

.fabric-chatbot-product-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.fabric-chatbot-product-title {
    font-weight: 600;
    margin-bottom: 6px;
    text-align: center;
}

.fabric-chatbot-product-price {
    color: black;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.fabric-chatbot-add-to-cart-btn {
    background: black;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 8px 16px;
    margin-bottom: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.fabric-chatbot-add-to-cart-btn:hover {
    background: #2c2c2c;
}

.fabric-chatbot-view-product-btn {
    color: black;
    text-decoration: underline;
    font-size: 0.95em;
    margin-left: 8px;
}

.fabric-chatbot-login-prompt p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Empty History Message */
.fabric-chatbot-empty-history {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.5;
}

/* Menu Dropdown */
.fabric-chatbot-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-medium);
    min-width: 120px;
    z-index: 1000;
    overflow: hidden;
}

.fabric-chatbot-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-dark);
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.fabric-chatbot-menu-item:hover {
    background: #F5F5F5;
    color: var(--primary-color);
}

.fabric-chatbot-menu-item.danger:hover {
    background: #FEF2F2;
    color: #DC2626;
}