/* =========================================================
   Подборки и доски в стиле Pinterest (mos77.ru)
   ========================================================= */

/* Сетка подборок в профиле и избранном */
.mos77-boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

@media (max-width: 640px) {
    .mos77-boards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 380px) {
    .mos77-boards-grid {
        grid-template-columns: 1fr;
    }
}

/* Карточка подборки */
.mos77-board-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.mos77-board-card:hover {
    transform: translateY(-2px);
}

.mos77-board-card__cover-box {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: hidden;
    background: #f0f2f5;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.mos77-board-card__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .28);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s ease;
    backdrop-filter: blur(2px);
}

.mos77-board-card:hover .mos77-board-card__overlay {
    opacity: 1;
}

.mos77-board-card__view-btn {
    padding: 8px 16px;
    background: #fff;
    color: #1c1c1c;
    font-size: 13px;
    font-weight: 700;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
    transform: scale(.95);
    transition: transform .15s ease;
}

.mos77-board-card:hover .mos77-board-card__view-btn {
    transform: scale(1);
}

/* Коллаж обложки Pinterest (1, 2 или 3+ фото) */
.mos77-board-cover {
    width: 100%;
    height: 100%;
    display: flex;
    gap: 2px;
    background: #eef1f5;
}

.mos77-board-img {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform .3s ease;
}

.mos77-board-card:hover .mos77-board-img {
    transform: scale(1.03);
}

.mos77-board-cover--single .mos77-board-img--full {
    width: 100%;
    height: 100%;
}

.mos77-board-cover--split .mos77-board-img {
    width: 50%;
    height: 100%;
}

.mos77-board-cover--collage .mos77-board-img--lead {
    width: calc(66.6% - 1px);
    height: 100%;
}

.mos77-board-stack {
    width: calc(33.4% - 1px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    height: 100%;
}

.mos77-board-img--sub {
    width: 100%;
    height: calc(50% - 1px);
}

/* Пустая обложка */
.mos77-board-cover--empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #9ba1a6;
    background: #f7f9fa;
}

.mos77-board-cover__empty-ico {
    opacity: .7;
}

.mos77-board-cover__empty-label {
    font-size: 13px;
    font-weight: 500;
}

/* Инфо под обложкой */
.mos77-board-card__info {
    padding: 10px 4px 6px;
}

.mos77-board-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mos77-board-card__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1c1c1c;
    line-height: 1.3;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mos77-board-card__title:hover {
    color: #2d81e0;
}

.mos77-board-card__menu {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.mos77-board-btn-action {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #8b929a;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.mos77-board-btn-action:hover {
    background: #f0f2f5;
    color: #1c1c1c;
}

.mos77-board-btn-action--del:hover {
    background: #fee7eb;
    color: #e0475a;
}

.mos77-board-card__sub {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 13px;
    color: #8a9099;
}

.mos77-board-privacy-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

.mos77-board-privacy-pill.is-public {
    background: #eaf8ef;
    color: #188641;
}

.mos77-board-privacy-pill.is-private {
    background: #f1f3f5;
    color: #636b75;
}

/* =========================================================
   Просмотр содержимого подборки (Board Viewer)
   ========================================================= */

.mos77-board-viewer {
    margin-top: 18px;
    padding: 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .05);
    border: 1px solid #edf0f3;
}

.mos77-board-viewer[hidden] {
    display: none;
}

.mos77-board-viewer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f2f5;
    margin-bottom: 20px;
}

.mos77-board-viewer__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    background: #f0f4f9;
    color: #2d81e0;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .15s ease;
}

.mos77-board-viewer__back:hover {
    background: #e2ecf7;
}

.mos77-board-viewer__info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mos77-board-viewer__title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: #1c1c1c;
}

.mos77-board-viewer__meta {
    font-size: 14px;
    color: #8a9099;
}

.mos77-board-viewer__cards {
    margin-top: 14px;
}

/* Кнопка быстрого удаления записи из подборки на карточке */
.mos77-col-remove-pin {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(28, 30, 34, .75);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background .15s ease, transform .15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

.mos77-col-remove-pin:hover {
    background: #e0475a;
    transform: scale(1.1);
}

.mos77-board-empty-viewer {
    padding: 40px 20px;
    text-align: center;
    color: #8a9099;
    font-size: 15px;
}

/* =========================================================
   Модальные окна (Сохранение в подборку, Редактирование)
   ========================================================= */

.mos77-col-modal {
    position: fixed;
    inset: 0;
    z-index: 10005;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: mos77FadeIn .2s ease;
}

.mos77-col-modal[hidden] {
    display: none !important;
}

.mos77-col-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .6);
    backdrop-filter: blur(4px);
}

.mos77-col-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: mos77ScaleIn .22s cubic-bezier(.16, 1, .3, 1);
}

@keyframes mos77FadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes mos77ScaleIn {
    from { opacity: 0; transform: scale(.94) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.mos77-col-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #f0f2f5;
}

.mos77-col-modal__title {
    font-size: 18px;
    font-weight: 700;
    color: #1c1c1c;
}

.mos77-col-modal__close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #f1f3f5;
    color: #636b75;
    font-size: 16px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .15s ease, color .15s ease;
}

