/* ============================================================
   GREATOHM — App Previews (public page + editor)
   Loaded after styles.min.css so it can lean on the site tokens.
============================================================ */

[hidden] {
    display: none !important;
}

.pv-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Page head ---------- */
.pv-page .breadcrumb {
    margin-bottom: 18px;
}

.pv-lede {
    max-width: 720px;
    margin: 0 auto 34px;
    text-align: center;
    color: var(--gray);
    font-size: 1.02rem;
    line-height: 1.75;
}

.pv-toolbar {
    position: sticky;
    top: var(--pv-header, 118px);
    z-index: 30;
    padding: 14px 0 12px;
    margin-bottom: 22px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.pv-search {
    position: relative;
    display: flex;
    align-items: center;
}

.pv-search svg {
    position: absolute;
    left: 18px;
    width: 20px;
    height: 20px;
    color: var(--turquoise-dark);
    pointer-events: none;
}

.pv-search input {
    width: 100%;
    padding: 16px 56px 16px 50px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    background: var(--white);
    font-family: var(--sans);
    font-size: 1rem;
    color: var(--love-pink);
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.pv-search input::placeholder {
    color: #9aa3a3;
}

.pv-search input:focus {
    outline: none;
    border-color: var(--turquoise);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14);
}

.pv-search input::-webkit-search-cancel-button {
    display: none;
}

.pv-clear {
    position: absolute;
    right: 8px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--turquoise-soft);
    color: var(--turquoise-dark);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
}

.pv-clear:hover {
    background: var(--turquoise);
    color: #fff;
}

.pv-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.pv-chip {
    border: 1.5px solid var(--border);
    background: var(--white);
    color: var(--gray);
    border-radius: 50px;
    padding: 7px 15px;
    font-family: var(--sans);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.pv-chip:hover {
    border-color: var(--turquoise);
    color: var(--turquoise-dark);
}

.pv-chip[aria-pressed="true"] {
    background: var(--turquoise-dark);
    border-color: var(--turquoise-dark);
    color: #fff;
}

.pv-count {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--gray);
    font-variant-numeric: tabular-nums;
}

/* ---------- Result list ---------- */
.pv-list {
    list-style: none;
    display: grid;
    gap: 12px;
    margin: 0 0 40px;
    padding: 0;
}

.pv-row {
    width: 100%;
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--white);
    font-family: var(--sans);
    text-align: left;
    color: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.pv-row:hover,
.pv-row:focus-visible {
    border-color: var(--turquoise);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
    outline: none;
}

.pv-thumb {
    width: 62px;
    height: 62px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--gray-light);
    display: grid;
    place-items: center;
    color: var(--turquoise);
    flex-shrink: 0;
}

.pv-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.pv-row-main {
    min-width: 0;
}

.pv-row-title {
    display: block;
    font-family: var(--serif);
    font-size: 1.06rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--love-pink);
    margin-bottom: 3px;
}

.pv-row-desc {
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--gray);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.pv-row-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 7px;
    font-size: 0.76rem;
    color: var(--gray);
}

.pv-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    background: var(--turquoise-soft);
    color: var(--turquoise-dark);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.pv-badge-demo {
    background: #fff4f8;
    color: var(--love-pink);
}

.pv-chev {
    color: var(--turquoise-dark);
    flex-shrink: 0;
}

.pv-chev svg {
    width: 20px;
    height: 20px;
}

.pv-mark {
    background: rgba(233, 30, 99, 0.12);
    color: var(--love-pink);
    border-radius: 3px;
    padding: 0 2px;
}

/* ---------- States ---------- */
.pv-state {
    text-align: center;
    padding: 64px 20px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--gray-light);
    color: var(--gray);
}

.pv-state h2 {
    font-family: var(--serif);
    font-size: 1.35rem;
    color: var(--love-pink);
    margin-bottom: 8px;
}

.pv-state p {
    max-width: 460px;
    margin: 0 auto 18px;
    font-size: 0.94rem;
}

.pv-skeleton {
    display: grid;
    gap: 12px;
}

.pv-skeleton-row {
    height: 90px;
    border-radius: 14px;
    background: linear-gradient(90deg, #f5f7f7 25%, #eef2f2 37%, #f5f7f7 63%);
    background-size: 400% 100%;
    animation: pvShimmer 1.4s ease-in-out infinite;
}

@keyframes pvShimmer {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0 50%;
    }
}

/* ---------- Gallery dialog ---------- */
.pv-modal {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: none;
}

.pv-modal[data-open="true"] {
    display: block;
}

.pv-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 20, 19, 0.62);
    backdrop-filter: blur(4px);
}

.pv-dialog {
    position: relative;
    width: min(1060px, 94vw);
    max-height: 92vh;
    margin: 4vh auto;
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 370px;
    box-shadow: var(--shadow-lg);
}

