.wp-timeline-root {
    max-width: 680px;
    margin: 2rem auto;
    font-family: var(--font-primary);
}

.wp-update-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.wp-card-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wp-user-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}


.wp-timestamp {
    font-size: 12px;
    color: #64748b;
}

.wp-card-body {
    padding: 0 16px 16px;
}

.wp-post-content {
    font-size: 15px;
    line-height: 1.6;
    color: #334155;
}

.wp-action-bar {
    display: flex;
    border-top: 1px solid #f1f5f9;
    padding: 4px 12px;
}

.wp-action-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    color: #64748b;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

.wp-action-btn:hover {
    background: #f8fafc;
    color: var(--accent);
}



/* Header */
/**
 * SECTION: DYNAMIC TIMELINE HEADER
 */
.wp-timeline-main-header {
    background: #ffffff;
    padding: 30px 24px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.wp-plugin-title {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wp-accent-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    /* Uses your theme's violet */
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-glow);
}

.wp-title-suffix {
    font-weight: 400;
    color: #64748b;
    margin-left: 5px;
}

.wp-header-subtitle {
    color: #64748b;
    font-size: 14px;
    margin: 0;
}

/* Tab Filters */
.wp-header-filters {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    border-top: 1px solid #f1f5f9;
    padding-top: 20px;
}

.wp-filter-btn {
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 0;
    position: relative;
    transition: color 0.3s ease;
}

.wp-filter-btn.active {
    color: var(--accent);
}

.wp-filter-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
}


/* 1. Indentation for Child Comments */
.rc-comment-item[data-depth="2"],
.rc-comment-item.depth-2,
.rc-comment-item.parent-is-not-zero {
    margin-left: 45px !important;
    border-left: 2px solid #f1f5f9;
    padding-left: 15px;
}

/* 2. THE LIMITER: Only show first 4 top-level comments */
/* We target only items that ARE NOT children (depth 1) */
.wp-comments-wrapper.wp-quora-style .rc-comment-item.depth-1:nth-of-type(n+6) {
    display: none !important;
}

/* 3. VIEW MORE: Force visibility if 5th parent exists */
.wp-view-more-comments {
    display: none; /* Hidden unless 5th item exists */
    text-align: center;
    padding-bottom: 8px;
    /* padding: 12px 0; */
    /* margin-top: 10px; */
    /* border-top: 1px solid #f1f5f9; */
}


