/* Right Sidebar Styles */
.right-sidebar {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%); /* Adjusted to center the group better */
    background-color: #f8f9fa; /* Light background for the main button group */
    border: 1px solid #dee2e6;
    border-right: none;
    border-radius: 8px 0 0 8px;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 0; /* Remove padding, will control button spacing via btn itself */
}

.sidebar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px; /* Reduced by 20% */
    color: #1976d2; /* New default color for top buttons */
    text-decoration: none;
    font-size: 11.5px; /* Increased by 20% from 9.6px */
    transition: background-color 0.3s, color 0.3s;
    width: 64px; /* Reduced by 20% */
    box-sizing: border-box;
    border-bottom: 1px solid #e9ecef; /* Separator line for top buttons */
}

/* Remove bottom border from the last button IN THE MAIN GROUP */
.right-sidebar .sidebar-btn:last-child {
    border-bottom: none;
}

.sidebar-btn i {
    font-size: 19.2px; /* Reduced by 20%, consider rounding to 19px or 20px */
    margin-bottom: 4px; /* Reduced by 20% */
}

/* Hover/active for top buttons */
.sidebar-btn:hover,
.sidebar-btn:active,
.sidebar-btn.active-consult, /* Added class for persistent active state for buy consult */
.sidebar-btn.active-service { /* Added class for persistent active state for customer service */
    background-color: #0056eb; /* New hover/active background */
    color: #fff; /* White text/icon on hover/active */
}

/* Back to top button specific styles - this class is on the <a> tag */
.sidebar-btn.back-to-top {
    background-color: #f8f9fa; /* New: Light background to match theme */
    color: #1976d2; /* New: Themed icon/text color */
    border: 1px solid #dee2e6; /* New: Lighter border to match theme */
    border-right: none;
    border-radius: 6.4px 0 0 6.4px; /* Reduced by 20%, consider rounding */
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    margin: 0; /* Reset margin if any from .sidebar-btn */
    padding: 12px 8px; /* Reduced by 20% */
    width: 64px; /* Reduced by 20% */
    /* display: flex; is already on .sidebar-btn, confirm it's working as expected by JS */
}

.sidebar-btn.back-to-top:hover,
.sidebar-btn.back-to-top:active { /* Added :active for mobile touch */
    background-color: #0056eb; /* New: Themed hover background */
    color: #fff; /* Keep text white on hover */
}

/* Styles for the back-to-top CONTAINER */
.back-to-top-container {
    position: fixed;
    right: 0;
    z-index: 999;
    display: none;
    margin-top: 42px; /* Reduced by 30% from 60px */
    top: 50%;
    transform: translateY(calc(60px + 42px)); /* Adjusted with new margin */
}

/* Mobile Styles */
@media (max-width: 768px) {
    .right-sidebar {
        padding: 0; /* Reset padding */
        transform: translateY(-50%); /* Re-center */
        /* border-radius: 6.4px 0 0 6.4px; Consistent rounding */
    }

    .sidebar-btn {
        padding: 8px 6px; /* Reduced by 20% */
        font-size: 9.6px; /* Increased by 20% from 8px */
        width: 52px; /* Reduced by 20% */
    }

    .sidebar-btn i {
        font-size: 16px; /* Reduced by 20% */
    }

    .back-to-top-container {
        margin-top: 32px; /* Reduced by 30% from 46px (32.2px rounded) */
        transform: translateY(calc(46px + 32px)); /* Adjusted with new margin */
    }
    
    .sidebar-btn.back-to-top { /* Ensure mobile width is applied */
        width: 52px; /* Ensure it matches */
        padding: 8px 6px; /* Ensure it matches */
        /* border-radius: 6.4px 0 0 6.4px; Consistent rounding */
    }
}

