/* Use a CSS variable for easy theme integration. Your theme can override this. */
:root {
	--rpls-theme-color: #ed1c24;
	--rpls-admin-bar-offset: var(--wp-admin--admin-bar--height, 0px);
	--rpls-filter-bar-height: 83px; /* Estimated height of the sticky filter bar. Adjust if filters wrap. */
}

.entry-content p{
    color: black !important;
    margin-bottom: 0.2em !important;
}

.rpls-reaction-wrapper{
    margin-top: 0px !important;
    padding-top: 0px !important;
    border-top: none !important;
    border-bottom: none !important;
}

/* Accordion List Styles */
.rpls-accordion-list-container {
    position: relative;
    margin-top: 0px !important;
}

.rpls-accordion-list {
	margin-bottom: 20px;
	/* Removed accordion-specific styles like border, radius, overflow */
}

.rpls-accordion-item {
	/* Use padding/margin for separation instead of a full border */
	padding-bottom: 15px;
	margin-bottom: 15px;
	border-bottom: 1px solid #e2e2e2;
}

.rpls-accordion-item:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: none;
}

.rpls-accordion-title {
	margin: 0;
	padding: 0;
	/* New styles for positioning admin icons */
	display: flex;
	justify-content: space-between;
	align-items: center;
	/* Font styling is handled by the trigger button inside */
}

.rpls-accordion-trigger {
	/* Reset button styles to appear as plain text */
	background: none;
	border: none;
	outline: none;
	box-shadow: none;
	color: #222;
	cursor: pointer;
	display: flex;
	align-items: center; /* Vertically center the title text */
	padding: 0;
	flex-grow: 1; /* Allow the button to take up available space */
	min-width: 0; /* Allow the button to shrink if needed */
	text-align: left;
	/* font-size: 18px; */
	font-weight: 600;
	transition: color 0.2s ease-in-out;
}

.rpls-accordion-trigger .rpls-accordion-title-text {
	flex: 1; /* Allow the text to take up available space within the button */
	padding-right: 10px; /* Space between title and icons */
}

/* Apply theme color on hover, focus, and when the accordion is active */
.rpls-accordion-trigger:hover,
.rpls-accordion-trigger:focus, .rpls-accordion-item:hover,
.rpls-accordion-item.is-active .rpls-accordion-trigger {
	color: var(--rpls-theme-color);
    background: none;
}

.rpls-accordion-item:hover {
    background: none;
}

.rifnote-summary {
    color: black;
}


.rpls-accordion-content {
	padding-top: 10px;
	background: none;
}

/* Loader Styles */
.rpls-accordion-loader {
    padding: 20px 0;
    text-align: center;
    height: 40px;
}

.rpls-loader {
    display: inline-block;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: rpls-spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s;
}

.rpls-accordion-loader.is-loading .rpls-loader {
    opacity: 1;
}

@keyframes rpls-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Date Group Heading Styles */
.rpls-date-group-heading {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0;
    padding: 8px 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: -webkit-sticky;
	position: sticky;
	/* Stick below the admin bar and the filter bar */
	top: calc(var(--rpls-admin-bar-offset) + var(--rpls-filter-bar-height) - 3px);
	z-index: 100; /* Below the filter bar */
	background: #f9f9f9; /* Give it a background to hide content scrolling under it */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
}

/* Make the "Today" heading sticky */
.rpls-date-group-heading.is-today-heading {
	position: -webkit-sticky;
	position: sticky;
	/* Stick below the admin bar and the filter bar */
	top: calc(var(--rpls-admin-bar-offset) + var(--rpls-filter-bar-height) - 3px);
	z-index: 100; /* Above other date headers but below the filter bar */
	background: #f9f9f9;
	box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Add margin to the container of the items, not the heading itself */
.rpls-date-group-heading + .rpls-accordion-item {
    margin-top: 0px !important;
}

.rpls-date-nav-buttons {
    display: flex;
    gap: 10px;
}

.rpls-date-nav-button {
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.1);
    color: #555;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
}

