/* ============================
   ГЛОБАЛЬНОЕ
   ============================ */

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

html, body {
    background-color: var(--content-bg-color);
    color: #fff;
    font-family: Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;

    --footer-position: static;
    --footer-bottom: 0px;
    --footer-bg: #262626;
    --footer-text: #fff;
    --footer-link: #d51ac3;
    --footer-top: 20px;
    --header-bg: #262626;
    --header-text: #fff;
}

/* скролл */

body::-webkit-scrollbar {
    width: 10px;
    background-color: transparent;
}

body::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background-color: #333;
}

body::-webkit-scrollbar-track {
    border-radius: 10px;
    background-color: transparent;
}

/* ============================
   LAYOUT
   ============================ */

.layout {
    display: grid;
    grid-template-columns: 100px 1fr;
    min-height: 100vh;
}

/* левая панель */

.sidebar {
    background-color: #212121;
    box-shadow: 4px 0 12px rgba(0,0,0,0.5);
    position: relative;
    z-index: 5;
    width: 100px !important;
}

/* правая часть */

.main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* хедер сверху (внутри main) */

.header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

/* бургер для мобилы */

.burger {
    display: none;
    position: fixed;
    width: 50px;
    height: 50px;
    margin-left: 10px;
    border-radius: 10px;
    border: 0;
    background:
        linear-gradient(#fff,#fff) center 10px/60% 3px no-repeat,
        linear-gradient(#fff,#fff) center 19px/60% 3px no-repeat,
        linear-gradient(#fff,#fff) center 28px/60% 3px no-repeat,
        linear-gradient(#fff,#fff) center 37px/60% 3px no-repeat;
    background-color: #333;
    cursor: pointer;
    z-index: 21;
}

/* контент */

.content {
    flex: 1;
    width: 990px;
    margin: 0 auto;
    padding: 20px 0 20px;
}

/* футер */

.footer {
    margin-top: auto;
}

/* ============================
   МЕНЮ (menu_owner / menu_guest)
   ============================ */

.menu {
    height: 100%;
    width: 100px !important;
    background-color: #212121;
    padding-top: 80px;
    position: relative;
}

.menu ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu ol li {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 0;
    cursor: pointer;
    transition: background-color .15s ease, transform .05s ease;
}

.menu ol li:hover {
    background-color: #333;
    transform: translateX(2px);
}

.menu li span img,
.menu ol li img {
    height: auto;
    width: 50px;
}

/* ============================
   ПРОФИЛЬ (шапка)
   ============================ */

.profile {
    background-color: #262626;
    border-radius: 19px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    overflow: hidden;
    margin: 0 auto 20px;
    position: relative;
    width: 990px;
}

/* обложка */

.coveri {
    width: 100%;
    height: 220px;
    background-color: #000;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
}

.change {
    display: flex;
    flex-direction: column;
    gap:10px;
}

.change_cover {
    height: 32px;
    min-width: 180px;
    padding: 0 10px 0 36px;
    border-radius: 8px;
    border: 1px solid #666;
    background-color: #666;
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}

.change_cover p {
    margin: 0;
    color: #fff;
}

.pencil2 {
    position: absolute;
    left: 6px;
    top: 3px;
    width: 26px;
    height: 26px;
    background-image: url('/static/pencil.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

/* нижняя плашка под обложкой */

.undercover {
    background-color: #262626;
    border-radius: 0 0 19px 19px;
    padding: 10px 16px 12px;
    position: relative;
}

/* вкладки фото/музыка/клипы */

ul.hr {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #333;
    border-radius: 12px;
    overflow: hidden;
}

ul.hr li {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color .15s ease;
}

ul.hr li img {
    height: 32px;
    width: auto;
}

ul.hr li.one {
    border-radius: 12px 0 0 12px;
}

ul.hr li.three {
    border-radius: 0 12px 12px 0;
}

ul.hr li:hover {
    background-color: #555;
}

ul.hr > img {
    height: 32px;
    width: auto;
}

/* доп. кнопки (друзья/сообщения) */

ul.hr2 {
    display: flex;
    align-items: center;
    gap: 6px;
}

ul.hr2 li {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 10px;
    background: #333;
    transition: background-color .15s ease, transform .05s ease;
}

ul.hr2 li:hover {
    background-color: #555;
    transform: translateY(-1px);
}

ul.hr2 li img {
    height: 32px;
    width: auto;
}

/* блок с аватаром, saewadasd */

.avanameonline {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 20px;
    right: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.undercover-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    width: 100%;
}

/* Разрешаем перенос */
.undercover-row > * {
    min-width: 0;
    flex-shrink: 1;
}

/* Порядок по умолчанию */
.hr {
    order: 1;
    flex-shrink: 0;
}

.name-online-right {
    order: 3;
    flex-shrink: 1;
}

.hr2 {
    order: 2;
    flex-shrink: 0;
}

.name-online-right {
    display: flex;
    flex-direction: column; /* ← ставит первый сверху, второй снизу */
    justify-content: space-between; /* ← распределяет по вертикали */
    align-items: center; /* ← выравнивает справа */
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    order: 2;
}

/* аватар */

.avafon {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(from 268.36deg at 50% 50%, #8A4AD8 -5.63deg, #079DFD 10.4deg, #D01DC4 342.54deg, #8A4AD8 354.37deg, #079DFD 370.4deg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ava {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background-color: #6b4164;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
}

/* кнопка редактирования аватара */

.pencil {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 35px;
    height: 35px;
    background-color: #666;
    background-image: url('/static/pencil.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: 20px;
    border-radius: 50%;
    border: 1px solid #666;
    cursor: pointer;
}

/* имя */

.name-surname {
    background-color: #8F00FF;
    padding: 6px 14px;
    border-radius: 50px;
    border: 2px solid #fff;
    font-size: 20px;
    display: inline-flex;
    white-space: nowrap;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* онлайн */

.online {
    margin-top: 8px;
    background-color: #8F00FF;
    padding: 5px 14px;
    border-radius: 50px;
    border: 2px solid #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.online-curcle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: rgba(101, 192, 58, 1);
}

.online span {
    margin-left: 0 !important;
}

/* блок соцсетей + уровень справа */
.setilevel {
    position: absolute;
    top: -25px;
    right: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.setilevel ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.setilevel ol li {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px 0;
}

.setilevel ol li img {
    width: 35px;
    height: 35px;
}

.leveltext {
    text-align: center;
    margin-top: 4px;
    font-size: 14px;
    cursor: pointer;
}

.leveltext text {
    display: block;
    margin-bottom: 4px;
}

.level {
    background-color: #8F00FF;
    padding: 2px 10px;
    border-radius: 50px;
    border: 2px solid #fff;
    cursor: pointer;
}

/* ============================
   ФОТО / МУЗЫКА / ВИДЕО
   ============================ */

.container-fot,
.container-music,
.container-clip {
    background-color: #262626;
    border-radius: 19px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.6);
    width: 990px;
    margin: 0 auto 20px;
    padding: 16px 16px 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 20px;
    max-height: calc(145px * 2 + 20px + 26px + 42px); /* 2 строки + отступы */
}

.container-music,
.container-clip {
    display: none;
}

.container-fot-inner,
.container-music-inner,
.container-clip-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 10px;
    min-height: 20px;
    max-height: calc(145px * 2 + 20px); /* 2 строки + отступы */
    overflow-y: auto;
    overflow-x: hidden;
}

/* скролл внутри фото */

.container-fot-inner::-webkit-scrollbar,
.container-music-inner::-webkit-scrollbar,
.container-clip-inner::-webkit-scrollbar {
    width: 8px;
    background-color: transparent;
}

.container-fot-inner::-webkit-scrollbar-thumb,
.container-music-inner::-webkit-scrollbar-thumb,
.container-clip-inner::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background-color: #444;
}

.container-fot-inner::-webkit-scrollbar-track,
.container-music-inner::-webkit-scrollbar-track,
.container-clip-inner::-webkit-scrollbar-track {
    border-radius: 10px;
    background-color: transparent;
}

/* сетка фото */

ul.hor {
    margin: 0;
    padding: 0;
    list-style: none;
    display: contents;
    flex-wrap: wrap;
    gap: 15px;
}

ul.hor li {
    padding: 0;
    height: auto;
    width: 100%;
}

.foto {
    height: 145px;
    background-color: #444;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    background-size: cover;
    position: relative;
    transition: transform .12s ease, filter .12s ease;
}

.foto:hover {
    transform: scale(1.02);
    filter: brightness(1.05);
}

/* подписи "нет ..." */

.not-en,
.not-en-photo,
.not-en-all {
    min-width: 140px;
    position: static;
    text-align: left;
    font-size: 24px;
    margin: 10px 20px 10px;
    opacity: 0.85;
}

/* кнопки под фото */

.add-foto,
.add-foto-none {
    cursor: pointer;
    height: 30px;
    width: auto;
    background-color: #666;
    border: 1px solid #666;
    border-radius: 7px;
    padding: 8px 15px;
    font-size: 18px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s ease, border-color .15s ease, transform .05s ease;
    color: #fff;
}

.add-foto:hover,
.add-foto-none:hover {
    background-color: #777;
    border-color: #777;
}

.add-foto-none {
    align-self: center;
    margin-top: 10px;
}

/* панель действий с фото */

.photo-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 4px 0 10px 0;
    flex-wrap: wrap;
}

/* кнопка "Удалить" */

.delete-foto {
    background-color: #dd1111;
    border-color: #dd1111;
}

/* disabled */

.add-foto.disabled {
    opacity: .45;
    cursor: default;
    pointer-events: none;
}

/* чекбоксы выбора фото */

.foto {
    position: relative;
}

.photo-check,
.photo-check-ui {
    display: none;
}

.container-fot.edit-mode .photo-check,
.container-fot.edit-mode .photo-check-ui {
    display: block;
}

.photo-check {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 22px;
    height: 22px;
    margin: 0;
    opacity: 0;
    z-index: 3;
    cursor: pointer;
}

.photo-check-ui {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,.85);
    background: rgba(0,0,0,.25);
    z-index: 2;
    pointer-events: none;
}

.photo-check:checked + .photo-check-ui {
    background: rgba(213,26,195,.85);
    border-color: rgba(213,26,195,1);
    box-shadow: 0 0 0 3px rgba(213,26,195,.25);
}

#deleteSelectedBtn {
    display: none;
}

.container-fot.edit-mode #deleteSelectedBtn {
    display: inline-flex;
}

/* ============================
   ПОСТЫ
   ============================ */

.profile-feed {
    width: 990px;
    margin: 0 auto;
}

/* форма создания поста */

.container-writepost,
.container-posts {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    background-color: #262626;
    border-radius: 19px;
    box-shadow: 0 4px 8px rgba(0,0,0,.6);
    height: auto;
    padding: 18px;
    box-sizing: border-box;
}

.container-writepost {
    margin-bottom: 20px;
}

.container-posts {
    min-height: 100px;
}

/* textarea */

.textarea {
    background-color: #666;
    font-size: 18px;
    font-family: Arial, sans-serif;
    border: none;
    border-radius: 15px;
    resize: none;
    padding: 8px 10px;
    overflow: hidden;
    box-sizing: border-box;
    min-height: 70px;
    width: 100%;
    color: #fff;
}

/* действия под постом */

.post-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* скрытый input */

.postImages {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* кнопки */

.post-btn {
    cursor: pointer;
    border-radius: 7px;
    font-size: 18px;
    color: #fff;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: background-color .15s ease, border-color .15s ease, transform .05s ease;
    padding: 8px 12px;
}

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

.post-btn-file {
    height: 46px;
    min-width: 160px;
    background-color: #666;
    border-color: #666;
}

.post-btn-file:hover {
    background-color: #777;
    border-color: #777;
}

.post-btn-send {
    height: 46px;
    min-width: 190px;
    background-color: #D51AC3;
    border-color: #D51AC3;
}

.post-btn-send:hover {
    background-color: #b814a6;
    border-color: #b814a6;
}

.post-images-hint {
    margin-top: 8px;
    color: rgba(255,255,255,.75);
    font-size: 14px;
}

/* контейнер картинок в посте */

.post-images {
    --gap: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap);
    margin-top: 10px;
}

/* обёртка картинки */

.post-img-wrap {
    position: relative;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    transition: transform .12s ease, filter .12s ease;
}

.post-img-wrap:hover {
    transform: scale(1.01);
    filter: brightness(1.05);
}

/* сама картинка */

.post-img-wrap img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 16px;
}

/* сетка по количеству */

.post-images[data-count="1"] .post-img-wrap {
    width: 100%;
}

.post-images[data-count="2"] .post-img-wrap {
    width: calc((100% - (var(--gap) * 1)) / 2);
}

.post-images[data-count="3"] .post-img-wrap {
    width: calc((100% - (var(--gap) * 2)) / 3);
}

.post-images[data-count="4"] .post-img-wrap {
    width: calc((100% - (var(--gap) * 3)) / 4);
}

/* нет постов */

.no-posts {
    text-align: center;
    font-size: 20px;
    margin: 20px 0;
}

/* ============================
   ЛАЙТБОКС
   ============================ */

.lb {
    position: fixed;
    inset: 0;
    z-index: 99999;
}

.lb-bg {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.86);
}

.lb-ui {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.lb-img {
    max-width: min(96vw, 1200px);
    max-height: 92vh;
    border-radius: 18px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    padding: 8px;
    object-fit: contain;
}

/* стрелки */

.lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 64px;
    height: 96px;
    border: 0;
    border-radius: 18px;
    cursor: pointer;
    color: rgba(255,255,255,.92);
    font-size: 56px;
    line-height: 1;
    background: rgba(255,255,255,.06);
    opacity: .15;
    transition: opacity .15s ease, background-color .15s ease;
}

.lb-prev {
    left: 18px;
}

.lb-next {
    right: 18px;
}

.lb:hover .lb-arrow {
    opacity: .85;
}

.lb-arrow:hover {
    background: rgba(255,255,255,.10);
}

.lb-arrow[disabled] {
    display: none;
}

/* закрыть */

.lb-close {
    position: absolute;
    right: 18px;
    top: 18px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: 28px;
    opacity: .8;
}

.lb-close:hover {
    opacity: 1;
}

/* ============================
   МОДАЛКИ (аватар / обложка)
   ============================ */

.avatar,
.cover,
.photo {
    position: fixed;
    height: 200px;
    width: 300px;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 99;
    transform: translate(50%,50%);
    right: 50%;
    bottom: 50%;
    border-radius: 10px;
    padding: 10px;
    backdrop-filter: blur(15px);
}

.unpencil {
    cursor: pointer;
    display: block;
    width: 30px;
    height: 30px;
    --weight: 3px;
    --aa: 1px;
    --color: white;
    border-radius: 3px;
    background:
        linear-gradient(45deg, transparent calc(50% - var(--weight) - var(--aa)), var(--color) calc(50% - var(--weight)), var(--color) calc(50% + var(--weight)), transparent calc(50% + var(--weight) + var(--aa))),
        linear-gradient(-45deg, transparent calc(50% - var(--weight) - var(--aa)), var(--color) calc(50% - var(--weight)), var(--color) calc(50% + var(--weight)), transparent calc(50% + var(--weight) + var(--aa)));
    position: absolute;
    right: 10px;
    top: 10px;
}

/* контейнеры внутри модалок */

#avatar-container,
#cover-container,
#photo-container {
    cursor: pointer;
    width: 250px;
    height: 150px;
    position: relative;
    overflow: hidden;
    display: inline-block;
    color: black;
}

