/* =========================================
   TOPPER ACHIEVERS SECTION
   MAHFOOZ ACADEMY
========================================= */

.topper-achievers {
    width: 100%;
    max-width: 100%;
    padding: 90px 20px;

    background: #ffffff;

    overflow-x: hidden;
    box-sizing: border-box;
}

.topper-achievers *,
.topper-achievers *::before,
.topper-achievers *::after {
    box-sizing: border-box;
}

.topper-achievers-container {
    width: 100%;
    max-width: 1200px;

    margin: 0 auto;
}


/* =========================================
   SECTION HEADING
========================================= */

.topper-section-heading {
    width: 100%;
    max-width: 700px;

    margin: 0 auto 40px;

    text-align: center;
}

.topper-section-heading span {
    display: inline-block;

    margin-bottom: 14px;

    color: #a17b32;

    font-size: 11px;
    font-weight: 800;
    letter-spacing: 3px;

    text-transform: uppercase;
}

.topper-section-heading h2 {
    margin: 0;

    color: #65182b;

    font-size: clamp(30px, 4vw, 52px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1px;
}

.topper-section-heading p {
    max-width: 550px;

    margin: 18px auto 0;

    color: #777777;

    font-size: 15px;
    line-height: 1.8;
}


/* =========================================
   RANK FILTERS
   FOUR BUTTONS IN ONE LINE
========================================= */

.topper-filters {
    padding-top: 10px;
    display: grid;

    grid-template-columns: repeat(4, minmax(0, 1fr));

    align-items: center;

    width: 100%;
    max-width: 700px;

    gap: 10px;

    margin: 0 auto 30px;

    overflow: hidden;
}

.topper-filter {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 100%;
    min-width: 0;
    max-width: 100%;

    gap: 6px;

    padding: 12px 8px;

    border: 1px solid #eadfe2;
    border-radius: 50px;

    outline: none;

    background: #ffffff;
    color: #65182b;

    font-family: inherit;
    font-size: 12px;
    font-weight: 700;

    white-space: nowrap;

    cursor: pointer;

    transition:
        background 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.topper-filter i {
    flex-shrink: 0;

    color: #a17b32;

    font-size: 12px;
}

.topper-filter:hover {
    border-color: #65182b;

    transform: translateY(-2px);
}

.topper-filter.active {
    border-color: #65182b;

    background: #65182b;
    color: #ffffff;

    box-shadow: 0 8px 20px rgba(101, 24, 43, 0.18);
}

.topper-filter.active i {
    color: #f1d18b;
}


/* =========================================
   CLASS FILTER CONTAINER
========================================= */

.topper-class-filter {
    display: flex;

    align-items: center;
    justify-content: center;

    flex-wrap: wrap;

    width: 100%;
    max-width: 100%;
    min-width: 0;

    gap: 12px;

    margin: 0 auto 40px;
    padding: 0 10px;

    text-align: center;
}

.topper-class-filter label {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 8px;

    max-width: 100%;

    color: #65182b;

    font-size: 13px;
    font-weight: 700;

    white-space: nowrap;
}

.topper-class-filter label i {
    color: #a17b32;
}


/* =========================================
   CUSTOM DROPDOWN
========================================= */

.custom-class-dropdown {
    position: relative;

    width: 260px;
    max-width: 100%;
    min-width: 0;

    z-index: 100;
}


/* =========================================
   SELECTED DROPDOWN BUTTON
========================================= */

.custom-class-selected {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    width: 100%;
    min-width: 0;
    height: 44px;

    padding: 0 14px;

    border: 1px solid #cdaab5;
    border-radius: 10px;

    outline: none;

    background: #ffffff;
    color: #65182b;

    font-family: inherit;
    font-size: 13px;
    font-weight: 700;

    text-align: left;

    cursor: pointer;

    transition:
        border-color 0.3s ease,
        box-shadow 0.3s ease,
        background 0.3s ease;
}

.custom-class-selected span {
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-class-selected i {
    flex-shrink: 0;

    color: #a17b32;
    font-size: 11px;

    transition: transform 0.3s ease;
}

.custom-class-dropdown.open
.custom-class-selected {
    border-color: #65182b;

    box-shadow: 0 0 0 3px rgba(101, 24, 43, 0.10);
}

.custom-class-dropdown.open
.custom-class-selected i {
    transform: rotate(180deg);
}


/* =========================================
   DROPDOWN OPTIONS BOX
========================================= */

.custom-class-options {
    position: absolute;

    top: calc(100% + 7px);
    left: 0;

    display: none;

    width: 100%;
    max-width: 100%;
    max-height: 230px;

    overflow-y: auto;

    padding: 6px;

    border: 1px solid #d5b6bf;
    border-radius: 10px;

    background: #ffffff;

    box-shadow: 0 14px 35px rgba(75, 23, 38, 0.18);

    animation: topperDropdownOpen 0.2s ease;
}

.custom-class-dropdown.open
.custom-class-options {
    display: block;
}


/* =========================================
   DROPDOWN OPTION
========================================= */

.custom-class-option {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    width: 100%;

    padding: 12px 13px;

    border: none;
    border-radius: 7px;

    outline: none;

    background: transparent;
    color: #65182b;

    font-family: inherit;
    font-size: 13px;
    font-weight: 600;

    text-align: left;

    cursor: pointer;

    transition:
        background 0.25s ease,
        color 0.25s ease;
}

.custom-class-option span {
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-class-option > i {
    display: none;

    flex-shrink: 0;

    color: #f1d18b;
}

.custom-class-option:hover {
    background: #f7e9ed;
    color: #65182b;
}

.custom-class-option.active {
    background: #65182b;
    color: #ffffff;
}

.custom-class-option.active > i {
    display: block;
}


/* =========================================
   DROPDOWN SCROLLBAR
========================================= */

.custom-class-options::-webkit-scrollbar {
    width: 5px;
}

.custom-class-options::-webkit-scrollbar-track {
    background: #f7eef1;
}

.custom-class-options::-webkit-scrollbar-thumb {
    background: #9b5267;
    border-radius: 10px;
}


/* =========================================
   TOPPER CARDS GRID
========================================= */

.topper-cards-grid {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    width: 100%;

    gap: 28px;
}


/* =========================================
   TOPPER CARD
========================================= */

.topper-card {
    width: 100%;
    min-width: 0;

    overflow: hidden;

    border: 1px solid #eee4e6;
    border-radius: 22px;

    background: #ffffff;

    box-shadow: 0 10px 35px rgba(75, 23, 38, 0.07);

    animation: topperCardShow 0.4s ease both;

    transition:
        transform 0.35s ease,
        box-shadow 0.35s ease;
}

.topper-card:hover {
    transform: translateY(-8px);

    box-shadow: 0 18px 45px rgba(75, 23, 38, 0.15);
}


/* =========================================
   CARD IMAGE
========================================= */

.topper-card-image {
    position: relative;

    width: 100%;
    height: 300px;

    overflow: hidden;

    background: #f5edf0;
}

.topper-card-image img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
    object-position: center top;

    transition: transform 0.5s ease;
}

.topper-card:hover
.topper-card-image img {
    transform: scale(1.06);
}


/* =========================================
   IMAGE OVERLAY
========================================= */

.topper-image-overlay {
    position: absolute;

    inset: 0;

    z-index: 1;

    background: linear-gradient(
        to top,
        rgba(45, 10, 22, 0.48),
        transparent 55%
    );

    pointer-events: none;
}


/* =========================================
   RANK BADGE
========================================= */

.topper-rank-badge {
    position: absolute;

    left: 18px;
    bottom: 18px;

    z-index: 2;

    display: inline-flex;

    align-items: center;

    gap: 8px;

    max-width: calc(100% - 36px);

    padding: 9px 14px;

    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50px;

    background: rgba(101, 24, 43, 0.94);
    color: #ffffff;

    font-size: 12px;
    font-weight: 700;

    white-space: nowrap;

    backdrop-filter: blur(8px);
}

.topper-rank-badge i {
    flex-shrink: 0;

    color: #f1d18b;
}


/* =========================================
   CARD CONTENT
========================================= */

.topper-card-content {
    width: 100%;

    padding: 25px 24px 24px;
}

.topper-class {
    display: inline-block;

    margin-bottom: 10px;

    color: #a17b32;

    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;

    text-transform: uppercase;
}

.topper-card-content h3 {
    min-height: 27px;

    margin: 0;

    color: #4b1726;

    font-size: 21px;
    font-weight: 800;
    line-height: 1.3;

    overflow-wrap: anywhere;
}

.topper-card-divider {
    width: 100%;
    height: 1px;

    margin: 21px 0;

    background: #eee3e6;
}


/* =========================================
   CARD BOTTOM
========================================= */

.topper-card-bottom {
    display: flex;

    align-items: flex-end;
    justify-content: space-between;

    gap: 15px;

    width: 100%;
}

.topper-info {
    display: flex;

    flex-direction: column;

    gap: 6px;

    min-width: 0;
}

.topper-info small {
    color: #999999;

    font-size: 11px;
    font-weight: 600;
}

.topper-info strong {
    color: #65182b;

    font-size: 20px;
    font-weight: 800;

    overflow-wrap: anywhere;
}

.topper-year {
    text-align: right;
}

.topper-year strong {
    color: #a17b32;

    font-size: 13px;
}


/* =========================================
   HIDDEN CARDS
========================================= */

.topper-card.is-hidden {
    display: none !important;
}


/* =========================================
   EMPTY MESSAGE
========================================= */

.topper-empty {
    padding: 35px 20px;

    color: #777777;

    font-size: 15px;
    text-align: center;
}


/* =========================================
   ANIMATIONS
========================================= */

@keyframes topperCardShow {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes topperDropdownOpen {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =========================================
   TABLET
========================================= */

@media (max-width: 991px) {

    .topper-achievers {
        padding: 75px 20px;
    }

    .topper-filters {
        max-width: 620px;
        gap: 8px;
    }

    .topper-filter {
        gap: 5px;
        padding: 11px 6px;
        font-size: 11px;
    }

    .topper-class-filter {
        margin-bottom: 35px;
    }

    .custom-class-dropdown {
        width: 240px;
    }

    .topper-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 22px;
    }

    .topper-card-image {
        height: 290px;
    }
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 600px) {

    .topper-achievers {
        padding: 55px 12px;
    }


    /* Heading */

    .topper-section-heading {
        margin-bottom: 30px;
    }

    .topper-section-heading span {
        font-size: 9px;
        letter-spacing: 2px;
    }

    .topper-section-heading h2 {
        font-size: 32px;
        letter-spacing: -0.5px;
    }

    .topper-section-heading p {
        margin-top: 14px;

        font-size: 13px;
        line-height: 1.7;
    }


    /* Rank buttons */

    .topper-filters {
        grid-template-columns: repeat(4, minmax(0, 1fr));

        width: 100%;
        max-width: 100%;

        gap: 5px;

        margin-bottom: 25px;
    }

    .topper-filter {
        gap: 3px;

        padding: 10px 2px;

        border-radius: 30px;

        font-size: 9px;
        letter-spacing: -0.3px;
    }

    .topper-filter i {
        font-size: 9px;
    }


    /* Class filter */

    .topper-class-filter {
        flex-direction: column;
        align-items: center;

        width: 100%;
        max-width: 100%;

        gap: 9px;

        margin-bottom: 30px;
        padding: 0;
    }

    .topper-class-filter label {
        font-size: 12px;
    }

    .custom-class-dropdown {
        width: 100%;
        max-width: 100%;
    }

    .custom-class-selected {
        height: 44px;

        padding: 0 13px;

        border-radius: 9px;

        font-size: 13px;
    }

    .custom-class-options {
        max-height: 210px;
    }

    .custom-class-option {
        padding: 11px 12px;

        font-size: 13px;
    }


    /* Cards */

    .topper-cards-grid {
        grid-template-columns: minmax(0, 1fr);

        width: 100%;
        max-width: 390px;

        margin: 0 auto;

        gap: 22px;
    }

    .topper-card-image {
        height: 330px;
    }

    .topper-card-content {
        padding: 23px 21px;
    }

    .topper-card-content h3 {
        font-size: 20px;
    }
}


/* =========================================
   SMALL MOBILE
========================================= */

@media (max-width: 380px) {

    .topper-achievers {
        padding: 45px 8px;
    }

    .topper-filters {
        gap: 3px;
    }

    .topper-filter {
        gap: 2px;

        padding: 9px 1px;

        font-size: 8px;
        letter-spacing: -0.5px;
    }

    .topper-filter i {
        font-size: 8px;
    }

    .custom-class-selected {
        height: 42px;
        font-size: 12px;
    }

    .custom-class-option {
        font-size: 12px;
    }

    .topper-card-image {
        height: 290px;
    }

    .topper-card-bottom {
        gap: 10px;
    }
}


/* =========================================
   EXTRA SMALL MOBILE
========================================= */

@media (max-width: 330px) {

    .topper-achievers {
        padding: 40px 6px;
    }

    .topper-filters {
        gap: 2px;
    }

    .topper-filter {
        gap: 1px;

        padding: 8px 0;

        font-size: 7px;
        letter-spacing: -0.6px;
    }

    .topper-filter i {
        font-size: 7px;
    }

    .custom-class-selected {
        font-size: 11px;
    }
}