:root{
    --primary-rgb: 164, 0, 255;
    --primary-color: rgba(var(--primary-rgb), 1);
    --primary-color-20: rgba(164, 0, 255, 0.2);
    --lightgrey: #ccc;
    --red-rgb: 220, 53, 69;

    --not-black: #666;

    --container-padding: 1rem;
}

#pageHeader.compact{
    padding-top: var(--section-padding);
    padding-bottom: var(--section-padding);
    min-height: 0;
}
#pageHeader.compact h1{
    font-weight: normal;
    font-size: clamp(1.5rem, 4vw, 3rem)
}


.instructionPanel{
    position: relative;
    z-index: 2;
    padding: 2rem;
    border-radius: 2rem;
    background: rgba(255,255,255,0.90);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-top: -2rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: 0 0 1px var(--purple), 0 4px 30px rgba(0, 0, 0, 0.1);
    font-size: 0.8rem;
}

.instructions{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(200px, 35vw, 400px), 1fr));
    margin: 2rem 0 0;
    row-gap: 2rem;
    counter-reset: step-counter; 
}

.instruction{
    position: relative;
    padding: 0 0.5rem;
}

.instruction::before{
    /* counter */
    counter-increment: step-counter;
    content: counter(step-counter);
    display: block;    
    width: 3rem;
    height: 3rem;
    line-height: 3rem;
    border-radius: 50%;
    margin: 0 auto 1rem auto;

    background: var(--purple);
    color: white;
    font-weight: bold;
    font-size: 1rem;

    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.5);
}



.instruction p{
    margin: 0;
}




#top100wrapper{
    width: 100%;
    height: 100%;
    padding-bottom: 2rem;
    min-height: 100vh;
    overflow: clip;
    background: white;
    position: relative;
    z-index: 101;

    font-size: 0.8rem;
    
}

.main-layout {
    margin: 0 auto;
}

.sticky-search {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 0;
    background: white;
    border-bottom: 2px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 0;
    width: 100%;
}


#customSearchContainer{
    position: relative;
}
#clearSearch{
    position: absolute;
    top: 50%;
    right: .5rem;
    transform: translateY(-50%);
    font-size: 1.5rem;
    width: 2rem;
    height: 2rem;
    line-height: 2rem;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    color: var(--not-black);
    cursor: pointer;
    user-select: none;
    border-radius: 50px;
    display: none;
}
#clearSearch:hover{
    color: black;
}   
#customSearch {
    width: 100%;
    display: block;
    padding: .75rem 1rem;
    line-height: 1;
    border: 2px solid var(--primary-color);
    border-radius: 25px;
    background: rgba(164, 0, 255, 10%);
    font-family: inherit;
    font-size: 16px;
}
#customSearch:hover{
    background: #fff;
}
#customSearch:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem var(--primary-color-20);
    background: #fff;
}






#topHeader {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
    font-size: 0.75rem;
}

#topPartnerLogo {
    display: none;
    width: 225px;
    /*max-width: 20%;*/
    object-fit: contain;
}
#topPartnerLogoMobile
{
    display: block;
    width: 225px;
    max-width: 100% ;
    height: auto;
    margin: 0 auto 1rem;
}

#resultInfo{
    display: flex;
    gap: 20px;
    color: var(--not-black);
}

#resultInfo div{
    display: inline-block;
}
                   
#resultInfo span{
    color: var(--purple);
    font-weight: bold;
}





/* Sticky bottom voting panel */
.voting-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255,255,255,85%);
    z-index: 1000;
    transform: translateY(calc(100% - 60px));
    transition: transform 0.3s ease;
    box-shadow: 0 -2px 50px rgba(255,255,255,0.8);
    line-height: 1.05;
}

.voting-panel::before{
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    
    background: linear-gradient(130deg, rgba(164, 0, 255, 20%), rgba(164, 0, 255, 10%), rgba(164, 0, 255, 20%) );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: -1;
}

