@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; }

:root{
    --accent: #256C40;
    --accent-soft: #9BBF91;
    --text: #143224;
    --muted: rgba(20, 50, 36, 0.55);
    --shadow: 0 12px 30px rgba(20, 50, 36, 0.12);
    --shadow-soft: 0 10px 22px rgba(20, 50, 36, 0.10);
}

body {
    margin: 0;
    font-family: "Inter", sans-serif;
    background: #ffffff;
    min-height: 100vh;
    padding: 20px 16px 100px;
}

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(circle at 20% 80%, rgba(155, 191, 145, 0.16) 0%, transparent 55%),
                      radial-gradient(circle at 80% 20%, rgba(37, 108, 64, 0.10) 0%, transparent 45%);
    pointer-events: none;
    z-index: 0;
}

body > * { position: relative; z-index: 1; }

.leaders-wrapper {
    max-width: 500px;
    margin: 0 auto;
}

.leaders-title {
    text-align: center;
    color: var(--text);
    font-size: 24px;
    margin: 0 0 20px;
}

.leaders-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: rgba(155, 191, 145, 0.22);
    border-radius: 14px;
    padding: 4px;
}

.leaders-tab-btn {
    flex: 1;
    padding: 14px 16px;
    min-height: 48px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.25s ease;
    position: relative;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}

.leaders-tab-btn:hover {
    background: rgba(255,255,255,0.6);
    color: var(--accent);
}

.leaders-tab-btn.active {
    background: white;
    color: var(--accent);
    box-shadow: 0 2px 12px rgba(20, 50, 36, 0.14);
}

.leaders-search-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border: 1px solid rgba(37, 108, 64, 0.16);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(20, 50, 36, 0.06);
}

.leaders-search-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 108, 64, 0.12);
}

.leaders-search-wrap i {
    color: var(--accent);
    font-size: 16px;
    flex-shrink: 0;
}

.leaders-search-btn {
    flex-shrink: 0;
}

.leaders-search {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
}

.leaders-search::placeholder {
    color: #999;
}

.leaders-search-btn {
    flex-shrink: 0;
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.leaders-search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 108, 64, 0.22);
}
.leaders-search-btn:active {
    transform: translateY(0);
}

.leaders-search-wrap {
    position: relative;
    margin-bottom: 16px;
}

.leaders-search {
    flex: 1;
    min-width: 0;
    padding: 12px 16px 12px 8px;
    border: none;
    border-radius: 0;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.leaders-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 108, 64, 0.10);
}

.leaders-search::placeholder {
    color: #999;
}

.leaders-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    opacity: 0.7;
    font-size: 16px;
}

.leaders-search-btn {
    padding: 10px 18px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
}
.leaders-search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 108, 64, 0.22);
}
.leaders-search-btn:active {
    transform: translateY(0);
}

.leaders-search-wrap .leaders-search-btn {
    flex-shrink: 0;
    min-width: 70px;
}

.leaders-tab-content {
    display: none;
}

.leaders-tab-content.active {
    display: block;
}

.leaders-list-container {
    padding: 8px 0;
}

/* Подиум – топ 3 ерекше дизайн */
.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 20px 0;
}