.mos77-col-modal__close:hover {
    background: #e2e6ea;
    color: #1c1c1c;
}

.mos77-col-modal__body {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: 480px;
}

.mos77-col-picker-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 0;
    font-size: 14px;
    color: #8a9099;
}

/* Список подборок в пикере */
.mos77-col-picker-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.mos77-col-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
    user-select: none;
}

.mos77-col-item-row:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.mos77-col-item-row.is-active {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.mos77-col-item-row__left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.mos77-col-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid #cbd5e1;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: #fff;
    transition: border-color .15s ease, background-color .15s ease;
}

.mos77-col-item-row.is-active .mos77-col-checkbox {
    background: #2d81e0;
    border-color: #2d81e0;
}

.mos77-col-checkbox svg {
    display: none;
    color: #fff;
}

.mos77-col-item-row.is-active .mos77-col-checkbox svg {
    display: block;
}

.mos77-col-item-row__title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mos77-col-item-row__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    font-size: 13px;
    color: #64748b;
}

/* Форма создания новой подборки */
.mos77-col-create-box {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #e2e8f0;
}

.mos77-col-create-box__label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    margin-bottom: 10px;
}

.mos77-col-create-box__form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mos77-col-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    box-sizing: border-box;
}

.mos77-col-input:focus {
    border-color: #2d81e0;
    box-shadow: 0 0 0 3px rgba(45, 129, 224, .15);
}

.mos77-col-create-box__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.mos77-col-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    user-select: none;
}

.mos77-col-toggle-label input[type="checkbox"] {
    accent-color: #2d81e0;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.mos77-btn-col-submit {
    padding: 8px 18px;
    border-radius: 10px;
    background: #2d81e0;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background .15s ease;
}

.mos77-btn-col-submit:hover {
    background: #1a6cc9;
}

.mos77-col-modal__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #f0f2f5;
    background: #fafbfc;
}

.mos77-btn-col-done {
    padding: 9px 22px;
    border-radius: 10px;
    background: #1c1c1c;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .15s ease;
}

.mos77-btn-col-done:hover {
    background: #333;
}

.mos77-btn-col-cancel {
    padding: 8px 16px;
    border-radius: 10px;
    background: #e2e8f0;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .15s ease;
}

.mos77-btn-col-cancel:hover {
    background: #cbd5e1;
}

.mos77-col-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.mos77-col-form-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

/* Вкладки на странице /izbrannoe/ */
.fav-nav-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 20px;
    border-bottom: 1px solid #eef1f5;
    padding-bottom: 12px;
}

.fav-nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    background: #f1f4f8;
    color: #555d67;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
    text-decoration: none !important;
}

.fav-nav-tab:hover {
    background: #e4e9f0;
    color: #1c1c1c;
}

.fav-nav-tab.is-active {
    background: #2d81e0;
    color: #fff;
}

/* =========================================================
   Поповер подборок сразу снизу от кнопки «В избранное»
   ========================================================= */

.mos77-col-popover {
    position: fixed;
    inset: 0;
    z-index: 10006;
}

.mos77-col-popover[hidden] {
    display: none !important;
}

.mos77-col-popover__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .35);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .18s ease;
}

.mos77-col-popover.is-open .mos77-col-popover__backdrop {
    opacity: 1;
}

.mos77-col-popover__box {
    position: fixed;
    width: 360px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 60px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, .22), 0 0 0 1px rgba(0, 0, 0, .06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2;
    opacity: 0;
    transform: translateY(-8px) scale(.97);
    transition: opacity .18s cubic-bezier(.16, 1, .3, 1), transform .18s cubic-bezier(.16, 1, .3, 1);
}

.mos77-col-popover.is-open .mos77-col-popover__box {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.mos77-col-popover__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 12px;
    border-bottom: 1px solid #f0f2f5;
}

.mos77-col-popover__title {
    font-size: 16px;
    font-weight: 700;
    color: #1c1c1c;
}

.mos77-col-popover__close {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #f1f3f5;
    color: #636b75;
    font-size: 14px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .15s ease, color .15s ease;
}

.mos77-col-popover__close:hover {
    background: #e2e6ea;
    color: #1c1c1c;
}

.mos77-col-popover__body {
    padding: 14px 18px;
    overflow-y: auto;
    max-height: 420px;
}

.mos77-col-popover__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 0;
    font-size: 13px;
    color: #8a9099;
}

.mos77-col-popover__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.mos77-col-popover__create {
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
}

.mos77-col-popover__create-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    margin-bottom: 8px;
}

.mos77-col-popover__create-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mos77-col-popover__create-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mos77-col-popover__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 18px;
    border-top: 1px solid #f0f2f5;
    background: #fafbfc;
}

.mos77-col-popover__guest {
    padding: 10px 0;
}

.mos77-col-popover__guest-text {
    font-size: 13px;
    color: #475569;
    line-height: 1.45;
    margin: 0;
}

@media (max-width: 640px) {
    .mos77-col-popover__box {
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        transform: translateY(100%);
    }
    .mos77-col-popover.is-open .mos77-col-popover__box {
        transform: translateY(0);
    }
}
