/* Профиль — без нижнего меню, меньше отступ снизу (как VPN/referral) */
.profile-bottom-padding {
    padding-bottom: 20px;
}

/* Первая секция (Авторизация) — без верхнего отступа */
.profile-section-header:first-child,
.col-md-12.profile-section-header[style*="margin-top:0"] {
    margin-top: 0 !important;
}

/* Отступ перед любым заголовком секции, кроме самого первого */
.profile-achievements-wrap + .col-md-12.profile-section-header,
.card + .col-md-12.profile-section-header,
#profile-web-logout-wrap + .col-md-12.profile-section-header {
    margin-top: 24px;
}

/* Достижения всегда с отступом, когда есть предшествующий контент */
.profile-achievements-header {
    margin-top: 24px;
}

/* Достижения — 4 в ряд, шеврон у текста, вся строка кликабельна */
.profile-achievements-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 0;
    margin: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    text-align: left;
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.profile-achievements-header:hover,
.profile-achievements-header:focus {
    color: inherit;
    outline: none;
}

.profile-achievements-header h2 {
    margin: 0;
}

.profile-achievements-chevron {
    margin-top: 10px;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
    transition: transform 0.3s ease, color 0.2s;
}

.profile-achievements-header:hover .profile-achievements-chevron {
    color: rgba(255, 255, 255, 0.9);
}

.profile-achievements-header.is-expanded .profile-achievements-chevron {
    transform: rotate(180deg);
}

.profile-achievements-wrap {
    position: relative;
    margin-bottom: 20px;
    overflow: hidden;
}

