/* Product info area styles - optimized with reference to style.css */

/* Product info area */
.comment-section {
    position: absolute;
    left: 20px;
    bottom: 60px; /* Default 60px */
    width: 75%;
    max-height: 60%;
    z-index: 1000;
    transition: all 0.3s ease;
    display: none; /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    border: none; /* Remove border */
    background: transparent; /* Transparent background */
}

.comment-section.show {
    display: block;
    opacity: 1;
    visibility: visible;
}

.comment-container {
    position: relative;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
}

/* Comment item styles - referencing chat message styles from style.css */
.comment-item {
    display: flex !important;
    align-items: flex-end !important;
    margin-bottom: 6px !important;
    background: rgba(60, 80, 90, 0.75) !important;
    border-radius: 12px !important;
    padding: 5px 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    width: fit-content !important;
    max-width: 100% !important;
    animation: slideInLeft 0.5s ease-out;
    word-wrap: break-word;
    backdrop-filter: blur(10px);
    border: none;
    /* Add fade-out animation support */
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    opacity: 1;
    transform: translateX(0);
}

.comment-item:last-child {
    margin-bottom: 0;
}

/* Fade-out animation state */
.comment-item.fade-out {
    opacity: 0 !important;
    transform: translateY(-20px) !important;
    pointer-events: none;
}

/* Queue message special styles - newly added */
.comment-item.queue-message {
    background: rgba(0, 123, 255, 0.3) !important;
    border-left: 3px solid #007bff !important;
}

.comment-item.queue-message.sending {
    background: rgba(255, 193, 7, 0.3) !important;
    border-left: 3px solid #ffc107 !important;
}

.comment-item.queue-message.failed {
    background: rgba(220, 53, 69, 0.3) !important;
    border-left: 3px solid #dc3545 !important;
}

/* Sending indicator - newly added */
.sending-indicator {
    font-size: 12px;
    color: #ffc107;
    margin-top: 4px;
    font-style: italic;
}

/* Comment type styles - optimized with reference to style.css */
.comment-item.system-message {
    background: rgba(128, 128, 128, 0.3) !important; /* Reference product-card background color */
    color: #ffffff !important;
}

.comment-item.system-message .comment-content {
    color: #ffffff  !important;
    font-size: 14px !important;
}

.comment-item.video-message {
    background: rgba(128, 128, 128, 0.3) !important; /* Reference product-card background color */
    color: #ffffff !important;
}

.comment-item.video-message .comment-content {
    color: #ffffff  !important;
    font-size: 13px !important;
}

.comment-item.qa-message {
    background: rgba(60, 80, 90, 0.5) !important;
}

.comment-item.virtual-comment {
    background: rgba(60, 80, 90, 0.5) !important;
}

.comment-item.real-comment {
    background: rgba(60, 80, 90, 0.5) !important;
}

/* System message icon - hide system message icon */
.system-icon, .video-icon {
    display: none !important;
}

.qa-icon {
    margin-right: 8px;
    font-size: 16px;
    opacity: 0.8;
}

/* Customer service Q&A styles - optimized with reference to style.css */
.qa-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.qa-question {
    font-weight: 600 !important;
    color: #ffffff !important;
    font-size: 13px !important;
}

.qa-answer {
    color: #ffffff !important;
    font-size: 13px !important;
    padding-left: 16px !important;
    border-left: 3px solid rgba(129, 212, 250, 0.7) !important;
    margin-top: 4px !important;
}

.qa-answerer {
    color: #ffd700 !important;
    font-weight: 600 !important;
    font-size: 12px !important;
}

/* User comment styles - optimized with reference to style.css */
.comment-user {
    display: flex !important;
    align-items: flex-end !important;
    flex-shrink: 0 !important;
    margin-right: 8px !important;
}

/* User avatar styles */
.comment-user .user-avatar {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    margin-right: 8px !important;
    flex-shrink: 0 !important;
}

.username {
    font-size: 13px !important;
    font-weight: bold !important;
    color: #86d5fa !important;
    margin-bottom: 1px !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 120px !important;
}

.comment-content {
    font-size: 13px !important;
    color: #ffffff !important;
    word-break: break-word !important;
    line-height: 1.4 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    flex: 1 !important;
    min-width: 0 !important;
    margin-left: 4px !important;
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    z-index: 1001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.comment-container.has-scroll .scroll-indicator {
    opacity: 1;
}

/* Loading animation - optimized with reference to style.css */
.comment-loading {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    color: #81d4fa !important;
    font-size: 14px !important;
}

.comment-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #81d4fa !important;
    border-top: 2px solid transparent !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
    margin-left: 10px !important;
}