.pv-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.pv-stage {
    position: relative;
    background: #0f1413;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 56px 46px;
    min-height: 380px;
    overflow: hidden;
}

.pv-stage img {
    max-height: 74vh;
    width: auto;
    max-width: 100%;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    background: #fff;
}

.pv-stage-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.pv-stage-nav:hover:not(:disabled) {
    background: var(--turquoise);
}

.pv-stage-nav:disabled {
    opacity: 0.28;
    cursor: default;
}

.pv-stage-nav[data-dir="prev"] {
    left: 10px;
}

.pv-stage-nav[data-dir="next"] {
    right: 10px;
}

.pv-counter {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.72);
    letter-spacing: 0.04em;
}

.pv-panel {
    padding: 26px 26px 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pv-panel h2 {
    font-family: var(--serif);
    font-size: 1.4rem;
    line-height: 1.3;
    color: var(--love-pink);
    padding-right: 34px;
}

.pv-panel .pv-pill {
    align-self: flex-start;
}

.pv-panel-desc {
    font-size: 0.94rem;
    line-height: 1.7;
    color: var(--gray);
    white-space: pre-line;
}

.pv-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.pv-strip button {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    background: var(--gray-light);
    cursor: pointer;
    transition: var(--transition);
}

.pv-strip button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.pv-strip button[aria-current="true"] {
    border-color: var(--turquoise);
}

.pv-panel .btn {
    margin-top: 8px;
    width: 100%;
}

.pv-note {
    font-size: 0.76rem;
    color: #9aa3a3;
    text-align: center;
}

/* ============================================================
   EDITOR (app-preview-admin.html)
============================================================ */
.ap-body {
    background: #f7f9f9;
}

.ap-gate {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.ap-gate-card {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 32px 28px;
    box-shadow: var(--shadow-md);
}

.ap-gate-card h1 {
    font-family: var(--serif);
    font-size: 1.5rem;
    color: var(--love-pink);
    margin-bottom: 6px;
}

.ap-gate-card p {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 20px;
}

.ap-gate-card .ap-note {
    margin: 12px 0 0;
}

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

.ap-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.ap-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--love-pink);
}

.ap-brand img {
    height: 30px;
    width: auto;
}

.ap-status {
    font-size: 0.78rem;
    color: var(--gray);
    padding: 4px 10px;
    border-radius: 50px;
    background: var(--gray-light);
}

.ap-status[data-tone="warn"] {
    background: #fff4f8;
    color: var(--love-pink);
}

.ap-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ap-body-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    min-height: 0;
}

.ap-side {
    border-right: 1px solid var(--border);
    background: #fff;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 57px);
    position: sticky;
    top: 57px;
}

.ap-side-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: grid;
    gap: 10px;
}

.ap-side-list {
    list-style: none;
    overflow-y: auto;
    padding: 8px;
    margin: 0;
    display: grid;
    gap: 4px;
    align-content: start;
}

.ap-side-item {
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 10px;
    padding: 9px 11px;
    cursor: pointer;
    font-family: var(--sans);
    display: grid;
    gap: 2px;
}

.ap-side-item:hover {
    background: var(--gray-light);
}

.ap-side-item[aria-current="true"] {
    background: var(--turquoise-soft);
    border-color: rgba(20, 184, 166, 0.35);
}

.ap-side-item strong {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--love-pink);
    line-height: 1.35;
}

.ap-side-item span {
    font-size: 0.72rem;
    color: var(--gray);
}

.ap-main {
    padding: 24px;
    overflow-y: auto;
}

.ap-form {
    max-width: 760px;
    margin: 0 auto;
    display: grid;
    gap: 18px;
}

.ap-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    display: grid;
    gap: 16px;
}

.ap-card h2 {
    font-family: var(--serif);
    font-size: 1.1rem;
    color: var(--love-pink);
    margin: 0;
}

.ap-field {
    display: grid;
    gap: 6px;
}

.ap-field label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--gray);
}

.ap-field .ap-hint {
    font-size: 0.76rem;
    color: #8b9494;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

.ap-field input[type="text"],
.ap-field input[type="password"],
.ap-field textarea,
.ap-field select,
.ap-search {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: var(--sans);
    font-size: 0.94rem;
    color: #1f2937;
    background: #fff;
    transition: var(--transition);
}

.ap-field textarea {
    resize: vertical;
    min-height: 92px;
    line-height: 1.6;
}

.ap-field input:focus,
.ap-field textarea:focus,
.ap-field select:focus,
.ap-search:focus {
    outline: none;
    border-color: var(--turquoise);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.13);
}

.ap-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.ap-check {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.88rem;
    color: var(--gray);
    cursor: pointer;
}

.ap-check input {
    width: 17px;
    height: 17px;
    accent-color: var(--turquoise-dark);
    cursor: pointer;
}