#avatar-background,
#cover-background,
#photo-background {
    width: 250px;
    height: 80px;
    background-color: white;
    border: 2px solid #ccc;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#avatar-background:hover,
#cover-background:hover,
#photo-background:hover {
    background-color: #f0f0f0;
}

#avatar-label,
#cover-label,
#photo-label {
    cursor: pointer;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 14px;
}

/* ============================
   АДАПТИВ
   ============================ */

@media (max-width: 1200px) {
    .content,
    .profile,
    .container-fot,
    .container-music,
    .container-clip,
    .profile-feed {
        width: 99%;
        max-width: 990px;
    }

    .layout {
        grid-template-columns: 100px 1fr;
    }
}


@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 100px 1fr;
    }

    .name-surname {
        font-size: 18px;
        text-align: center;
    }

    .online {
        font-size: 14px;
    }
}

@media (max-width: 900px) {

    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 100px;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 5;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .burger {
        display: inline-block;
    }

    .content {
        width: 100%;
        padding: 20px 12px 20px;
    }

    .profile,
    .container-fot,
    .container-music,
    .container-clip,
    .profile-feed {
        width: 100%;
    }

    .coveri {
        height: 190px;
    }

    .avanameonline {
        left: 10px;
        right: 10px;
    }

    .undercover-row {
        justify-content: flex-start;
    }

    /* Вкладки остаются первыми */
    .hr {
        order: 2;
    }

    /* Кнопки друзей идут вторыми */
    .hr2 {
        order: 3;
        margin-left: auto; /* чтобы прижались вправо */
    }

    /* Имя + онлайн переезжают вниз */
    .name-online-right {
        order: 1;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-top: 10px;
        gap: 20px;
    }

    .name-surname {
        font-size: 16px;
        text-align: center;
    }

    .online {
        font-size: 14px;
        margin-top: -10px;
    }

    .setilevel {
        top: -13px;
    }

    .setilevel ol li img {
        width: 28px;
        height: 28px;
    }

    .leveltext {
        text-align: center;
        margin-top: 4px;
        font-size: 14px;
        cursor: pointer;
    }

    .lb-ui {
        padding: 16px;
    }
}