/* Consultation Modal Styles */
/* Base styles that can remain on .consult-modal if they are not overridden by * */
.consult-modal {
    display: none; /* Hidden by default */
    position: fixed; /* Fixed position */
    left: 0; /* Aligned to the left of the sidebar buttons */
    top: 50%; /* Vertically centered with the sidebar */
    transform: translate(calc(-100% - 10px), -50%); /* Position to the left of sidebar, with 10px gap */
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1010; /* Above sidebar but below potential global modals */
    width: auto; /* Auto width based on content */
    max-width: 320px; /* Max width to prevent it from being too large */
    /* padding: 10px; /* MODIFIED: Will be applied via more specific selector */
    box-sizing: border-box;
    text-align: center; /* Center align title and QR code */
    /* min-width: 160px; /* ADDED: Will be applied via more specific selector */
}

/* Apply padding and min-width with higher specificity using IDs */
#buyConsultModal.consult-modal,
#customerServiceModal.consult-modal {
    padding: 10px;
    min-width: 180px; /* Changed from 160px to 180px */
}

.consult-modal-content h4 {
    margin-top: 0;
    margin-bottom: 10px; /* Slightly reduced bottom margin for title */
    font-size: 1.3rem; /* Adjusted title */
    color: #333;
    text-align: center;
}

.contact-section {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Increased gap between WeChat and QQ sections */
}

/* New class for stacked contact method layout */
.contact-method-stacked {
    display: flex;
    flex-direction: column; /* Stack elements vertically */
    gap: 1px; /* Gap between header, actions, and QR */
}

.contact-header {
    display: flex;
    align-items: center; /* Keep icon and text vertically aligned */
    gap: 10px; /* Gap between icon and ID */
    margin-bottom: 5px; /* Space below icon+ID line */
    align-self: flex-start; /* Align this header to the start of the cross axis (left in a column flex) */
    width: 100%; /* Ensure it takes full width to allow content to be left-aligned within it */
}