.voting-panel.open {
    transform: translateY(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    cursor: pointer;
    height: 60px;
}


.panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: inherit;
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
}

.voting-panel .voteCountDisplay {
    background: var(--purple);
    color: white;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.8rem;

    font-weight: bold;
}
    
.voting-panel .voteCountDisplay.max-reached {
    /* styling for when vote limit is reached */
}

.panel-toggle {
    position: absolute;
    top: 20px;
    right: 15px;
    height: 1rem;
    width: 1rem;
    font-size: 1rem;
    transition: transform 0.3s ease;
    transform: rotate(180deg);
}

.voting-panel.open .panel-toggle {
    transform: rotate(90deg);
}

.voted-list {
    max-height: 80vh;

    overflow-y: auto;
    padding: 1rem 0;
}

.empty-votes {
    text-align: center;
    color: #6c757d;
    padding: 40px 20px;
}

.empty-votes p {
    margin: 0 0 8px 0;
    
}

.empty-votes small {
    
    opacity: 0.8;
}

.voted-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 6px;
    background: white;
    
}

.voted-item:hover {
    background: #e9ecef;
}

.vote-position {
    display: block;
    
    height: 1.5rem;
    width: 1.5rem;
    line-height: 1.6rem;
    text-align: center;

    background: var(--purple);
    color: white;
    border-radius: 50%;
    
    font-weight: bold;
    margin-right: 8px;

}

.voted-item.is-wildcard .vote-position {
    background: var(--green);
    color: var(--purple);
}


.voted-name {
    flex: 1;
    font-weight: bold;
    text-transform: uppercase;
}

.vote-controls {
    display: flex;
    gap: 8px;
}

.vote-control-btn {
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: .7;
}
.vote-control-btn:hover {
    opacity: .9;
}
.vote-control-btn:focus {
    opacity: 1;
}

.move-up,
.move-down {
    background: white;
    background: var(--primary-color-20);
    color: var(--purple);
   
}
.move-up::before,
.move-down::before {
    content: "";
    display: block;
    display: inline-block;
    position: relative;
    width: 40%;
    height: 40%;
    background: currentColor;
    mask: var(--arrow-mask);
    -webkit-mask: var(--arrow-mask);
    transform: rotate(45deg);
}

.move-up::before{
    transform: rotate(-135deg);
}

.move-up:not(:disabled):hover,
.move-down:not(:disabled):hover {
    opacity: 1;
    color: white;
    background: var(--purple);
}
.remove-vote {
    background: rgba(var(--red-rgb), .2);
    color: rgba(var(--red-rgb), 1);
    border-radius: 50%;
    font-size: 1rem;
    font-weight: bold;
}

.remove-vote:hover {
    background: rgba(var(--red-rgb), 1);
    color: white;
}

.vote-control-btn:disabled {
    opacity: 0;
    cursor: default;
}





.persons-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    column-gap: 10px;
    padding: 0;
}




/* Person card styling */
.person-card {
    position: relative;
    padding: 10px;
    background: white;
    transition: all 0.2s ease;
    cursor: default;
    height: 60px; /* Fixed height for uniform cards */
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    font-size: .8rem;
    gap: .5rem;


    line-height: 1.05;
}
.person-card::after {
    content: '';
    display: block;
    position: absolute;
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 1px;
    background: var(--lightgrey);
    transition: all 0.2s ease;
}

#top100wrapper:not(.no-voting) .person-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}
#top100wrapper:not(.no-voting) .person-card:hover::after {
    background: transparent;
}

.person-card picture {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}
.person-card picture > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.person-content{
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    
}
.person-name {
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: .2rem;
    
    /* maximim 2 lines */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    font-size: 90%;
}
.person-nicknames {
    color: var(--not-black);
    font-size: 90%;
    /* maximim 2 lines */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
   
    -webkit-line-clamp: 1;
    line-clamp: 1;
    /* dont break on whitespace */
    white-space: nowrap;
}
.person-alias{
    display: none;
}