.rpls-accordion-list > .rpls-date-group-heading:first-child {
    margin-top: 0;
}

/* Filter Form Styles */
.rpls-accordion-filters {
    display: flex;
    width: 100% !important;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    position: -webkit-sticky;
	position: sticky;
	top: var(--rpls-admin-bar-offset);
	z-index: 101;
	background: #fff;
	padding: 15px;
	margin-bottom: 10px;
	box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* When using the 'wrap' layout, make the filter bar static. */
.rpls-accordion-filters.rpls-filter-layout--wrap {
	position: static;
	box-shadow: none;
	border-bottom: 1px solid #e2e2e2;
}

.rpls-accordion-filters.rpls-filter-layout--wrap + .rpls-accordion-list-container {
	/* When wrapped, the filter bar isn't sticky, so remove its height offset. */
	--rpls-filter-bar-height: 1px;
}

/* Layout for when the advanced filters are open */
.rpls-accordion-filters.advanced-filters-open {
	flex-wrap: wrap;
}

.rpls-accordion-filters .rpls-advanced-filters {
	/* This is the main container for the advanced controls */
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 15px; /* A little more space for a cleaner look */
	width: 100%;
	padding-top: 15px; /* Add some space above the advanced controls */
}

.rpls-accordion-filters .rpls-advanced-filters .rpls-filter-search {
	/* Make the search bar take up the full width */
	flex-basis: 100%;
}

.rpls-accordion-filters .rpls-advanced-filters .rpls-date-filters-wrapper,
.rpls-accordion-filters .rpls-advanced-filters .rpls-filter-actions {
	/* These containers will now sit on the second line */
	display: flex;
	align-items: center;
	gap: 10px;
}

.rpls-trending-button.is-active {
	background-color: #2d3748; /* A dark gray-blue */
	color: #ffffff;
	border-color: #2d3748;
	transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.rpls-trending-buttons-scroll-wrapper {
	flex: 1; /* Allow the wrapper to grow and fill available space */
	min-width: 0; /* Important for flex items to shrink below their content size */
	overflow-x: auto; /* This enables horizontal scrolling */
	-webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
	position: relative; /* Needed for the peek-a-boo gradient */

	/* Hide the scrollbar for a cleaner look across browsers */
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none;  /* IE and Edge */
}

.rpls-trending-buttons-scroll-wrapper::-webkit-scrollbar {
	display: none; /* Chrome, Safari, and Opera */
}

.rpls-trending-buttons {
	display: flex;
	flex-wrap: nowrap; /* This is crucial to prevent buttons from wrapping */
	gap: 8px; /* Adds spacing between the buttons */
}

.rpls-trending-buttons .rpls-trending-button {
	flex-shrink: 0; /* This is the key: prevent buttons from shrinking */
}

.rpls-trending-button.has-image {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding-left: 6px;
}

.rpls-trending-button .rpls-term-image {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	object-fit: cover;
	background-color: #e0e0e0; /* A light gray placeholder */
	border: 1px solid rgba(0,0,0,0.05);
}

/* Peek-a-boo gradient effect to hint at scrollability */
.rpls-trending-buttons-scroll-wrapper.is-scrollable::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 40px;
	background: linear-gradient(to right, rgba(255, 255, 255, 0), #ffffff 80%);
	pointer-events: none; /* Allow clicks to pass through */
	transition: opacity 0.3s ease-in-out;
	opacity: 1;
}

.rpls-trending-buttons-scroll-wrapper.has-scrolled::after {
	opacity: 0;
}

@keyframes rpls-peek-a-boo {
	0%, 100% { transform: translateX(0); }
	50% { transform: translateX(-25px); }
}

.rpls-trending-buttons-scroll-wrapper.is-peeking .rpls-trending-buttons {
	animation: rpls-peek-a-boo 1.5s ease-in-out;
}

.rpls-advanced-toggle-button {
	margin-left: auto; /* Push to the far right */
	padding: 6px;
	line-height: 1;
	min-width: auto;
	background: transparent;
	border: 1px solid #dcdcde;
	border-radius: 50%; /* Circular shape */
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.rpls-advanced-toggle-button svg {
	width: 20px;
	height: 20px;
	fill: #50575e; /* WordPress gray */
	transition: fill 0.2s ease;
}

.rpls-advanced-toggle-button:hover,
.rpls-advanced-toggle-button.is-active {
	background-color: #f0f0f1;
	border-color: #949494;
}

.rpls-advanced-toggle-button.is-active svg {
	fill: #2271b1; /* WordPress blue */
}

.rpls-date-filters-wrapper,
.rpls-filter-actions {
	display: contents; /* On desktop, these wrappers have no visual effect */
}

.rpls-date-toggle-button {
	display: none; /* Hide the mobile toggle button on desktop */
}

.rpls-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rpls-filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.rpls-filter-search {
    flex-grow: 1;
    min-width: 200px;
}

.rpls-accordion-filters input[type="search"],
.rpls-accordion-filters select,
.rpls-accordion-filters input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    height: 38px;
}

.rpls-accordion-filters button {
    padding: 8px 20px;
    border: 1px solid #ed1c24;
    background-color: #ed1c24;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    height: 38px;
}

.rpls-accordion-filters button:hover {
    background-color: #1b1b1b;
    border-color: #181818;
}

/* Obsolete reaction icon styles removed for clarity. */

/* Reaction Button Styles (at bottom of content) */
.rpls-reaction-container {
    margin-top: 0px;
    text-align: right;
}

.rpls-reaction-container .rpls-reaction-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    padding: 5px 12px;
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.rpls-reaction-container .rpls-reaction-button:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.rpls-reaction-container .rpls-reaction-icon {
    font-size: 1.2em;
}

/* Accordion Footer Styles */
.rpls-accordion-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.rifnote-readmore-button {
    display: none !important;
    background-color: #ed1c24;
    color: #fff;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.2s ease-in-out;
}

.rpls-accordion-footer-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

.rpls-trash-post-button {
	background: none;
	border: none;
	cursor: pointer;
	color: #a0a5aa;
	font-size: 14px;
	padding: 4px;
	line-height: 1;
	transition: color 0.2s ease-in-out;
}

.rpls-trash-post-button:hover {
	color: #d63638; /* A more vibrant red */
}

.rpls-edit-post-link {
	display: inline-block;
	background: none;
	border: none;
	cursor: pointer;
	color: #a0a5aa;
	font-size: 14px;
	padding: 4px;
	line-height: 1;
	transition: color 0.2s ease-in-out;
}

.rpls-edit-post-link:hover {
	color: #0073aa; /* A more vibrant blue */
}


.rifnote-readmore-button:hover {
    background-color: #1e639a;
}

.rpls-refresh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    background-color: #f6f7f7;
    cursor: pointer;
    transition: border-color 0.2s ease-in-out;
}

.rpls-refresh-button svg {
    width: 18px;
    height: 18px;
}

.rpls-refresh-button.is-loading svg {
    animation: rpls-spin 1s linear infinite;
}

/* === Mobile Styles === */
@media screen and (max-width: 782px) {
    .rpls-filter-actions {
        gap: 10px;
    }

    .rpls-date-toggle-button,
    .rpls-refresh-button {
        flex-grow: 1;
    }

    .rpls-filter-submit {
        flex-grow: 1;
        flex-shrink: 1;
    }
    
    /* Make filters stack vertically for better usability */
    .rpls-accordion-filters {
        flex-direction: column;
        align-items: stretch;
        position: static; /* Make filter bar scroll with the page on mobile */
        box-shadow: none;
        margin-bottom: 25px;
    }

    /* On mobile, only the date heading is sticky */
    .rpls-date-group-heading {
        /* Stick just below the admin bar, as the filter bar is no longer sticky */
        top: var(--rpls-admin-bar-offset);
        position: -webkit-sticky;
        position: sticky;
        /* Stick below the admin bar and the filter bar */
        top: calc(var(--rpls-admin-bar-offset) + var(--rpls-filter-bar-height));
        z-index: 99; /* Below the filter bar */
        box-shadow: none;
    }

    .rpls-date-filters-wrapper {
        display: none; /* Hide date inputs by default on mobile */
        width: 100%;
    }

    .rpls-filter-actions {
        display: flex;
        width: 100%;
        gap: 15px;
    }

    .rpls-date-toggle-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        flex-grow: 1;
        padding: 8px 12px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 14px;
        font-weight: 600;
        background-color: #f6f7f7;
        cursor: pointer;
        transition: border-color 0.2s ease-in-out;
    }

    .rpls-date-toggle-button.is-active {
        border-color: var(--rpls-theme-color);
    }

    .rpls-filter-submit {
        flex-shrink: 0;
    }

    /* Adjust accordion footer to stack buttons */
    .rpls-accordion-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

	.rpls-accordion-footer-actions {
		/* Push the admin actions to the far right on the same line as comments */
		margin-left: auto;
	}


    .rpls-reaction-container {
        width: 100%; /* Make it take full width to align right */
    }

    /* Slightly reduce main title font size for better readability on small screens */
    .rpls-accordion-trigger {
        font-size: 16px;
    }

    .rifnote-readmore-button{
        display: none !important;
    }

	/* Default mobile padding for trending buttons (font-size is now controlled by settings) */
	.rpls-trending-buttons .rpls-trending-button {
		padding: 5px 10px;
	}
}