.podium-card {
    flex: 1;
    min-width: 0;
    background: white;
    border-radius: 16px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(37, 108, 64, 0.08);
    min-height: 144px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.podium-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.podium-card.rank-1 {
    order: 2;
    background: rgba(155, 191, 145, 0.32);
    box-shadow: var(--shadow);
    margin-bottom: 0;
    min-height: 160px;
}

.podium-card.rank-2 {
    order: 1;
    background: rgba(155, 191, 145, 0.22);
    box-shadow: var(--shadow-soft);
    min-height: 152px;
}

.podium-card.rank-3 {
    order: 3;
    background: rgba(155, 191, 145, 0.16);
    box-shadow: var(--shadow-soft);
    min-height: 144px;
}

.podium-card.rank-3 .leader-points,
.podium-card.rank-3 .leader-name { color: inherit; }

.podium-medal {
    font-size: 32px;
    line-height: 1;
}

/* Podium ішінде: аватар + ат + (ұпай + профиль батырма) */
.podium-avatar{
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(37,108,64,0.28);
    box-shadow: 0 10px 20px rgba(20, 50, 36, 0.16);
}
.podium-avatar img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.podium-name{
    width: 100%;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
}

.podium-bottom-row{
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.podium-points{
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.leader-info {
    flex: 1;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.leader-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(37,108,64,0.25);
}

.leader-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.leader-text {
    flex: 1;
    min-width: 0;
}

.leader-profile-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(37,108,64,0.18);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.leader-profile-btn .material-symbols-outlined {
    font-size: 18px;
    color: var(--accent);
}

.leader-profile-btn:active {
    transform: translateY(1px);
}

.leader-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px;
    overflow-wrap: anywhere;
}

.leader-points {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 4px;
}

.leader-points .fa-fire-alt,
.podium-points .fa-fire-alt{
    color: #ff6b35;
    font-size: 14px;
}

/* Қалған тізім */
.leaders-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leader-card {
    background: white;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 16px rgba(20, 50, 36, 0.10);
    border: 1px solid rgba(37, 108, 64, 0.08);
}

.leader-card .leader-rank {
    width: 32px;
    font-weight: 700;
    color: #666;
    font-size: 15px;
}

.leader-card .leader-info { flex: 1; min-width: 0; }
.leader-card .leader-name { font-size: 15px; margin: 0; }
.leader-card .leader-points { font-size: 16px; font-weight: 600; }

/* Барлығы тізіміндегі ұзын аттарды қысу */
.leader-card .leader-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
}

.leader-card .leader-points {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ескі podium leader-info стильдерін сөндіру (қазір жеке блоктар) */
.podium-card .leader-info,
.podium-card .leader-avatar,
.podium-card .leader-text,
.podium-card .leader-name,
.podium-card .leader-points { all: unset; }

.add-friend-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.add-friend-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 108, 64, 0.22);
}
.add-friend-btn:active {
    transform: translateY(0);
}

.podium-card {
    position: relative;
}
.podium-card .add-friend-btn {
    margin-top: 8px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(20, 50, 36, 0.08);
}

/* Дос профилі модалы */
.friend-modal.hidden {
    display: none;
}

.friend-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.friend-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
}

.friend-modal-card {
    position: relative;
    z-index: 51;
    width: 100%;
    max-width: 420px;
    margin: 0 16px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(20, 50, 36, 0.4);
    padding: 56px 20px 20px;
    text-align: center;
}

.friend-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    border: none;
    background: rgba(255,255,255,0.9);
    border-radius: 999px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.friend-avatar-wrap {
    width: 96px;
    height: 96px;
    margin: 0 auto 10px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(37,108,64,0.3);
    box-shadow: 0 8px 20px rgba(20, 50, 36, 0.25);
}

.friend-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.friend-profile-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}

.friend-profile-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 16px;
}

.friend-stats-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 18px;
}

.friend-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.friend-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.friend-stat-label {
    font-size: 12px;
    color: var(--muted);
}

.friend-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.friend-primary-btn,
.friend-secondary-btn {
    padding: 10px 18px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.friend-primary-btn {
    border: none;
    background: var(--accent);
    color: white;
}

.friend-secondary-btn {
    border: 1px solid rgba(37,108,64,0.18);
    background: #ffffff;
    color: var(--accent);
}

.bottom-nav {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 88%;
    max-width: 420px;
    height: 64px;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(20, 50, 36, 0.12);
    border-radius: 20px;
    border: 1px solid rgba(37, 108, 64, 0.08);
}

.bottom-nav a {
    text-decoration: none;
    color: var(--accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
}

.bottom-nav a:hover, .bottom-nav a.active { color: var(--accent); }