/* Small vote button styling - positioned in top-right */
.vote-btn-small {
    
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 3rem;
    padding: .5rem 1rem;
    
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;

    font-size: inherit;
    font-weight: bold;
    text-transform: uppercase;
    flex-shrink: 0;
}

.vote-btn-small:hover:not(.disabled) {
    background: var(--primary-color);
    color: white;
}

.vote-btn-small.voted {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    width: 2rem;
    height: 2rem;
    padding: 0;
}


.vote-btn-small.disabled {
    filter: grayscale(0.5);
    cursor: not-allowed;
    opacity: 0.1;
}

/* Wildcard card styling */
.wildcard-card {
    position: relative;
    background: var(--green);
    cursor: pointer;
    margin: 0 10px;
    padding: 10px; /* Match person card padding */
    height: 60px; /* Match person card height */
    gap: .5rem; /* Match person card gap */
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    line-height: 1.05;
}

.wildcard-card:hover {
    border-color: var(--primary-color);
}

.wildcard-card.input-active {
    border-color: var(--primary-color);
    cursor: default;
    height: auto;
}

.wildcard-card.input-active:hover {
    transform: none;
}



.wildcard-icon {
    width: 44px;
    height: 50px;
    background: url('/assets/theme/img/wildcard-icon.png') no-repeat center center;
    background-size: contain;
    
}

.wildcard-text {
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: .2rem;
}

.wildcard-subtext {
    color: var(--not-black);
    font-size: 90%;
}

.wildcard-card.input-active{
    flex-direction: column;
    align-items: stretch;
    height: auto;
    gap: .5rem;
}

.wildcard-input {
    width: 100%;
    padding: .5rem 1rem;
    line-height: inherit;
    border: 2px solid var(--purple);
    border-radius: 50px;
    outline: none;
}

.wildcard-buttons {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
}

.wildcard-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 50px;
    
    cursor: pointer;
    transition: background-color 0.2s;
    text-transform: uppercase;
    font-weight: bold;

}

.wildcard-btn.confirm {
    background: black;
    color: white;
}

.wildcard-btn.confirm:hover {
    background: #218838;
}

.wildcard-btn.cancel {
    background: #6c757d;
    color: white;
}

.wildcard-btn.cancel:hover {
    background: #5a6268;
}

.highlight {
    background-color: yellow;
    font-weight: bold;
}

#submitContainer {
    padding: 0 1rem 1rem;
    text-align: center;
}
#submitVotes:disabled,
#submitVotes[aria-disabled="true"] {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}


.no-voting #searchSelection,
.no-voting .vote-btn-small,
.no-voting .voting-panel {
    display: none;
}


@media (hover: hover) and (pointer: fine) {
    .panel-header:hover {
        background: var(--purple);
        color: white;
    }
    .vote-btn-small.voted:hover {
        background: #dc3545;
        border-color: #dc3545;
        transform: scale(1.1);
    }
}


@media (max-width: 991px) {

    .instructionPanel
    {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    /*
    .instructions {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
    */
   

}


@media (min-width: 768px) {
    .persons-container {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
    #topPartnerLogo{
        display: block;
    }
    #topPartnerLogoMobile{
        display: none;
    }
    .voted-list {
        max-height: 300px;
    }
}
@media (min-width: 992px) {
    .instructions {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    .instruction {
        padding: 0 1rem;
    }
    .instruction::after{
        content: '';
        display: block;
        position: absolute;
        height: 2px;
        background-color: var(--purple);
        width: 100%;
        top: 1.5rem;
        left: 0;
        z-index: -1;
        
    }
    .instruction:first-child::after{
        width: 50%;
        left: 50%;
    }

    .instruction:last-child::after{
        width: 50%;
        left: 0;
    }

    
}

@media (min-width: 1200px) {
    .persons-container {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        column-gap: 30px;
        margin: 0 -20px;
    }
}


/* Responsive voting panel */
@media (max-width: 768px) {

   

    #resultInfo{
        width: 100%;
        flex-grow: 1;
        justify-content: space-between;
    }
}