/* --- Mobile Floating Share Buttons --- */
@media (max-width: 767px) {
	.rpls-share-mobile-float {
		/* On mobile, hide the label and position the container */
		position: fixed;
		top: 50%;
		right: 0; /* Changed from left to right */
		transform: translateY(-50%);
		z-index: 1000;
		padding: 6px 5px; /* Adjusted horizontal padding */
		background-color: rgba(255, 255, 255, 0.7); /* Increased transparency */
		border: 1px solid rgba(224, 224, 224, 0.7); /* Matched border transparency */
		border-right: none; /* Changed from border-left */
		border-radius: 8px 0 0 8px; /* Changed border-radius */
		box-shadow: -2px 2px 8px rgba(0,0,0,0.1); /* Flipped box-shadow */
	}

	.rpls-share-mobile-float .rpls-social-share-label {
		display: none;
	}

	.rpls-share-mobile-float .rpls-social-share-list {
		/* Stack the icons vertically */
		flex-direction: column;
		gap: 8px; /* Reduced gap */
		padding-left: 5px;
	}

	.rpls-share-mobile-float .rpls-social-share-list a,
	.rpls-share-mobile-float .rpls-social-share-list button {
		/* Slightly smaller icons for the floating bar */
		width: 28px; /* Made smaller */
		height: 28px; /* Made smaller */
		font-size: 13px; /* Made smaller */
	}

	/* Override floating behavior when the share component is inside the hero */
	.rpls-share-mobile-float.is-in-hero {
		position: relative;
		transform: none;
		all: unset; /* Reset all inherited floating styles */
	}
}

