/* ==========================================================================
   MPF profile — страница профиля пользователя (userinfo.tpl)
   Подключается только на странице профиля. Работает вместе с mpf-core.css.
   Все селекторы начинаются с .mpf — остальной сайт не затрагивается.
   ========================================================================== */

/* ---- шапка ---- */
.mpf-hero {
    position: relative;
    background: var(--mpf-bg2);
    border: 1px solid var(--mpf-line);
    border-radius: var(--mpf-radius);
    overflow: hidden;
}

.mpf-banner {
    height: 190px;
    position: relative;
    overflow: hidden;
}

.mpf-banner img {
    position: absolute;
    inset: -20px;
    width: calc(100% + 40px);
    height: calc(100% + 40px);
    max-width: none;
    object-fit: cover;
    transition: transform .25s var(--mpf-ease);
}

.mpf-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 30%, var(--mpf-bg2));
}

.mpf-hero-body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 22px;
    align-items: end;
    padding: 0 28px 26px;
    margin-top: -62px;
    position: relative;
    z-index: 1;
}

.mpf-ava {
    position: relative;
    width: 124px;
    height: 124px;
    flex: none;
}

.mpf-ava::before {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--mpf-c1), var(--mpf-orange), var(--mpf-red), var(--mpf-c1));
    z-index: -1;
    animation: mpf-spin 6s linear infinite;
}

.mpf-ava img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--mpf-bg2);
}

@keyframes mpf-spin {
    to {
        transform: rotate(360deg);
    }
}

.mpf-who {
    min-width: 0;
}

.mpf-name {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mpf-name h2 {
    margin: 0;
    padding: 0;
    font-size: 30px;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.mpf-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-top: 6px;
    color: var(--mpf-text2);
    font-size: 14px;
}

.mpf-sub > span i {
    margin-right: 6px;
}

.mpf-priv {
    filter: blur(5px);
    transition: filter .25s;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.mpf-priv:hover,
.mpf-priv:focus {
    filter: none;
}

.mpf-acts {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* {pm} отдаёт готовую ссылку <a> — оформляем её как кнопку */
.mpf-pm a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--mpf-radius);
    background: var(--mpf-c1);
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    transition: background .2s;
}

.mpf-pm a:hover {
    background: var(--mpf-c2);
}

.mpf-pm:not(:has(a)) {
    display: none;
}

/* элементы только для посетителей скрываются у владельца (флаг ставит [not-logged]) */
.mpf:has(.mpf-flag-owner) .mpf-v-only {
    display: none;
}

.mpf.mpf-notself .mpf-v-only {
    display: block;
}

.mpf-flag-owner {
    display: none;
}

/* ---- плитки статистики ---- */
.mpf-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--mpf-line);
}

.mpf-stat {
    position: relative;
    padding: 18px 28px;
    min-width: 0;
}

.mpf-stat + .mpf-stat {
    border-left: 1px solid var(--mpf-line);
}

.mpf-stat-n {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.mpf-stat-n.mpf-stat-text {
    font-size: 18px;
    padding-top: 3px;
}

.mpf-stat-l {
    font-size: 13px;
    color: var(--mpf-text2);
}

.mpf-stat-l i {
    margin-right: 6px;
    color: var(--mpf-c2);
}

.mpf-stat-l a {
    color: var(--mpf-text2);
    transition: color .2s;
}

.mpf-stat-l a:hover {
    color: var(--mpf-text);
}

/* ---- публикации автора ---- */
.mpf-posts {
    margin-top: 28px;
}

.mpf-posts-h {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    font-size: 18px;
    line-height: 1.2;
}

.mpf-posts-h i {
    color: var(--mpf-c2);
}

/* ---- панель настроек ---- */
.mpf-scrim {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 55%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
    z-index: 10010;
}

.mpf-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(520px, 100%);
    background: var(--mpf-bg2);
    border-left: 1px solid var(--mpf-line);
    z-index: 10011;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .35s var(--mpf-ease), visibility 0s linear .35s;
    display: flex;
    flex-direction: column;
}

.mpf.mpf-open .mpf-scrim {
    opacity: 1;
    pointer-events: auto;
}

.mpf.mpf-open .mpf-drawer,
.mpf-drawer:target {
    transform: none;
    visibility: visible;
    transition: transform .35s var(--mpf-ease), visibility 0s;
}

.mpf-dhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--mpf-line);
}

.mpf-dhead h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
}

.mpf-dbody {
    flex: 1;
    overflow: auto;
    padding: 22px 24px;
    display: grid;
    gap: 28px;
    align-content: start;
}