.contact-method-stacked .weixin-icon,
.contact-method-stacked .qq-icon {
    font-size: 2rem; /* Adjusted icons */
    /* color is set by individual icon classes */
    margin-top: 0; /* Reset margin-top */
}
.contact-method-stacked .weixin-icon { color: #28a745; }
.contact-method-stacked .qq-icon { color: #12b7f5; }

.contact-id {
    font-size: 1rem; /* Adjusted contact ID font size */
    font-weight: bold;
    color: #444;
}

.contact-actions {
    display: flex;
    gap: 8px; /* Reduced gap between buttons */
    justify-content: center; /* Center buttons if they don't fill width */
    width: 100%; /* Allow buttons to take up space */
    margin-bottom: 8px; /* Slightly reduced space before QR code */
}

.qr-code {
    width: 140px; /* As per new HTML */
    height: 140px;
    border: 1px solid #eee;
    border-radius: 4px;
    /* margin-top: 5px; */ /* Handled by gap in contact-method-stacked */
    /* margin-bottom: 8px; */ /* Handled by gap in contact-method-stacked or margin-bottom in contact-actions */
}

/* Specific centering for WeChat QR code */
.wechat-contact .qr-code {
    display: block; /* Allow margin auto to work */
    margin-left: auto;
    margin-right: auto;
}

.copy-btn, .contact-link-btn {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    color: #333;
    padding: 5px 10px; /* Adjusted padding */
    font-size: 0.75rem; /* Adjusted font size */
    border-radius: 5px; /* Slightly more rounded */
    cursor: pointer;
    text-decoration: none;
    display: inline-flex; /* Use inline-flex for better alignment if needed */
    align-items: center; /* Vertically align content if flex */
    justify-content: center; /* Horizontally align content if flex */
    flex-grow: 1; 
    text-align: center;
    line-height: 1.4; /* Ensure text is not cramped */
}

/* Class to make text bold when in "Copied!" state */
.status-copied {
    font-weight: bold;
}

/* Add bold styling specifically to copy buttons */
/* .copy-btn {
    font-weight: bold;
} */

/* Specific styling for WeChat contact actions to ensure buttons are side-by-side and fit */
/* .wechat-contact .contact-actions {
    Default flex direction is row, so they should be side by side already with flex-grow: 1
} */

.wechat-contact .contact-actions .contact-link-btn,
.wechat-contact .contact-actions .copy-btn {
    flex-basis: 0; /* Allow them to grow based on content and flex-grow */
}

/* .copy-btn.wide-btn, .contact-link-btn.wide-btn {
    flex-basis: 45%; Example if you want them to take up roughly half each, adjust as needed
    If only one button (like WeChat copy), it will take full available width due to flex-grow
} */

.copy-btn:hover, .contact-link-btn:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
}

.contact-link-btn {
    background-color: #1976d2; 
    color: #fff;
    border-color: #1976d2;
}
.contact-link-btn:hover {
    background-color: #0056eb; 
    border-color: #0056eb;
}

/* Mobile adjustments for modal */
@media (max-width: 768px) {
    .consult-modal {
        width: 200px; /* UPDATED: Set width to 200px for mobile */
        min-width: 0; /* Reset min-width if fixed width is desired */
        max-width: calc(100vw - 40px); /* Ensure it doesn't exceed screen width with some padding */
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        right: auto; /* Reset right positioning from desktop */
        box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    }
    .consult-modal-content h4 {
        font-size: 1.2rem; /* Adjusted title size for mobile */
        margin-bottom: 12px;
    }
    .contact-method-stacked .weixin-icon,
    .contact-method-stacked .qq-icon {
        font-size: 1.8rem; /* Adjusted icon size for mobile */
    }
    .contact-id {
        font-size: 0.95rem; /* Adjusted contact ID for mobile */
    }
    .qr-code {
        width: 110px; /* Adjusted QR code for mobile */
        height: 110px;
    }
    .contact-actions {
        flex-direction: row; /* Ensure buttons are side-by-side on mobile too for WeChat */
        gap: 6px; /* Adjust gap for mobile */
    }
    /* .wechat-contact .contact-actions {
        Explicitly keep them in a row, default for .contact-actions now
    } */
    .qq-contact .contact-actions {
        flex-direction: column; /* QQ buttons remain stacked on mobile */
        align-items: stretch;
    }

    .copy-btn, .contact-link-btn {
        font-size: 0.8rem; /* Adjusted button font for mobile */
        padding: 6px 8px; /* Adjust padding for mobile buttons */
    }

    /* Adjust padding inside modal content for mobile if needed */
    .consult-modal .consult-modal-content {
        padding: 15px;
    }
}

/* Specific styling for QQ contact actions on desktop to ensure buttons are side-by-side and fit */
.qq-contact .contact-actions .contact-link-btn,
.qq-contact .contact-actions .copy-btn {
    flex-basis: 0; /* Distribute space equally on desktop */
}

/* Specific margin-top for Customer Service WeChat header */
#customerServiceModal .wechat-contact .contact-header {
    margin-top: 10px;
    margin-bottom: 2px; /* Reduced margin-bottom for tighter spacing to hint */
}

/* QR Code Hint Styling - Customer Service */
.qr-code-hint-service {
    font-size: 0.7rem; /* Small text */
    color: #666;
    margin-top: 2px; /* Space above the hint */
    margin-bottom: 4px; /* MODIFIED: Reduced space below the hint, before QR */
    text-align: center;
    display: none; /* HIDE the entire hint container by default (for desktop) */
}

/* If contact-actions is empty in customer service wechat, hide it to remove its gap contribution */
#customerServiceModal .wechat-contact .contact-actions:empty {
    display: none;
}

.qr-code-hint-service .mobile-hint {
    display: none; /* Hide mobile hint by default */
}

.qr-code-hint-service .desktop-hint {
    display: inline; /* Show desktop hint by default */
}

/* Mobile specific styles */
/* The following @media block seems to be a duplicate or misplaced */
/* @media (max-width: 768px) {
    .consult-modal {
        #customerServiceModal .wechat-contact .contact-header {
            Potentially adjust margin for mobile if needed, or keep it as 10px
        }

        .qr-code-hint-service {
            display: block; 
        }

        .qr-code-hint-service .desktop-hint {
            display: none; 
        }

        .qr-code-hint-service .mobile-hint {
            display: inline; 
        }

    }
} */

/* Reduce gap specifically for customer service WeChat section */
#customerServiceModal .wechat-contact.contact-method-stacked {
    gap: 0; /* Attempt to remove gap between header, hint, and QR */
} 