/**
 * Hooshyar Sales Advisor Bot Frontend Styles
 * 
 * Frontend styles for the sales advisor bot widget
 * Using the same styles as preview-bot-widget-content
 *
 * @package Hooshyar
 * @subpackage Sales Advisor Bot
 * @since 1.0.0
 */

/* Preview Styles - Same as admin preview */
.preview-bot-widget-content {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: IRANYekanX, 'IRANYekanX', 'IRANYekan', 'IRANYekanX-Regular', 'IRANYekanX-Bold', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.preview-bot-widget-content * {
    font-family: IRANYekanX, 'IRANYekanX', 'IRANYekan', 'IRANYekanX-Regular', 'IRANYekanX-Bold', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
}

/* استثنا کردن dashicons از فونت */
.preview-bot-widget-content .dashicons,
.preview-bot-widget-content .dashicons * {
    font-family: dashicons !important;
}

.preview-widget-button {
    width: 60px;
    height: 60px;
    background: #17461b;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}
.preview-message-input {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }
.preview-widget-button:hover {
    transform: scale(1.05);
    transition: all 0.3s ease;
}

.preview-bot-icon {
    font-size: 24px;
}

.preview-chat-container {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 450px;
    height: 700px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 5;
    transform: scale(0.8);
    transform-origin: bottom right;
}

/* Desktop - override with user settings */
@media (min-width: 769px) {
    .preview-chat-container {
        width: var(--chat-width) !important;
        height: var(--chat-height) !important;
    }
    
    .preview-widget-button {
        width: var(--button-width) !important;
        height: var(--button-height) !important;
    }
    
    .preview-bot-icon {
        font-size: var(--icon-size) !important;
    }
}

.preview-chat-container.show {
    display: flex;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .preview-chat-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw !important;
        height: 100vh !important;
        border-radius: 0 !important;
        transform: none;
        transform-origin: initial;
        border: none !important;
    }
    
    .preview-chat-header {
        position: relative;
        padding: 16px 20px;
    }
    
    .preview-chat-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .preview-close-chat {
        background-color: red !important;
    }
    
    .preview-close-chat .dashicons {
        color: white !important;
    }
    
    .preview-bot-info {
        margin-left: 0;
    }
    
    .preview-chat-messages {
        flex: 1;
        padding: 20px;
    }
    
    .preview-chat-input-container {
        padding: 16px 20px;
    }
}

.preview-chat-header {
    background: #17461b;
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.preview-chat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-close-chat,
.preview-reset-chat {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    color: #ffffff;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.preview-close-chat:hover,
.preview-reset-chat:hover {
    background: rgba(255, 255, 255, 0.3);
}

.preview-close-chat .dashicons,
.preview-reset-chat .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.preview-bot-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-bot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.preview-bot-details h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    padding: 0;
}

.preview-bot-slogan {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
}

.preview-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8f9fa;
}

.preview-bot-message {
    max-width: 80%;
    align-self: flex-end;
}

.preview-user-message {
    max-width: 80%;
    align-self: flex-start;
}

.preview-welcome-message {
    align-self: center;
    max-width: 90%;
    text-align: center;
}

.preview-welcome-message .preview-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.preview-user-message .preview-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.preview-bot-message:not(.preview-welcome-message) .preview-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.preview-message-input:focus {
    box-shadow: none !important;
}

.preview-welcome-message {
    max-width: 100%;
    align-self: center; /* Welcome message in center */
}

.preview-welcome-message .preview-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    text-align: center; /* Center text alignment */
}

.preview-chat-input-container {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e1e5e9;
    flex-shrink: 0;
}

.preview-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 8px;
    border: 1px solid #e1e5e9;
}

.preview-message-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    resize: none;
    min-height: 20px;
    max-height: 60px;
    overflow-y: auto;
    line-height: 25px;
}

.preview-send-button {
    width: 32px;
    height: 32px;
    background: #17461b;
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preview-send-button:hover {
    background: #0f2f12;
}

.preview-bot-details {
    text-align: right;
    line-height: 2;
}

.preview-message-content {
    text-align: right;
    line-height: 1.6 !important;
}

/* Typing indicator animation */
.loader {
    width: 30px;
    aspect-ratio: 4;
    --_g: no-repeat radial-gradient(circle closest-side, #444444 90%, #0000);
    background: 
        var(--_g) 0%   50%,
        var(--_g) 50%  50%,
        var(--_g) 100% 50%;
    background-size: calc(100%/3) 100%;
    animation: l7 1s infinite linear;
}

@keyframes l7 {
    33%{background-size:calc(100%/3) 0%  ,calc(100%/3) 100%,calc(100%/3) 100%}
    50%{background-size:calc(100%/3) 100%,calc(100%/3) 0%  ,calc(100%/3) 100%}
    66%{background-size:calc(100%/3) 100%,calc(100%/3) 100%,calc(100%/3) 0%  }
}

/* Related Products Styles */
.related-products {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.products-title {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: inherit;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.product-row {
    background: #e7f4e8;
    border-bottom: 1px solid rgb(217, 217, 217);
}

.product-row:last-child {
    border-bottom: none;
}

.product-image-cell {
    width: 60px;
    padding: 12px;
    text-align: center;
    vertical-align: middle;
}

.product-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.product-info-cell {
    padding: 12px;
    vertical-align: middle;
}

.product-info {
    text-align: right;
}

.product-title {
    margin: 0 0 4px 0;
    font-size: 13px;
    font-weight: 500;
    color: inherit;
    line-height: 1.4;
}

.product-price {
    font-size: 12px;
    font-weight: 600;
    color: #4CAF50;
    margin: 0;
}

.product-action-cell {
    padding: 12px;
    text-align: center;
    vertical-align: middle;
}

.product-view-btn {
    display: inline-block;
    padding: 6px 12px;
    background: #007cba;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.product-view-btn:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

/* Mobile responsive for products table */
@media (max-width: 768px) {
    .products-table {
        font-size: 12px;
    }
    
    .product-image-cell {
        width: 50px;
        padding: 8px;
    }
    
    .product-image {
        width: 40px;
        height: 40px;
    }
    
    .product-info-cell,
    .product-action-cell {
        padding: 8px;
    }
    
    .product-view-btn {
        padding: 4px 8px;
        font-size: 10px;
    }
}