/* Chat Widget Base */
#nts-chat-widget {
    position: fixed;
    bottom: 40px;
    right: 22px;
    z-index: 999999;
    font-family: Arial, sans-serif;
}

@media (max-width: 767px) {
    body.single-product #nts-chat-widget {
        position: fixed;
        bottom: 110px;
        right: 22px;
        z-index: 999999;
        font-family: Arial, sans-serif;
    }
}

#nts-chat-toggle {
    background: #375542;
    color: white;
    width: 50px;
    height: 50px;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background 0.3s, transform 0.3s;
}

#nts-chat-toggle:hover {
    background: #2a4233;
    transform: scale(1.05);
}

#nts-chat-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.nts-chat-header {
    background: #375542;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nts-chat-header h4 {
    margin: 0;
    font-size: 16px;
    color: white;
}

#nts-chat-close {
    cursor: pointer;
    font-size: 14px;
}

/* Pre-chat Form */
#nts-chat-form-container {
    padding: 20px;
}

#nts-chat-form-container p {
    margin-top: 0;
    font-size: 14px;
    color: #555;
    margin-bottom: 15px;
}

#nts-chat-form-container input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

#nts-chat-start-btn {
    width: 100%;
    padding: 10px;
    background: #375542;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

#nts-chat-start-btn:hover {
    background: #2a4233;
}

/* Chat Messages */
#nts-chat-messages-container {
    display: flex;
    flex-direction: column;
    height: 400px;
}

#nts-chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9f9f9;
}

.nts-msg {
    margin-bottom: 15px;
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.nts-msg-user {
    background: #375542;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.nts-msg-ai, .nts-msg-admin {
    background: #e5e5ea;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 2px;
}

.nts-chat-system-msg {
    text-align: center;
    color: #888;
    font-size: 12px;
    margin-bottom: 10px;
}

/* Input Area */
.nts-chat-input-area {
    padding: 10px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
}

#nts-chat-input {
    flex-grow: 1;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    resize: none;
    height: 40px;
    font-family: inherit;
}

#nts-chat-send-btn {
    margin-left: 10px;
    padding: 0 10px;
    background: #375542;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#nts-chat-send-btn:hover {
    background: #2a4233;
}

#nts-chat-human-btn {
    background: transparent;
    border: none;
    border-top: 1px solid #eee;
    padding: 10px;
    color: #888;
    cursor: pointer;
    font-size: 12px;
}

#nts-chat-human-btn:hover {
    color: #375542;
}

.nts-msg { position: relative; }
.nts-msg-tools { display:none; position:absolute; top:-10px; right:0; background:#fff; border:1px solid #ddd; border-radius:4px; padding:2px 5px; box-shadow:0 1px 3px rgba(0,0,0,0.1); z-index:10; }
.nts-msg-user .nts-msg-tools { right:auto; left:0; }
.nts-msg:hover .nts-msg-tools { display:inline-block; }
.nts-quote-action, .nts-revoke-action { text-decoration:none; font-size:12px; margin:0 2px; cursor:pointer; color:#666; }
.nts-quote-block {
    background: rgba(0,0,0,0.04);
    border-left: 4px solid #375542;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #555;
    border-radius: 2px 4px 4px 2px;
    display: block;
    position: relative;
    text-align: left;
}
.nts-quote-block::before {
    content: "💬 引用：";
    display: block;
    font-weight: bold;
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

/* Hide widget when Blocksy theme offcanvas panel (like cart drawer) is active, or on WooCommerce checkout page */
body.woocommerce-checkout #nts-chat-widget,
body[data-panel] #nts-chat-widget {
    display: none !important;
}


/* POVison Chat Widget UI Update */
#nts-chat-panel {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    background: #fff;
    position: relative;
}
.nts-chat-header {
    background-color: #34533a; /* Dark Green */
    color: #fff;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.nts-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.nts-chat-logo {
    width: 50px;
    height: 50px;
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}
.nts-chat-title h4 {
    margin: 0 0 5px 0 !important;
    font-size: 18px !important;
    font-weight: 500;
    color: #fff !important;
}
.nts-agent-status {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.nts-agent-dot {
    width: 8px;
    height: 8px;
    background-color: #4ade80;
    border-radius: 50%;
    display: inline-block;
}
#nts-chat-close {
    cursor: pointer;
    opacity: 0.8;
}
#nts-chat-close:hover {
    opacity: 1;
}

/* Chat Form Overlay */
#nts-chat-form-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
#nts-chat-form-container {
    background: #fff;
    width: 85%;
    border-radius: 12px;
    padding: 30px 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
#nts-chat-form-close {
    position: absolute;
    top: 15px;
    right: 15px;
    cursor: pointer;
    color: #999;
    font-size: 16px;
}
.nts-form-logo {
    background: #34533a;
    color: #fff;
    width: 60px;
    height: 60px;
    margin: 0 auto 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}
.nts-form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}
.nts-form-row input {
    width: 50%;
}
#nts-chat-form-container input {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 15px;
    outline: none;
}
#nts-chat-form-container input:focus {
    border-color: #34533a;
}
#nts-chat-start-btn {
    background: #b5c2b8; /* Light grey-green when inactive/base */
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
    margin-bottom: 15px;
}
#nts-chat-start-btn.active {
    background: #34533a;
}
.nts-form-terms {
    font-size: 11px;
    color: #666;
    text-align: center;
    margin: 0;
}

/* Quick Actions in Chat */
.nts-chat-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px 15px;
}
.nts-chat-quick-actions-title {
    font-size: 13px;
    color: #333;
    margin-bottom: 10px;
}
.nts-quick-btn {
    background: #ebf5ff;
    color: #0066cc;
    border: none;
    border-radius: 6px;
    padding: 12px 15px;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    display: flex;
    justify-content: space-between;
    transition: background 0.2s;
}
.nts-quick-btn:hover {
    background: #d6ebff;
}

#nts-chat-messages-container {
    display: flex;
    flex-direction: column;
    height: 480px; 
}
#nts-chat-messages {
    flex-grow: 1;
    overflow-y: auto;
}

/* Product Cards Carousel styles */
.nts-product-cards-container {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 10px 0;
    margin-top: 10px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}
.nts-product-cards-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.nts-product-card {
    min-width: 160px;
    max-width: 160px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.nts-product-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.nts-product-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nts-product-price {
    font-size: 14px;
    color: #e44d26;
    font-weight: bold;
    margin-bottom: 10px;
    margin-top: auto; /* Push to bottom */
}

.nts-product-btn {
    display: block;
    text-align: center;
    background: #007cba;
    color: #fff !important;
    text-decoration: none;
    padding: 6px;
    border-radius: 4px;
    font-size: 12px;
    transition: background 0.3s;
}

.nts-product-btn:hover {
    background: #005a87;
}
