/**
 * TopList Manager Frontend Styles
 * @package TopList_Manager_ACF
 */

/* Base styles */
.toplist-container {
    --toplist-background: #ffffff;
    --toplist-logo-bg: #2f2f2f;
    --toplist-cta-bg: #2f2f2f;
    --toplist-cta-color: #ffffff;
    margin: 20px 0;
}

.toplist-title {
    font-weight: 700;
    margin-bottom: 15px;
    font-size: 24px;
    display: block;
}

.toplist-wrapper {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.toplist-item {
    background-color: var(--toplist-background);
    box-shadow: rgba(0, 0, 0, 0.15) 0px 2px 8px;
    border-radius: 3px;
    display: grid;
    grid-template-areas: "logo bonus usp rating cta";
    grid-template-columns: minmax(min-content, 180px) 1fr 1fr 100px 1fr;
    padding: 20px;
    gap: 25px;
}

.toplist-item.highlighted {
    border: 3px solid gold;
}

.image-wrapper {
    grid-area: logo;
}

.toplist-bonus-line {
    grid-area: bonus;
}

.toplist-usp-list {
    grid-area: usp;
}

.toplist-rating {
    grid-area: rating;
}

.toplist-cta {
    grid-area: cta;
}

/* Hidden buffered items */
.toplist-item.hidden {
    display: none;
}

/* Smooth fade-in animation */
.toplist-item.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Loading state */
.load-more-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Image wrapper
============================ */
.image-wrapper {
    text-align: center;
}

.image-inner-wrapper {
	display: flex;
	align-items: center;
    background: var(--toplist-logo-bg);
    max-width: max-content;
    transform: translateX(-20px);
}

.image-inner-wrapper img {
	max-width: 120px;
	height: auto;
	margin: 12px 24px;
}

.image-inner-wrapper span.position-num {
	font-size: 40px;
	font-weight: 700;
	line-height: 1;
	color: white;
	padding: 12px 24px;
	position: relative;
}

.image-inner-wrapper span.position-num::after {
	content: '';
	width: 1px;
	height: 60%;
	transform: translateY(30%);
	background-color: rgba(255, 255, 255, 0.2);
	position: absolute;
	top: 0;
	right: 0;
}

.image-wrapper a {
    display: block;
    line-height: 0;
}

/* .image-wrapper img {
    max-width: 100%;
    height: auto;
    max-height: 80px;
    padding: 10px;
    background: black;
    border-radius: 10px;
} */

.operator-header {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.9em;
    padding-left: 65px;
}

/* Bonus One Liner
============================ */
.toplist-bonus-line {
    font-weight: 700;
    font-size: 22px;
    line-height: 1.3;
    padding-top: 16px;
}

/* USPs
============================ */
.toplist-usp-list ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0;
    font-size: 16px;
}

.toplist-usp-list li {
    background-image:url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgaWQ9IlNWR1JlcG9fYmdDYXJyaWVyIiBzdHJva2Utd2lkdGg9IjAiPjwvZz48ZyBpZD0iU1ZHUmVwb190cmFjZXJDYXJyaWVyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvZz48ZyBpZD0iU1ZHUmVwb19pY29uQ2FycmllciI+IDxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMjEuMjI4NyA2LjYwMzU1QzIxLjYxOTMgNi45OTQwNyAyMS42MTkzIDcuNjI3MjMgMjEuMjI4NyA4LjAxNzc2TDEwLjI1NTkgMTguOTkwNkM5Ljg2Nzg4IDE5LjM3ODYgOS4yMzk2MiAxOS4zODE0IDguODQ4MTEgMTguOTk2OUwyLjY2MjU3IDEyLjkyMThDMi4yNjg1NSAxMi41MzQ5IDIuMjYyODQgMTEuOTAxNyAyLjY0OTgzIDExLjUwNzdMMy4zNTA1NCAxMC43OTQyQzMuNzM3NTMgMTAuNDAwMiA0LjM3MDY3IDEwLjM5NDUgNC43NjQ3IDEwLjc4MTVMOS41MzYxMyAxNS40Njc3TDE5LjEwNzQgNS44OTY0NEMxOS40OTc5IDUuNTA1OTIgMjAuMTMxMSA1LjUwNTkxIDIwLjUyMTYgNS44OTY0NEwyMS4yMjg3IDYuNjAzNTVaIiBmaWxsPSIjMDAwMDAwIj48L3BhdGg+IDwvZz48L3N2Zz4=");
    background-size: 18px;
    padding-left: 25px;
    background-repeat: no-repeat;
    background-position: left center;
}

.toplist-usp-list p {
    margin: 0;
}

/* Star Rating
============================ */
.rating-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: 16px;
}

.rating-wrapper .operator-header {
    display: none;
}

.star-rating {
    position: relative;
    line-height: 1;
}

.star-rating img {
    width: 16px;
    height: 16px;
}

.star-rating-empty {
    white-space: nowrap;
}

.star-rating-filled {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    overflow: hidden;
}

.star-rating-filled {
    white-space: nowrap;
    overflow: hidden;
}

.rating-number {
    font-size: 24px;
    color: #2f2f2f;
    font-weight: 700;
    line-height: 1;
}

/* CTA Button
============================ */
.toplist-cta {
    text-align: right;
    padding-top: 16px;
}

.toplist-cta-btn,
.load-more-btn.toplist-cta {
    text-decoration: none;
    padding: 10px 22px;
    font-weight: 700;
    font-size: 20px;
    background-color: var(--toplist-cta-bg);
    color: var(--toplist-cta-color);
    border-radius: 20px;
}

.load-more-wrapper {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
}

.load-more-btn.toplist-cta {
    cursor: pointer;
    border: 0;
}

@media screen and ( max-width: 900px) {
    .toplist-item {
        gap: 15px 0;
        grid-template-areas:
            "logo rating"
            "bonus bonus"
            "usp usp"
            "cta cta";
        grid-template-columns: 1fr 1fr;
    }

    .image-inner-wrapper span.position-num {
        font-size: 22px;
        padding: 8px 16px;
    }

    .image-inner-wrapper img {
        max-width: 100px;
        margin: 8px 16px;
    }

    .image-wrapper .operator-header {
        display: none;
    }

    .toplist-rating {
        display: flex;
        justify-content: flex-end;
    }

    .rating-wrapper {
        max-width: 100px;
        padding-top: 0;
        gap: 2px;
    }

    .rating-number {
        font-size: 18px;
    }

    .rating-wrapper .operator-header {
        display: block;
        margin: 0;
        padding: 0;
        font-size: 14px;
        line-height: 1;
    }

    .toplist-cta,
    .toplist-bonus-line {
        text-align: center;
        padding-top: 0;
    }

    .toplist-usp-list {
        display: flex;
        justify-content: center;
    }

    ul.usp {
        min-width: min-content;
    }

    ul.usp li {
        width: 100%;
    }
}