/* ================================
   STEPsART — RANK
   Based on Home UI
   ================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "SF Pro Text",
        "Helvetica Neue",
        Helvetica,
        Arial,
        sans-serif;

    background: #F5FAFA;
    color: #302B3D;
}

button {
    font: inherit;
    border: none;
    cursor: pointer;
}

a {
    text-decoration: none;
    color: inherit;
}


/* ================================
   MAIN APP
   ================================ */

.rank-screen {
    width: 100%;
    max-width: 430px;

    min-height: 100vh;

    margin: auto;

    padding: 28px 20px 95px;
}


/* ================================
   HEADER
   ================================ */

.rank-header {
    background: transparent;
    color: #302B3D;

    padding: 0;

    border-radius: 0;
}


/* BRAND */

.rank-header .brand {
    font-size: 28px;

    font-weight: 800;

    letter-spacing: -1px;

    color: #302B3D;
}


/*
   Kalau mau persis seperti Home:
   STEPsART → bagian "s" bisa dibuat purple
   nanti bisa kita ubah HTML-nya.
*/


/* ================================
   STATUS
   ================================ */

.status {
    display: none;
}


/* ================================
   TITLE
   ================================ */

.rank-title-row {
    display: flex;

    justify-content: space-between;
    align-items: center;

    margin-top: 30px;
}

.rank-title-row h1 {
    font-size: 24px;

    line-height: 1.2;

    font-weight: 800;
}

.rank-title-row p {
    margin-top: 5px;

    color: #72608B;

    font-size: 13px;
}


/* ================================
   SETTINGS BUTTON
   ================================ */

.settings-shortcut {
    width: 40px;
    height: 40px;

    border-radius: 13px;

    background: #FFFFFF;

    color: #72608B;

    border: 1px solid #E5EEEE;

    display: grid;
    place-items: center;

    font-size: 17px;

    box-shadow:
        0 5px 15px rgba(48, 43, 61, 0.05);
}


/* ================================
   YOUR POSITION CARD
   ================================ */

.position-card {
    margin-top: 20px;

    padding: 24px;

    border-radius: 24px;

    background: #302B3D;

    color: #FFFFFF;

    display: flex;

    justify-content: space-between;
    align-items: center;

    box-shadow:
        0 10px 25px rgba(48, 43, 61, 0.12);
}


/* ================================
   POSITION INFO
   ================================ */

.position-info {
    min-width: 0;
}


/* LABEL */

.position-card small {
    display: block;

    font-size: 13px;

    opacity: 0.75;

    margin-bottom: 5px;
}


/* RANK */

.position-card strong {
    display: block;

    font-size: 42px;

    font-weight: 800;

    letter-spacing: -1px;

    line-height: 1.1;
}


/* STEPS */

.position-info > span {
    display: block;

    margin-top: 4px;

    font-size: 12px;

    opacity: 0.72;
}


/* ================================
   PROFILE DI YOUR POSITION
   ================================ */

.position-profile {
    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    min-width: 92px;

    text-align: center;
}


/* ================================
   PROFILE AVATAR
   ================================ */

.rank-profile-avatar {
    width: 54px;
    height: 54px;

    border-radius: 50%;

    /* Default jika belum ada foto */
    background-color: #8B7AB8;

    color: #FFFFFF;

    display: flex;

    align-items: center;
    justify-content: center;

    font-size: 19px;

    font-weight: 800;

    border: 2px solid rgba(255, 255, 255, 0.85);

    /* PENTING UNTUK FOTO */
    background-image: none;

    background-size: cover;

    background-position: center center;

    background-repeat: no-repeat;

    overflow: hidden;

    flex-shrink: 0;

    position: relative;
}


/*
   Jika JS memberikan foto sebagai
   background-image, warna avatar
   tidak boleh menutup foto.
*/

.rank-profile-avatar[style*="background-image"] {
    color: transparent;
}


/* ================================
   TROPHY
   ================================ */

.position-trophy {
    margin-top: 5px;

    font-size: 17px;

    line-height: 1;
}


/* ================================
   RANK STATUS
   ================================ */

#rankGap {
    display: block;

    margin-top: 5px;

    color: rgba(255, 255, 255, 0.72);

    font-size: 11px;

    line-height: 1.3;

    opacity: 1;
}


/* ================================
   RANK CONTENT
   ================================ */

.rank-content {
    margin-top: 22px;

    padding: 0;
}


/* ================================
   PERIOD TABS
   ================================ */

.period-tabs {
    display: flex;

    gap: 6px;

    background: transparent;

    padding: 0;
}