.profile-achievements-inner {
    position: relative;
    max-height: 135px;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Развёрнутая высота задаётся через JS */
.profile-achievements-wrap.is-expanded .profile-achievements-inner {
    max-height: none;
}

.profile-achievements-wrap.is-expanded .profile-achievements-veil {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

/* Пелена с градиентом: прибита снизу, высота строго = COLLAPSED_HEIGHT */
.profile-achievements-veil {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 135px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 48px;
    background: linear-gradient(to bottom, transparent 0%, rgba(18, 20, 23, 0.55) 40%, rgba(18, 20, 23, 0.97) 100%);
    cursor: pointer;
    z-index: 2;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

.profile-achievements-veil::after {
    content: 'Кликните, чтобы раскрыть';
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
}

.profile-achievements-wrap.veil-text-hidden .profile-achievements-veil::after {
    opacity: 0;
    visibility: hidden;
}

/* Locked achievements state */
.profile-achievements--locked {
    position: relative;
}

.profile-achievements--locked .profile-achievements-inner {
    filter: blur(6px);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.profile-achievements--locked .profile-achievements-veil {
    display: none;
}

.profile-achievements-coming-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    pointer-events: none;
}

.profile-achievements-coming-overlay i {
    font-size: 24px;
    opacity: 0.7;
}

.profile-achievements-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* Блок достижения — стиль значка/трофея */
.profile-achievement-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 8px;
    cursor: pointer;
    overflow: hidden;
    border-radius: 16px;
    background: #1a1d22;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s;
}

.profile-achievement-tile:active {
    transform: scale(0.96);
}

.profile-achievement-tile:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Выполнено — золотисто-зелёный акцент */
.profile-achievement-tile[data-status="done"] {
    background: linear-gradient(165deg, #1e2620 0%, #1a1d22 100%);
    border-color: rgba(67, 181, 129, 0.3);
}

.profile-achievement-tile[data-status="done"]::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: #43b581;
    border-radius: 50%;
}

.profile-achievement-tile[data-status="done"]:hover {
    border-color: rgba(67, 181, 129, 0.5);
    box-shadow: 0 8px 24px rgba(67, 181, 129, 0.2);
}

/* В процессе — приглушённый */
.profile-achievement-tile[data-status="pending"] {
    opacity: 0.92;
}

.profile-achievement-tile[data-status="pending"]:hover {
    opacity: 1;
}

.profile-achievement-tile__ring {
    position: relative;
    z-index: 1;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.profile-achievement-tile[data-status="done"] .profile-achievement-tile__ring {
    background: linear-gradient(145deg, #43b581 0%, #2d8f5f 100%);
    box-shadow: 0 2px 12px rgba(67, 181, 129, 0.4);
}

.profile-achievement-tile[data-status="pending"] .profile-achievement-tile__ring {
    background: #2a2e35;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.profile-achievement-tile__ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.profile-achievement-tile__ring .ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 2.5;
}

.profile-achievement-tile__ring .ring-fill {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    transition: stroke-dasharray 0.3s ease, stroke 0.2s;
}

.profile-achievement-tile[data-status="done"] .ring-bg,
.profile-achievement-tile[data-status="done"] .ring-fill {
    stroke: transparent;
}

.profile-achievement-tile[data-status="pending"] .ring-fill {
    stroke: #f0b429;
}

.profile-achievement-tile__icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    line-height: 1;
    pointer-events: none;
}

.profile-achievement-tile[data-status="done"] .profile-achievement-tile__icon {
    filter: brightness(1.1);
}

.profile-achievement-tile__name {
    position: relative;
    z-index: 1;
    font-size: 10px;
    font-weight: 600;
    color: #e8ecf1;
    text-align: center;
    line-height: 1.25;
    min-height: 2.5em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.profile-achievement-tile[data-status="pending"] .profile-achievement-tile__name {
    color: #9ca3af;
}

@media (max-width: 400px) {
    .profile-achievements-grid {
        gap: 8px;
    }
    .profile-achievement-tile {
        padding: 12px 6px;
    }
    .profile-achievement-tile__ring {
        width: 40px;
        height: 40px;
    }
    .profile-achievement-tile__icon {
        font-size: 18px;
    }
}

/* Нижняя панель ачивки (bottom-panel, как в wallet/FAQ) */
.profile-achievement-panel {
    padding: 24px 20px 32px;
    text-align: center;
}

.profile-achievement-panel__icon {
    font-size: 56px;
    margin-bottom: 16px;
    line-height: 1;
}

.profile-achievement-panel__title {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 12px;
}

.profile-achievement-panel__desc {
    font-size: 14px;
    color: #9aa0aa;
    margin: 0 0 16px;
    line-height: 1.5;
}

.profile-achievement-panel__progress {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

.profile-achievement-panel__progress--done {
    color: #43b581;
}

.profile-achievement-panel__progress--pending {
    color: #f0b429;
}

.profile-achievement-panel__close {
    width: 100%;
}

/* API card */
.profile-api.card {
    background-color: #1d2025;
}

/* Placeholder для API ключа — видимый цвет текста */
.profile-api__placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* API блок — несколько ключей */
.profile-api__keys {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-api__key-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-api__key-row:last-of-type {
    border-bottom: none;
}

.profile-api__value {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    font-weight: 500;
    color: #d6dbe3;
    font-family: ui-monospace, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-api__copy-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.profile-api__copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.profile-api__copy-btn i {
    font-size: 14px;
}

.profile-api__actions {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-api__ghost-btn {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: transparent;
    color: #d8dee8;
    border-radius: 24px;
    height: 44px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.7;
}

/* ——— Карточка авторизации (кнопка-строка) ——— */
.profile-auth-card {
    /* Нейтрализуем padding от .card */
    padding: 14px 16px !important;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    text-align: left;
    border: 1px solid rgba(220, 80, 80, 0.35) !important;
    font: inherit;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.3s ease, background 0.2s;
}
.profile-auth-card:active  { background: #1a1d22; }
.profile-auth-card:focus   { outline: none; }

/* Зелёная обводка когда почта привязана */
.profile-auth-card.is-bound {
    border-color: rgba(67, 181, 129, 0.35) !important;
}

.profile-auth-card__left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.profile-auth-card__left span:last-child {
    font-size: 13px;
    font-weight: 500;
    color: #e07070;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s;
    flex: 1;
    min-width: 0;
}

.profile-auth-card.is-bound .profile-auth-card__left span:last-child {
    color: #43b581;         /* зеленоватый когда привязана */
}

.profile-auth-card__left i {
    font-size: 17px;
    line-height: 1;
    flex-shrink: 0;
    color: #e07070;
    transition: color 0.3s;
}

.profile-auth-card.is-bound .profile-auth-card__left i {
    color: #43b581;
}

.profile-auth-card__chevron {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    margin-left: 8px;
}

/* ——— Панель авторизации внутри bottom-panel ——— */
.auth-panel {
    padding: 24px 20px 28px;
    display: flex;
    flex-direction: column;
}

.auth-panel__title {
    font-size: 20px;
    font-weight: 600;
    color: #dcdde0;
    margin-bottom: 20px;
    text-align: center;
}

.auth-panel__tabs {
    margin-bottom: 16px;
}

/* У toggle-content нет лишних отступов */
.auth-panel .toggle-content__item {
    padding-top: 4px;
}

.auth-panel__form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-panel__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-panel__label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auth-panel__input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: #e8ecf1;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
}
.auth-panel__input:focus    { border-color: rgba(99,149,249,0.6); }
.auth-panel__input::placeholder { color: rgba(255,255,255,0.22); }

.auth-panel__pass-wrap { position: relative; }
.auth-panel__pass-wrap .auth-panel__input { padding-right: 46px; }

.auth-panel__eye {
    position: absolute;
    right: 0; top: 0;
    height: 44px; width: 44px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer; padding: 0;
    transition: color 0.2s;
}
.auth-panel__eye:hover { color: rgba(255,255,255,0.75); }

.auth-panel__error {
    font-size: 13px;
    color: #f04747;
    padding: 8px 12px;
    background: rgba(240,71,71,0.1);
    border: 1px solid rgba(240,71,71,0.2);
    border-radius: 10px;
    line-height: 1.4;
}

.auth-panel__submit { margin-top: 6px; }

.auth-panel__current {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    padding: 0 2px 2px;
}
.auth-panel__current strong { color: rgba(255,255,255,0.85); }

/* Success screen */
.auth-panel--success {
    align-items: center;
    text-align: center;
    padding-top: 24px;
}
.auth-panel__success-title {
    font-size: 22px;
    font-weight: 600;
    color: #dcdde0;
    margin-bottom: 8px;
}
.auth-panel__success-sub {
    font-size: 14px;
    color: rgba(255,255,255,0.5);
}

/* Кнопка выхода — только для веб-режима */
.profile-web-logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: rgba(220, 80, 80, 0.07);
    border: 1px solid rgba(220, 80, 80, 0.25);
    border-radius: 12px;
    color: #e07070;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-align: left;
}
.profile-web-logout-btn:hover {
    background: rgba(220, 80, 80, 0.13);
    border-color: rgba(220, 80, 80, 0.4);
}
.profile-web-logout-btn i {
    font-size: 16px;
    flex-shrink: 0;
}