@media (max-width: 600px) {

    .coveri {
        height: 170px;
    }

    .avafon {
        width: 130px;
        height: 130px;
    }

    .ava {
        width: 115px;
        height: 115px;
    }

    ul.hr {
        transform: scale(0.9);
        transform-origin: left center;
    }

    ul.hr2 li img {
        height: 28px;
    }

    .post-img-wrap img {
        height: 150px;
    }

    .container-writepost,
    .container-posts {
        padding: 12px;
    }

    .textarea {
        font-size: 16px;
    }

    .post-btn-file,
    .post-btn-send {
        height: 40px;
        font-size: 16px;
    }

    .setilevel {
        position: static; /* убираем абсолют, чтобы не ломало */
        margin-right: 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* превращаем список в сетку 2×2 */
    .setilevel ol {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px 20px;
        justify-items: center;
        width: 100%;
        max-width: 200px; /* чтобы сетка не растягивалась */
    }

    /* картинки центрируются */
    .setilevel ol li {
        padding: 0;
    }

    .setilevel ol li img {
        width: 35px;
        height: 35px;
    }

    /* leveltext снизу по центру */
    .leveltext {
        margin-top: 10px;
        text-align: center;
        width: 100%;
    }
}

@media (max-width: 420px) {

    .coveri {
        height: 150px;
    }

    .avafon {
        width: 120px;
        height: 120px;
    }

    .ava {
        width: 105px;
        height: 105px;
    }

    .post-img-wrap img {
        height: 130px;
    }

    .setilevel {
        margin-right: 5px;
    }
}