/* 4. EXPAND LOGIC */
.wp-comments-wrapper.is-expanded .rc-comment-list>.rc-single-comment {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.wp-comments-wrapper.is-expanded .wp-view-more-comments {
    display: none !important;
}

.wp-comments-wrapper.is-expanded .rc-single-comment.rc-is-reply {
    display: flex !important;
}

/**
 * SECTION: FULL RESPONSIVENESS
 * Ensures the timeline looks perfect on Mobile, Tablet, and Desktop.
 */

/* 1. TABLET & SMALL LAPTOPS (Max 1024px) */
@media (max-width: 1024px) {
    .wp-timeline-root {
        max-width: 90%;
        /* Give it more breathing room */
        margin: 1.5rem auto;
    }
}

/* 2. MOBILE PHONES (Max 768px) */
@media (max-width: 768px) {
    .wp-timeline-root {
        max-width: 100%;
        margin: 0;
        /* Remove top/bottom margin for a full-bleed feel */
        padding: 10px;
    }

    .wp-timeline-main-header {
        padding: 20px 15px;
        /* Tighter padding for mobile */
        margin-bottom: 20px;
        border-radius: 8px;
    }


}


/* 1. Remove the Flex constraints that cause the collapse */
.wp-quora-style .rc-comment-scroll-area {
    flex: none !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* 2. Standardize the container for the Wall view */
.wp-quora-style .rc-feed-comment-drawer,
.wp-quora-style .rc-feed-comments-container {
    display: block !important;
    position: static !important;
    height: auto !important;
}


/**
 * SECTION: MOBILE COMMENT DRAWER FIX
 * Removes the 'sliding sheet' behavior for the Wall Timeline.
 */
@media (max-width: 1024px) {
    #rc-comment-drawer {
        /* FIXED: Removing absolute/fixed properties to allow flow */
        position: static !important;
        transform: none !important;
        /* Removed translateY(100%) */
        box-shadow: none !important;
        /* Removed shadow */
        border-radius: 0 !important;
        /* Removed top rounding */

        /* Forces standard block behavior */
        display: block !important;
        height: auto !important;
        max-height: none !important;
        width: 100% !important;
        transition: none !important;
    }

    /* Resets the flex container to prevent the large white gap */
    .rc-feed-comments-container {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
    }

    /* Ensures the scroll area doesn't force a viewport height */
    .rc-comment-scroll-area {
        flex: none !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
}



/**
 * SECTION: VIEW MORE VISIBILITY FIX
 */

/* 1. Ensure the container isn't hiding the button */
.wp-comments-wrapper.wp-quora-style {
    display: block !important;
}

/* 2. Simplified Visibility Logic */
/* If the 5th top-level comment exists, show the View More wrapper */
.wp-quora-style .rc-comment-list>.rc-single-comment:nth-of-type(6)~.wp-view-more-comments {
    display: block !important;
    visibility: visible !important;
}

/* 3. Fallback: Force show if the CSS above can't find the sibling */
/* This is a safety rule if your plugin's HTML is deeply nested */
.wp-quora-style .rc-single-comment:nth-of-type(6)~.wp-view-more-comments,
.wp-quora-style:has(.rc-single-comment:nth-of-type(6)) .wp-view-more-comments {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 4. Ensure the Limiter is active */
.wp-quora-style .rc-comment-list>.rc-single-comment:nth-of-type(n+6) {
    display: none !important;
}

.wp-load-more-trigger {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
    padding: 8px 24px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wp-load-more-trigger:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

div.wp-comments-wrapper.is-expanded .rc-comment-list>.rc-single-comment {
    display: flex !important;
}

/**
 * SECTION: HIGHLIGHTED PIN (REELS STYLE)
 */
.wp-update-card.is-highlighted {
    border: 2px solid var(--accent);
    /* Your theme's violet */
    box-shadow: 0 0 20px var(--accent-glow);
    animation: wp-pulse-highlight 2s ease-out;
}

@keyframes wp-pulse-highlight {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.01);
    }

    100% {
        transform: scale(1);
    }
}


/* Container for the comments list */
.wp-comments-list-container {
    display: flex;
    flex-direction: column;
}

/**
 * REFINED COMMENT LIMITER CSS
 */

/* 1. Hide everything after the 5th top-level comment when NOT expanded */
.wp-has-toggle:not(.is-expanded) .wp-comments-list-container .rc-single-comment:nth-of-type(n+6) {
    display: none !important;
}

/* 2. Transition when expanded */
.wp-has-toggle.is-expanded .wp-comments-list-container .rc-single-comment {
    display: flex !important;
    /* Plugin uses flex for comments */
    animation: wpFadeIn 0.3s ease-in;
}

/* 3. Ensure "View More" wrapper is visible if toggle is needed */
.wp-has-toggle .wp-view-more-comments {
    display: block !important;
    padding: 15px;
    border-top: 1px solid #f1f5f9;
}

/* 4. Hide "View More" button after clicking (optional, or it becomes View Less) */
.wp-has-toggle.is-expanded .wp-view-more-comments {
    display: block !important;
}

@keyframes wpFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* 1. Set the default state to HIDDEN for everything after the 5th comment */
.wp-has-toggle .wp-comments-list-container .rc-single-comment:nth-of-type(n+6) {
    display: none !important;
}

/* ONLY show them when the .is-expanded class is explicitly added */
.wp-has-toggle.is-expanded .wp-comments-list-container .rc-single-comment:nth-of-type(n+6) {
    display: flex !important;
    animation: wpFadeIn 0.3s ease-in;
}

/* Ensure the button is always visible if the toggle class exists */
.wp-has-toggle .wp-view-more-comments {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Default state: Hide comments 6 and above inside the toggle wrapper */
.wp-has-toggle .wp-comments-list-container .rc-comment-list > .rc-single-comment:nth-of-type(n+6) {
    display: none !important;
}

/* Expanded state: Show them */
.wp-has-toggle.is-expanded .wp-comments-list-container .rc-comment-list > .rc-single-comment:nth-of-type(n+6) {
    display: flex !important;
    animation: wpFadeIn 0.3s forwards;
}


/* FORCE SHOW when expanded - using a very high specificity selector */
div.wp-comments-wrapper.is-expanded .wp-comments-list-container .rc-single-comment {
    display: flex !important; /* Most comment plugins use flex */
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
}