/* Empty state - optimized with reference to style.css */
.comment-empty {
    color: #81d4fa !important;
    font-size: 14px !important;
    text-align: center !important;
    padding: 20px !important;
    opacity: 0.7 !important;
}

/* Responsive design - optimized with reference to style.css */
@media (max-width: 480px) {
    .comment-section {
        left: 10px;
        bottom: 60px; /* Default 60px */
        width: 80%;
        max-height: 55%;
    }
        
    .comment-item {
        font-size: 13px !important;
        padding: 10px 12px !important;
        margin-bottom: 10px !important;
        border-radius: 10px !important;
    }
    
    .qa-answer {
        font-size: 12px !important;
        padding-left: 12px !important;
    }
    
    .username {
        font-size: 12px !important;
    }
    
    .comment-content {
        font-size: 13px !important;
    }
}

/* Animation effects - optimized with reference to style.css */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Gradient hide animation */
@keyframes fadeOutUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Ensure product info area styles are consistent with style.css */
.comment-section .comment-item {
    font-family: 'Segoe UI', 'Arial', 'PingFang SC', 'Microsoft YaHei', sans-serif !important;
    letter-spacing: 0.02em !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
}

/* System message special styles */
.comment-section .comment-item.system-message,
.comment-section .comment-item.video-message {
    text-align: left !important;
    word-break: break-word !important;
    word-wrap: break-word !important;
    line-height: 1.6 !important;
    letter-spacing: 0.02em !important;
    font-size: 15px !important;
    font-family: 'Segoe UI', 'Arial', 'PingFang SC', 'Microsoft YaHei', sans-serif !important;
    color: #81d4fa !important;
    background: rgba(128, 128, 128, 0.3) !important; /* Adjusted to match product card background color */
    border-radius: 14px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;    
    overflow-wrap: break-word !important;
    hyphens: auto !important;
}

/* Swipe interaction */
.comment-container.scrolling {
    transition: none;
}

.comment-container.scrolling .comment-item {
    animation: none;
}

/* Paused loading state */
.comment-section.paused .comment-item {
    animation-play-state: paused;
}

/* Error state */
.comment-error {
    color: #ff6b6b;
    font-size: 14px;
    text-align: center;
    padding: 20px;
    background-color: rgba(255, 107, 107, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

/* ================== Comment Popup Styles ================== */

/* Comment popup styles */
.comment-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: flex-end;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
    animation: modalFadeIn 0.3s ease-out;
}

.comment-modal.show {
    display: flex;
}

.comment-modal.show .comment-modal-content {
    transform: translateX(-50%) translateY(0);
}

.comment-modal-content {
    background-color: #ffffff;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 480px;
    min-height: 50vh;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideUpFromBottom 0.3s ease-out;
    overflow: hidden;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
}

.comment-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 15px 20px;
    border-bottom: none;
    background-color: #ffffff;
}

.comment-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333333;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: #999999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background-color: #f5f5f5;
    color: #666666;
}

.comment-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
    max-height: 400px;
}

.comment-item {
    padding: 15px 0;
    border-bottom: none;
    animation: commentSlideIn 0.3s ease-out;
    background-color: #ffffff;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-user {
    display: flex;
    align-items: center;
}

.username {
    font-weight: 600;
    color: #333333;
    font-size: 14px;
}

.comment-content {
    color: #333333;
    font-size: 14px;
    line-height: 1.5;
}

.comment-time {
    color: #666666;
    font-size: 12px;
}

.comment-input-area {
    padding: 20px;
    border-top: 1px solid #f0f0f0;
    background-color: #ffffff;
}

.comment-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    background-color: #ffffff;
    color: #333333;
}

.comment-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.comment-send-btn {
    background-color: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 60px;
}

.comment-send-btn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.comment-send-btn:active {
    transform: translateY(0);
}

.comment-send-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* Empty state */
.comment-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999999;
}

.comment-empty-icon {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Loading state */
.comment-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
}

.comment-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

/* Animation effects */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideUpFromBottom {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes commentSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 480px) {
    .comment-modal-content {
        width: 100%;
        max-height: 70vh;
        min-height: 50vh;
        border-radius: 15px 15px 0 0;
    }
    
    .comment-modal-header {
        padding: 15px 15px 10px 15px;
    }
    
    .comment-modal-header h3 {
        font-size: 16px;
    }
    
    .comment-list {
        padding: 0 15px;
        max-height: 350px;
    }
    
    .comment-input-area {
        padding: 15px;
    }
    
    .comment-input {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .comment-send-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 50px;
    }
}

/* Scrollbar styles */
.comment-list::-webkit-scrollbar {
    width: 4px;
}

.comment-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.comment-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.comment-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
} 