/* Общие стили админки. */
body {
    background: #f5f6f8;
}

.card {
    border: none;
}

.cursor-pointer {
    cursor: pointer;
}

/* Список проектов */
.project-card {
    transition: box-shadow .15s ease, transform .15s ease;
    height: 100%;
}
.project-card:hover {
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .1) !important;
}
.project-card.archived {
    opacity: .7;
}
.project-card .project-title {
    font-weight: 600;
}
.section-label {
    font-size: .75rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #8a8f98;
    margin: 1.5rem 0 .5rem;
}

/* Редактор проекта: две колонки */
.editor-wrap {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.editor-left {
    flex: 1 1 0;
    min-width: 0;
}
.editor-right {
    flex: 0 0 auto;
    position: sticky;
    top: 4.5rem;
    align-self: flex-start;
    width: 390px;
    max-width: 92vw;
    height: calc(100dvh - 5rem);
    max-height: calc(100dvh - 5rem);
    box-sizing: border-box;
}

@media (max-width: 992px) {
    .editor-wrap { flex-direction: column; align-items: center; }
    .editor-right {
        position: static;
        order: -1;
        width: 100%;
        max-width: 390px;
        height: calc(100dvh - 6rem);
        max-height: calc(100dvh - 6rem);
        margin-bottom: 1rem;
    }
}

.editor-section {
    background: #fff;
    border-radius: .5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.editor-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .75rem;
}

.drag-handle { cursor: grab; color: #adb5bd; }
.sortable-ghost { opacity: .4; }

.media-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: .375rem;
    background: #e9ecef;
}
.thumb-tile {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: .375rem;
    overflow: hidden;
    background: #e9ecef;
}
.thumb-tile img, .thumb-tile video {
    width: 100%; height: 100%; object-fit: cover;
}
.thumb-tile .badge-type {
    position: absolute; top: 2px; right: 2px;
}
.thumb-tile.is-uploading {
    pointer-events: none;
}
.thumb-tile .upload-overlay {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .92);
    padding: 6px;
    text-align: center;
}
.thumb-tile .upload-overlay-label {
    font-size: .65rem;
    color: #6c757d;
    margin-top: 4px;
    line-height: 1.2;
}
.thumb-tile .upload-progress {
    width: 100%;
    height: 4px;
}
.thumb-tile.upload-placeholder {
    background: #e9ecef;
}

.copy-link-input { font-family: monospace; font-size: .85rem; }

/* Переключатель темы в шапке редактора */
.preview-theme-toggle .btn-check {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

/* Сетка постов в редакторе */
.post-tile {
    width: calc(33.333% - 6px);
    aspect-ratio: 1 / 1;
    height: auto;
}
.post-tile .post-tile-media {
    position: absolute;
    inset: 0;
}
.post-tile .post-tile-media img,
.post-tile .post-tile-media video {
    width: 100%; height: 100%; object-fit: cover;
}

/* Рамка телефона (ширина 390px, высота — пропорция 9:19.5, в пределах экрана) */
.preview-phone-slot,
.public-phone-slot {
    flex: 1 1 0;
    min-height: 0;
    container-type: size;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
}

.editor-right .preview-phone-slot {
    flex: none;
    height: 100%;
    width: 100%;
}

.editor-right .phone-screen {
    height: min(
        calc((var(--phone-width) - var(--phone-bezel)) * 19.5 / 9),
        calc(100cqh - var(--phone-bezel))
    );
}

.phone-frame {
    --phone-bezel: 28px;
    --phone-width: min(390px, 92vw);
    width: var(--phone-width);
    max-height: 100cqh;
    background: linear-gradient(145deg, #2a2a2e 0%, #141416 100%);
    border-radius: 24px;
    padding: 14px;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, .35),
        inset 0 0 0 1px rgba(255, 255, 255, .08),
        inset 0 1px 0 rgba(255, 255, 255, .12);
    position: relative;
    box-sizing: border-box;
    flex-shrink: 0;
}
.phone-screen {
    position: relative;
    width: 100%;
    height: min(
        calc((var(--phone-width) - var(--phone-bezel)) * 19.5 / 9),
        calc(100cqh - var(--phone-bezel))
    );
    background: #fff;
    border-radius: 17px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, .12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
.phone-screen .ig.ig-theme-dark {
    background: #0d1015;
}

/* Хайлайтсы в редакторе */
.hl-item { cursor: default; }
.hl-drag-handle {
    font-size: .65rem;
    line-height: 1;
    padding: 2px 4px;
    opacity: .45;
}
.hl-item:hover .hl-drag-handle { opacity: .85; }

#export-panel .btn + .btn {
    margin-left: 0.5rem;
}
@media (max-width: 576px) {
    #export-panel .btn + .btn {
        margin-left: 0;
        margin-top: 0.5rem;
    }
}