/* --- Social Share Styles --- */
.rpls-social-share {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 15px;
	padding-top: 15px;
	border-top: 1px solid #f0f0f1;
}

.rpls-social-share-label {
	font-size: 14px;
	font-weight: 600;
	color: #50575e;
}

.rpls-social-share-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: 8px;
}

.rpls-social-share-list a {
	/* Base styles for all social share links */
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 4px;
	background-color: #f0f0f1;
	color: #50575e;
	font-size: 12px;
	text-decoration: none;
	transition: all 0.2s ease-in-out;
}

.rpls-social-share-list button.rpls-share-copy-link {
	/* Make the button look like the anchor tags */
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 4px;
	font-size: 12px;
	border: none;
	cursor: pointer;
	padding: 0;
	transition: all 0.2s ease-in-out;
	/* Brand color for copy link */
	background-color: #a0a5aa; /* A neutral gray */
	color: #ffffff;
}

.rpls-social-share-list button.rpls-share-copy-link:hover {
	background-color: #898e93;
}

/* Style for the "Copied!" feedback state */
.rpls-social-share-list button.rpls-share-copy-link.is-copied {
	width: auto; /* Allow it to expand for the text */
	padding: 0 12px;
	border-radius: 16px; /* Keep the pill shape */
	background-color: #4CAF50; /* A nice success green */
}