.mpf-sec > h4 {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.3;
    color: var(--mpf-text2);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.mpf-row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mpf-fld {
    margin-bottom: 12px;
    min-width: 0;
}

.mpf-fld > label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--mpf-text2);
}

.mpf-fld input[type="text"],
.mpf-fld input[type="password"],
.mpf-fld select,
.mpf-sel select,
.mpf-xf input[type="text"],
.mpf-xf textarea,
.mpf-xf select {
    display: block;
    width: 100%;
    height: auto;
    min-height: 46px;
    margin: 0;
    padding: 12px 14px;
    background: var(--mpf-bg);
    border: 1px solid var(--mpf-line);
    border-radius: var(--mpf-radius);
    color: var(--mpf-text);
    font: inherit;
    font-size: 15px;
    box-shadow: none;
}

.mpf-fld input:focus,
.mpf-fld select:focus,
.mpf-sel select:focus,
.mpf-xf input:focus,
.mpf-xf textarea:focus {
    border-color: var(--mpf-c1);
    outline: 0;
}

.mpf-xf {
    display: block;
    width: 100%;
    border-collapse: collapse;
}

.mpf-xf tbody,
.mpf-xf tr {
    display: block;
}

.mpf-xf tr {
    margin-bottom: 12px;
}

.mpf-xf td {
    display: block;
    padding: 0;
    border: 0;
    background: none;
}

.mpf-xf td:first-child {
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--mpf-text2);
}

.mpf-avrow {
    display: flex;
    gap: 16px;
    align-items: center;
}

.mpf-avrow img {
    width: 72px;
    height: 72px;
    max-width: none;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}

.mpf-avrow input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.mpf-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--mpf-text2);
}

/* переключатели: DLE отдаёт <input type=checkbox> + <label> */
.mpf-check {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--mpf-line);
    font-size: 14px;
}

.mpf-check:empty {
    display: none;
}

.mpf-check label {
    order: 1;
    flex: 1;
    margin: 0;
    cursor: pointer;
    line-height: 1.35;
}

.mpf-check input[type="checkbox"] {
    order: 2;
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 42px;
    height: 24px;
    margin: 0;
    border: 0;
    border-radius: 24px;
    background: var(--mpf-bg3);
    position: relative;
    cursor: pointer;
    transition: background .2s;
}

.mpf-check input[type="checkbox"]::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s var(--mpf-ease);
}

/* у сайта есть общий стиль галочки на отмеченных чекбоксах (::before) — в переключателе она не нужна */
.mpf-check input[type="checkbox"]::before,
.mpf-check input[type="checkbox"]:checked::before {
    content: none !important;
    display: none !important;
}

.mpf-check input[type="checkbox"]:checked {
    background: var(--mpf-c1);
}

.mpf-check input[type="checkbox"]:checked::after {
    transform: translateX(18px);
}

.mpf-sel {
    margin-bottom: 4px;
}

.mpf-sel:empty {
    display: none;
}

.mpf-meter {
    display: flex;
    gap: 4px;
    margin: -4px 0 6px;
}

.mpf-meter i {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--mpf-line);
    transition: background .2s;
}

.mpf-dfoot {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--mpf-line);
}

.mpf-dirty {
    margin-right: auto;
    font-size: 13px;
    color: var(--mpf-orange);
    opacity: 0;
    transition: opacity .2s;
}

.mpf-dfoot.mpf-is-dirty .mpf-dirty {
    opacity: 1;
}

.mpf-dfoot button.mpf-btn {
    width: auto;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 10px 18px;
    border: 0;
    box-shadow: none;
    font-size: 14px;
    line-height: 1.3;
}

.mpf-dfoot button[type="submit"] {
    background: var(--mpf-c1);
}

.mpf-dfoot button[type="submit"]:hover {
    background: var(--mpf-c2);
}