.period-tabs button {
    flex: 1;

    height: 38px;

    border-radius: 12px;

    background: #FFFFFF;

    border: 1px solid #E5EEEE;

    color: #A090AE;

    font-size: 12px;

    font-weight: 600;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.period-tabs button.active {
    background: #8B7AB8;

    border-color: #8B7AB8;

    color: #FFFFFF;
}


/* ================================
   LEADERBOARD CARD
   ================================ */

.leaderboard {
    margin-top: 14px;

    background: #FFFFFF;

    border: 1px solid #E5EEEE;

    border-radius: 22px;

    padding: 8px 14px;

    box-shadow:
        0 6px 18px rgba(48, 43, 61, 0.06);
}


/* ================================
   RANK ROW
   ================================ */

.rank-row {
    display: grid;

    grid-template-columns:
        30px
        40px
        1fr
        auto;

    align-items: center;

    gap: 9px;

    min-height: 64px;

    border-bottom: 1px solid #E5EEEE;
}

.rank-row:last-child {
    border-bottom: none;
}


/* ================================
   YOUR ROW
   ================================ */

.rank-row.you {
    background: #F2EFF8;

    border-radius: 14px;

    padding: 0 9px;

    margin: 4px 0;
}


/* ================================
   MEDAL / RANK NUMBER
   ================================ */

.rank-row > b:first-child {
    text-align: center;

    font-size: 12px;

    color: #72608B;
}


/* ================================
   AVATAR
   ================================ */

.rank-avatar {
    width: 36px;
    height: 36px;

    border-radius: 50%;

    /* Default avatar */
    background-color: #EEEAF5;

    color: #72608B;

    display: grid;
    place-items: center;

    font-size: 11px;

    font-weight: 800;

    /* Untuk foto */
    background-image: none;

    background-size: cover;

    background-position: center center;

    background-repeat: no-repeat;

    overflow: hidden;

    flex-shrink: 0;
}


/*
   Kalau rank.js memasukkan foto,
   teks inisial tidak ditampilkan.
*/

.rank-avatar[style*="background-image"] {
    color: transparent;
}


/* ================================
   USER INFO
   ================================ */

.rank-name b {
    display: block;

    color: #302B3D;

    font-size: 11px;

    font-weight: 700;
}

.rank-name span {
    display: block;

    margin-top: 3px;

    color: #A090AE;

    font-size: 9px;
}


/* ================================
   STEP VALUE
   ================================ */

.rank-value {
    color: #302B3D;

    font-size: 10px;

    font-weight: 700;
}


/* ================================
   BOTTOM NAV
   ================================ */

.bottom-nav {
    position: fixed;

    z-index: 50;

    bottom: 0;
    left: 50%;

    transform: translateX(-50%);

    width: 100%;
    max-width: 430px;

    height: 70px;

    background: #FFFFFF;

    display: flex;

    justify-content: space-around;
    align-items: center;

    border-top: 1px solid #E5EEEE;
}


.nav-item {
    text-decoration: none;

    text-align: center;

    font-size: 12px;

    color: #A090AE;

    cursor: pointer;

    transition:
        color 0.2s ease;
}


.nav-icon {
    width: 23px;
    height: 23px;

    display: flex;

    align-items: center;
    justify-content: center;
}


.nav-icon svg {
    width: 23px;
    height: 23px;

    fill: none;

    stroke: currentColor;

    stroke-width: 1.7;

    stroke-linecap: round;
    stroke-linejoin: round;
}


.nav-item {
    color: #A090AE;

    text-decoration: none;
}


.nav-item.active {
    color: #8B7AB8;
}


.nav-item small {
    font-size: 10px;

    margin-top: 3px;
}


/* ================================
   DESKTOP
   ================================ */

@media (min-width: 600px) {

    .rank-screen {
        min-height: 850px;

        margin: 25px auto;

        border-radius: 28px;

        box-shadow:
            0 20px 60px rgba(48, 43, 61, 0.10);

        overflow: hidden;
    }

    .bottom-nav {
        bottom: 25px;

        border-radius: 20px;
    }

}


/* ================================
   DARK MODE
   ================================ */

body.dark {
    background: #302B3D;

    color: #FFFFFF;
}


/* TITLE */

body.dark .rank-title-row h1 {
    color: #FFFFFF;
}

body.dark .rank-title-row p {
    color: #C9C3D2;
}


/* SETTINGS */

body.dark .settings-shortcut {
    background: #3B3549;

    border-color: #514A60;

    color: #C9C3D2;
}


/* POSITION CARD */

body.dark .position-card {
    background: #3B3549;

    color: #FFFFFF;
}


/*
   PENTING:
   Jangan memberi background
   pada rank-profile-avatar di dark mode.

   Foto harus tetap menggunakan
   background-image dari JS.
*/

body.dark .rank-profile-avatar {
    background-color: #8B7AB8;

    border-color:
        rgba(255, 255, 255, 0.85);
}


/* LEADERBOARD */

body.dark .leaderboard {
    background: #3B3549;

    color: #FFFFFF;

    border-color: #514A60;
}


/* PERIOD TABS */

body.dark .period-tabs {
    background: transparent;
}


/* Tab yang tidak aktif */

body.dark .period-tabs button {
    background: #3B3549;

    color: #C9C3D2;

    border-color: #514A60;
}


/* Tab aktif */

body.dark .period-tabs button.active {
    background: #8B7AB8;

    border-color: #8B7AB8;

    color: #FFFFFF;
}


/* RANK ROW */

body.dark .rank-row {
    border-color: #514A60;
}


/* YOUR ROW */

body.dark .rank-row.you {
    background: #443D52;
}


/* USER NAME */

body.dark .rank-name b {
    color: #FFFFFF;
}


/* USER STEPS */

body.dark .rank-name span {
    color: #C9C3D2;
}


/* STEP VALUE */

body.dark .rank-value {
    color: #FFFFFF;
}


/*
   AVATAR USER LAIN

   Background hanya dipakai kalau
   user belum memiliki foto.
*/

body.dark .rank-avatar {
    background-color: #514A60;

    color: #FFFFFF;
}


/*
   Jika ada foto, jangan timpa
   background-image.
*/

body.dark .rank-avatar[style*="background-image"] {
    background-color: transparent;

    background-size: cover;

    background-position: center;

    background-repeat: no-repeat;

    color: transparent;
}


/* BOTTOM NAV */

body.dark .bottom-nav {
    background: #3B3549;

    border-top-color: #514A60;
}


/* ================================
   SMALL MOBILE
   ================================ */

@media (max-width: 360px) {

    .rank-screen {
        padding-left: 16px;

        padding-right: 16px;
    }

    .position-card {
        padding: 20px;
    }

    .position-card strong {
        font-size: 38px;
    }

    .rank-profile-avatar {
        width: 50px;

        height: 50px;
    }

    .position-profile {
        min-width: 82px;
    }

    .period-tabs {
        gap: 5px;
    }

}