/* --- Brand-specific Social Colors --- */

.rpls-social-share-list .rpls-share-twitter {
	background-color: #1DA1F2;
	color: #ffffff;
}
.rpls-social-share-list .rpls-share-twitter:hover {
	background-color: #0d8ddb; /* Darker shade for hover */
}

.rpls-social-share-list .rpls-share-facebook {
	background-color: #1877F2;
	color: #ffffff;
}
.rpls-social-share-list .rpls-share-facebook:hover {
	background-color: #166fe5;
}

.rpls-social-share-list .rpls-share-whatsapp {
	background-color: #25D366;
	color: #ffffff;
}
.rpls-social-share-list .rpls-share-whatsapp:hover {
	background-color: #1ebe5a;
}

.rpls-social-share-list .rpls-share-email {
	background-color: #777777;
	color: #ffffff;
}
.rpls-social-share-list .rpls-share-email:hover {
	background-color: #555555;
}

/* --- Injected Hero Styles --- */
.rpls-injected-hero-wrapper {
	padding: 20px 15px;
	margin: 25px -15px; /* Use negative margin to break out of the container's padding */
	background-color: #f7f7f7;
	border-top: 1px solid #e9e9e9;
	border-bottom: 1px solid #e9e9e9;
}

/* --- Injected Hero Styles --- */
.rpls-injected-hero {
	position: relative;
	height: 450px; /* Match the main hero height */
	border-radius: 10px;
	overflow: hidden;
	margin: 0; /* Margin is now on the wrapper */
}

/* Add a gradient overlay to ensure text is readable */
.rpls-injected-hero::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 20%, rgba(0, 0, 0, 0) 70%);
	z-index: 1; /* Sit below the text overlay */
}

.rpls-injected-hero .rifnote-hero-background {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-size: cover;
	background-position: center;
	z-index: 0; /* Lower z-index to sit behind the ::before overlay */
	transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smooth transition for hover effect */
}

.rpls-injected-hero:hover .rifnote-hero-background {
	transform: scale(1.05); /* Subtle zoom effect on hover */
}

.rpls-injected-hero .rifnote-hero-overlay {
	display: flex;
	align-items: flex-end;
	justify-content: flex-start;
	padding: 20px;
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	top: 0;
	z-index: 2;
	transition: background-color 0.3s ease-in-out;
}

@media (max-width: 768px) {
	.rpls-injected-hero {
		height: 380px; /* A more reasonable height for tablets and large phones */
	}

	.rpls-injected-hero .rifnote-hero-overlay {
		flex-direction: column;
		align-items: flex-start;
		justify-content: flex-end;
	}

    /* When the filter layout is wrapped on mobile, adjust the sticky top position */
	.rpls-filter-layout--wrap + .rpls-accordion-list-container .rpls-date-group-heading,
	.rpls-filter-layout--wrap + .rpls-accordion-list-container .rpls-date-group-heading.is-today-heading {
		top: calc(var(--rpls-admin-bar-offset) + var(--rpls-filter-bar-height) - 49px);
        z-index: 100 !important;
	}
}

@media (max-width: 480px) {
	.rpls-injected-hero {
		height: 300px; /* Further reduce height for small mobile screens */
	}
}

.rpls-injected-hero .rpls-injected-hero-summary {
	font-size: 1.2em;
	font-weight: bold;
	margin: 25px 0 15px 0;
	padding: 0;
	background-color: transparent;
}

.rpls-injected-hero-summary.is-icym {
	font-size: 1.2em;
	font-weight: bold;
	margin: 25px 0 15px 0;
	padding: 0;
	background-color: transparent;
}

.rifnote-hero-meta {
    flex-grow: 0 !important;
}