/* ---- планшет и телефон ---- */
@media (max-width: 1000px) {
    .mpf-layout.mpf-has-side {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .mpf-hero-body {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .mpf-acts {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .mpf-stats {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 700px) {
    .mpf-banner {
        height: 128px;
    }

    .mpf-hero-body {
        gap: 10px 14px;
        padding: 0 16px 18px;
        margin-top: -44px;
    }

    .mpf-ava {
        width: 88px;
        height: 88px;
    }

    .mpf-ava::before {
        inset: -4px;
    }

    .mpf-who {
        padding-bottom: 4px;
    }

    .mpf-name h2 {
        font-size: 24px;
    }

    .mpf-sub {
        gap: 4px 12px;
        font-size: 13px;
    }

    .mpf-acts {
        display: grid;
        grid-template-columns: repeat(10, 1fr);
        gap: 8px;
    }

    .mpf-acts > * {
        grid-column: span 5;
    }

    .mpf-acts > .mpf-btn-fire {
        grid-column: span 8;
        order: 1;
        min-height: 52px;
        font-size: 16px;
    }

    .mpf-acts > .mpf-copy {
        grid-column: span 2;
        order: 2;
        min-height: 52px;
        font-size: 17px;
    }

    .mpf-acts > .mpf-pm {
        grid-column: span 8;
        order: 1;
    }

    .mpf-acts > .mpf-pm a {
        width: 100%;
        justify-content: center;
        min-height: 52px;
        font-size: 16px;
    }

    .mpf-acts > .mpf-btn:not(.mpf-btn-fire):not(.mpf-copy) {
        order: 3;
        justify-content: center;
    }

    .mpf-stats {
        gap: 8px;
        padding: 12px;
    }

    .mpf-stat {
        padding: 12px 14px;
        border: 1px solid var(--mpf-line);
        border-radius: var(--mpf-radius);
        background: var(--mpf-bg);
    }

    .mpf-stat + .mpf-stat {
        border-left: 1px solid var(--mpf-line);
    }

    .mpf-stat-n {
        font-size: 22px;
    }

    .mpf-stat-n.mpf-stat-text {
        font-size: 16px;
    }

    .mpf-row2 {
        grid-template-columns: 1fr;
    }

    .mpf-drawer {
        width: 100%;
    }

    .mpf-dbody {
        padding: 18px 16px;
    }

    .mpf-dhead,
    .mpf-dfoot {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ---- вкладки и панели ---- */
.mpf-tabs {
    display: flex;
    gap: 4px;
    margin-top: 20px;
    padding: 6px;
    background: var(--mpf-bg2);
    border: 1px solid var(--mpf-line);
    border-radius: var(--mpf-radius);
    overflow-x: auto;
    scrollbar-width: none;
}

.mpf-tabs::-webkit-scrollbar {
    display: none;
}

.mpf-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 9px;
    background: none;
    color: var(--mpf-text2);
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    cursor: pointer;
}

.mpf-tab[hidden],
.mpf-cnt[hidden],
.mpf-check[hidden],
.mpf-panel[hidden] {
    display: none;
}

.mpf-tab:hover {
    color: var(--mpf-text);
}

.mpf-tab.mpf-act {
    background: var(--mpf-c1);
    color: var(--mpf-text);
}

.mpf-tab-link:not(a) {
    cursor: default;
}

a.mpf-tab-link {
    text-decoration: none;
}

.mpf-tab-link a {
    color: inherit;
}

.mpf-tab-link a:hover {
    color: var(--mpf-text);
}

.mpf-cnt {
    font-style: normal;
    font-size: 12px;
    background: rgb(255 255 255 / 12%);
    padding: 0 7px;
    border-radius: 20px;
}

.mpf-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.mpf-layout.mpf-has-side {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
}

.mpf-side:empty,
.mpf-layout:not(.mpf-has-side) .mpf-side {
    display: none;
}

.mpf-main {
    min-width: 0;
}

/* сетка публикаций сужается вместе с правой колонкой */
.mpf-has-side .mpf-posts .e-grid5 {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.mpf-panels {
    transition: opacity .25s;
}

.mpf-panels .mpf-posts {
    margin-top: 0;
}

/* пока плагин достижений не ответил, не показываем «прыгающий» контент */
.mpf-pending .mpf-panels,
.mpf-pending .mpf-strip {
    opacity: 0;
}

@media (max-width: 700px) {
    .mpf-tabs {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        gap: 2px;
        padding: 5px;
        overflow: visible;
        margin-top: 14px;
    }

    .mpf-tab span {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .mpf-tab-link span {
        white-space: normal;
        line-height: 1.1;
        font-size: 9.5px;
    }

    .mpf-tab {
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        padding: 8px 0 7px;
        font-size: 10.5px;
        line-height: 1.15;
        text-align: center;
        position: relative;
        min-width: 0;
    }

    .mpf-tab i {
        font-size: 18px;
    }

    .mpf-tab .mpf-cnt {
        position: absolute;
        top: 2px;
        left: 50%;
        margin-left: 6px;
        font-size: 10px;
        padding: 0 5px;
        background: var(--mpf-red);
        color: #fff;
    }

    .mpf-layout {
        margin-top: 14px;
        gap: 14px;
    }

    .mpf-layout.mpf-has-side {
        grid-template-columns: minmax(0, 1fr);
    }
}
@media (prefers-reduced-motion: reduce) {
    .mpf-ava::before {
        animation: none;
    }

    .mpf *,
    .mpf-drawer,
    .mpf-scrim {
        transition: none !important;
    }
}