.ap-drop {
    border: 1.5px dashed #c9d6d4;
    border-radius: 12px;
    padding: 22px 16px;
    text-align: center;
    color: var(--gray);
    font-size: 0.86rem;
    background: #fbfdfd;
    cursor: pointer;
    transition: var(--transition);
}

.ap-drop:hover,
.ap-drop[data-over="true"] {
    border-color: var(--turquoise);
    background: var(--turquoise-soft);
    color: var(--turquoise-dark);
}

.ap-drop strong {
    display: block;
    color: var(--turquoise-dark);
    font-size: 0.92rem;
    margin-bottom: 2px;
}

.ap-shots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 12px;
}

.ap-shot {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--gray-light);
    aspect-ratio: 9 / 16;
}

.ap-shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.ap-shot-tools {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    gap: 2px;
    padding: 5px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
}

.ap-shot-tools button {
    flex: 1;
    border: 0;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    font-size: 0.72rem;
    padding: 4px 0;
    cursor: pointer;
}

.ap-shot-tools button:hover {
    background: #fff;
}

.ap-shot-tools button[data-act="remove"] {
    color: #b91c1c;
}

.ap-shot-tools button:disabled {
    opacity: 0.35;
    cursor: default;
}

.ap-shot-progress {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.82);
    font-size: 0.76rem;
    color: var(--turquoise-dark);
    text-align: center;
    padding: 6px;
}

.ap-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.ap-actions .ap-spacer {
    flex: 1;
}

.ap-btn {
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--gray);
    border-radius: 9px;
    padding: 9px 15px;
    font-family: var(--sans);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.ap-btn:hover:not(:disabled) {
    border-color: var(--turquoise);
    color: var(--turquoise-dark);
}

.ap-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ap-btn[data-tone="primary"] {
    background: linear-gradient(135deg, var(--turquoise), var(--turquoise-dark));
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.ap-btn[data-tone="primary"]:hover:not(:disabled) {
    color: #fff;
    box-shadow: var(--shadow-md);
}

.ap-btn[data-tone="danger"] {
    color: #b91c1c;
    border-color: #f3c7c7;
}

.ap-btn[data-tone="danger"]:hover:not(:disabled) {
    background: #fef2f2;
    border-color: #ef4444;
    color: #b91c1c;
}

.ap-empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--gray);
    font-size: 0.9rem;
}

.ap-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 20px);
    background: #111;
    color: #fff;
    padding: 11px 20px;
    border-radius: 50px;
    font-size: 0.86rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.28s ease;
    z-index: 300;
    max-width: 90vw;
    text-align: center;
}

.ap-toast[data-show="true"] {
    opacity: 1;
    transform: translate(-50%, 0);
}

.ap-toast[data-tone="error"] {
    background: #b91c1c;
}

.ap-toast[data-tone="ok"] {
    background: var(--turquoise-dark);
}

.ap-note {
    font-size: 0.8rem;
    color: var(--gray);
    background: #fff;
    border: 1px solid var(--border);
    border-left: 3px solid var(--turquoise);
    border-radius: 8px;
    padding: 11px 13px;
    line-height: 1.6;
}

.ap-note[data-tone="warn"] {
    border-left-color: var(--love-pink);
    background: #fff8fb;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .pv-dialog {
        grid-template-columns: 1fr;
        width: 100vw;
        max-height: 100vh;
        height: 100%;
        margin: 0;
        border-radius: 0;
        overflow-y: auto;
    }

    .pv-stage {
        min-height: 46vh;
        padding: 18px 52px;
    }

    .pv-stage img {
        max-height: 46vh;
    }

    .pv-panel {
        padding: 18px 18px 26px;
    }

    .pv-panel .btn {
        margin-top: 8px;
    }

    .ap-body-grid {
        grid-template-columns: 1fr;
    }

    .ap-side {
        position: static;
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .ap-side-list {
        max-height: 40vh;
    }

    .ap-main {
        padding: 16px;
    }

    .ap-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .pv-toolbar {
        top: var(--pv-header, 76px);
    }

    .pv-row {
        grid-template-columns: 50px minmax(0, 1fr) auto;
        gap: 12px;
        padding: 11px 12px;
    }

    .pv-thumb {
        width: 50px;
        height: 50px;
    }

    .pv-row-title {
        font-size: 0.98rem;
    }

    .pv-row-desc {
        -webkit-line-clamp: 2;
        font-size: 0.82rem;
    }

    .pv-count {
        margin-left: 0;
        width: 100%;
    }

    .pv-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .pv-filters::-webkit-scrollbar {
        display: none;
    }

    .pv-chip {
        flex-shrink: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pv-row,
    .pv-chip,
    .pv-skeleton-row,
    .ap-toast {
        transition: none;
        animation: none;
    }

    .pv-row:hover {
        transform: none;
    }
}
