/* ============================================================
   Studio → Products (js/products-page.js): My products, the AiVirals
   catalog, one product's page, and the reference-sheet maker.
   Cards and dialogs reuse the Profile's (css/profile.css).
   ============================================================ */

.prd-host { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.prd-page {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    box-sizing: border-box;
    width: 100%;
    padding: 32px max(24px, calc((100% - 1120px) / 2)) 48px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
/* The page scrolls; its rows keep their own height (an overflowing flex column would squash them). */
.prd-page > * { flex-shrink: 0; }

/* Title, then the paste bar centered under it. */
.prd-head { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.prd-h1 { margin: 0; }
.prd-sub { margin: 6px 0 0; max-width: 560px; font-size: 13px; line-height: 1.5; color: var(--sl-text-2); }

.prd-paste {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(620px, 100%);
    box-sizing: border-box;
    height: 44px;
    padding: 0 6px 0 14px;
    border-radius: var(--sl-r-10);
    background: var(--sl-panel);
    border: 1px solid var(--sl-border);
    color: var(--sl-text-3);
}
.prd-paste:focus-within { border-color: var(--sl-focus); }
.prd-paste-input { flex: 1; min-width: 0; height: 34px; border: none; background: transparent; padding: 0; }
.prd-paste-input:focus { outline: none; box-shadow: none; }

.prd-note {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 620px;
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
}
.prd-note-info { color: var(--sl-text-2); }
.prd-note-warn { color: var(--sl-warning); }

.prd-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prd-tabs .sl-seg-btn { gap: 6px; }

/* Category chips: one scrolling row. */
.prd-cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.prd-cats::-webkit-scrollbar { display: none; }
.prd-cat {
    flex: none;
    height: 28px;
    padding: 0 11px;
    border-radius: 14px;
    border: 1px solid var(--sl-hairline);
    background: none;
    color: var(--sl-text-2);
    font: inherit;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}
.prd-cat:hover { color: var(--sl-text-1); border-color: var(--sl-border-strong); }
.prd-cat.is-on { background: var(--sl-accent-tint); border-color: var(--sl-accent-line); color: var(--sl-accent-text); }

/* The grids. */
.prd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 18px 14px;
    align-items: start;
}
.prd-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    padding: 0;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    outline: none;
}
.prd-card-photo {
    position: relative;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--sl-r-10);
    background: var(--sl-card);
    color: var(--sl-text-3);
    box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.07);
    transition: box-shadow 0.15s ease;
}
.prd-card-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.prd-card:hover .prd-card-photo { box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.18), var(--sl-shadow-card); }
.prd-card:focus-visible .prd-card-photo { box-shadow: 0 0 0 2px var(--sl-focus); }
.prd-card-name { padding: 0 2px; font-size: 13px; font-weight: 600; color: var(--sl-text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prd-two-lines { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.prd-card-meta { display: flex; align-items: center; gap: 4px; padding: 0 2px; font-size: 11.5px; color: var(--sl-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prd-ok { color: var(--sl-success); }
.prd-badge {
    position: absolute;
    left: 8px;
    top: 8px;
    padding: 2px 7px;
    border-radius: 6px;
    background: oklch(0.13 0.003 250 / 0.78);
    color: var(--sl-text-1);
    font-size: 10.5px;
}

.prd-card-add {
    aspect-ratio: 1;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    text-align: center;
    border: 1px dashed var(--sl-border-strong);
    border-radius: var(--sl-r-10);
}
.prd-card-add:hover { background: var(--sl-wash); border-color: var(--sl-accent-line); }
.prd-card-add-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--sl-quiet); color: var(--sl-link); }
.prd-card-add-label { font-size: 13px; font-weight: 600; color: var(--sl-text-1); }
.prd-card-add-sub { font-size: 11.5px; color: var(--sl-text-3); }

.prd-empty { margin: 6px 0 0; font-size: 13px; color: var(--sl-text-2); }
.prd-hint { margin: 0; font-size: 12px; line-height: 1.45; color: var(--sl-text-3); }
.prd-loading { display: flex; align-items: center; gap: 10px; padding: 18px 0; font-size: 12.5px; color: var(--sl-text-2); }
.prd-more { display: flex; justify-content: center; padding-top: 6px; }
.prd-link { font-size: 12.5px; color: var(--sl-link); text-decoration: none; }
.prd-link:hover { text-decoration: underline; }

/* One product. */
.prd-product { display: flex; flex-direction: column; gap: 22px; }
.prd-back { align-self: flex-start; gap: 4px; margin-left: -6px; }
.prd-product-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.prd-product-cover {
    width: 76px;
    height: 76px;
    flex: none;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--sl-r-10);
    background: var(--sl-card);
    color: var(--sl-text-3);
}
.prd-product-cover img { width: 100%; height: 100%; object-fit: cover; }
.prd-product-text { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 4px; }
.prd-product-name { margin: 0; }
.prd-product-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.prd-product-actions .sl-btn-primary, .prd-product-actions .sl-btn-secondary { gap: 6px; }

.prd-part { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--sl-hairline); }
.prd-part-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prd-part-head .sl-btn-secondary { gap: 6px; }
.prd-part-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--sl-text-1); }

.prd-strip { display: flex; gap: 12px; overflow-x: auto; padding: 6px 2px 4px; }
.prd-tile { position: relative; flex: none; display: flex; flex-direction: column; gap: 5px; width: 112px; }
.prd-tile-wide { width: 220px; }
.prd-tile-img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    overflow: hidden;
    border: none;
    border-radius: var(--sl-r-8);
    background: var(--sl-quiet);
    box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.1);
    cursor: zoom-in;
}
.prd-tile-wide .prd-tile-img { aspect-ratio: 16 / 9; }
.prd-tile-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.prd-tile-wide .prd-tile-img img { object-fit: contain; background: oklch(0.97 0 0); }
.prd-tile-label { font-size: 11.5px; color: var(--sl-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prd-tile-x { top: -6px; right: -6px; }
.prd-tile-img video { display: block; width: 100%; height: 100%; object-fit: cover; }
.prd-tile-img { position: relative; }

/* Stars: on a card (Favorites), on an AI image (keep it first), on a product page. */
.prd-star {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 30px;
    height: 30px;
    padding: 0;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: oklch(0.13 0.003 250 / 0.66);
    color: var(--sl-text-2);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s ease, color 0.12s ease;
}
.prd-card:hover .prd-star, .prd-card:focus-within .prd-star, .prd-star.is-on { opacity: 1; }
.prd-star:hover { color: var(--sl-text-1); }
.prd-star.is-on { color: oklch(0.82 0.15 85); }
.prd-star.is-on svg, .prd-tile-star.is-on svg, .prd-fav-btn.is-on svg { fill: currentColor; }
body.pw-mobile .prd-star { opacity: 1; width: 36px; height: 36px; }

.prd-tile-star {
    position: absolute;
    left: 5px;
    top: 5px;
    width: 22px;
    height: 22px;
    padding: 0;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: oklch(0.13 0.003 250 / 0.7);
    color: var(--sl-text-2);
    cursor: pointer;
}
.prd-tile-star.is-on { color: oklch(0.82 0.15 85); }
.prd-tile.is-starred .prd-tile-img { box-shadow: inset 0 0 0 2px oklch(0.82 0.15 85 / 0.8); }
.prd-fav-btn.is-on { color: oklch(0.82 0.15 85); border-color: oklch(0.82 0.15 85 / 0.5); }

.prd-intro { margin: 0 0 12px; font-size: 13px; color: var(--sl-text-2); }
.prd-empty-box { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.prd-card[role="button"] { cursor: pointer; }
.prd-card:focus-visible { outline: none; }

.prd-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 12.5px; }
.prd-facts dt { color: var(--sl-text-3); }
.prd-facts dd { margin: 0; color: var(--sl-text-1); }
.prd-catalog-box { display: flex; flex-direction: column; gap: 12px; }
.prd-videos { display: flex; flex-direction: column; gap: 6px; }
.prd-video {
    position: relative;
    flex: none;
    width: 96px;
    aspect-ratio: 9 / 16;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--sl-r-8);
    background: var(--sl-quiet);
    color: var(--sl-text-3);
}
.prd-video { padding: 0; border: none; cursor: pointer; font: inherit; }
.prd-video img { width: 100%; height: 100%; object-fit: cover; }
.prd-video-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: oklch(0.13 0.003 250 / 0.7);
    color: var(--sl-text-1);
    opacity: 0.85;
    transition: opacity 0.12s ease, transform 0.12s ease;
}
.prd-video:hover .prd-video-play { opacity: 1; transform: scale(1.08); }
.prd-video:focus-visible { box-shadow: 0 0 0 2px var(--sl-focus); }

/* A catalog video, played in the app. */
.prd-player { z-index: 10400; padding: 24px; box-sizing: border-box; }
.prd-player-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(460px, 100%);
    max-height: 100%;
    padding: 12px;
    box-sizing: border-box;
    border-radius: var(--sl-r-14);
    background: var(--sl-raised);
    border: 1px solid oklch(1 0 0 / 0.1);
    box-shadow: var(--sl-shadow-modal);
}
.prd-player-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prd-player-title { min-width: 0; font-size: 13px; font-weight: 600; color: var(--sl-text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prd-player-x { flex: none; width: 30px; padding: 0; justify-content: center; }
.prd-player video { display: block; width: 100%; max-height: calc(100vh - 150px); border-radius: var(--sl-r-10); background: #000; }
.prd-player-foot { display: flex; gap: 16px; }
.prd-video-views {
    position: absolute;
    left: 5px;
    bottom: 5px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 5px;
    border-radius: 5px;
    background: oklch(0.13 0.003 250 / 0.78);
    color: var(--sl-text-1);
    font-size: 10.5px;
}

/* Dialogs: a catalog product, the sheet maker. */
.prd-dialog { width: min(640px, calc(100vw - 32px)); }
.prd-dialog-body { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.prd-dialog .sl-modal-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prd-title-full { margin: 0; font-size: 13px; line-height: 1.45; color: var(--sl-text-1); }
.prd-add-under { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--sl-text-2); }
.prd-brand-select { width: auto; min-width: 150px; }

.prd-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.prd-pick-item {
    position: relative;
    width: 84px;
    height: 84px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--sl-r-8);
    overflow: hidden;
    background: var(--sl-quiet);
    opacity: 0.55;
    cursor: pointer;
}
.prd-pick-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prd-pick-item.is-on { border-color: var(--sl-accent); opacity: 1; }
.prd-pick-tick {
    position: absolute;
    right: 4px;
    top: 4px;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--sl-accent);
    color: var(--sl-on-accent);
}
.prd-sheet-result { border-radius: var(--sl-r-10); overflow: hidden; background: oklch(0.97 0 0); }
.prd-sheet-result img { display: block; width: 100%; height: auto; }
.prd-spin-sm { width: 12px; height: 12px; border-width: 2px; margin-right: 6px; }

.prd-lightbox { z-index: 10400; cursor: zoom-out; padding: 24px; box-sizing: border-box; }
.prd-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--sl-r-10); background: oklch(0.97 0 0); }

/* Places: room sheets are wide. */
.pf-photo.pf-sheet { width: 136px; }
.pf-photo.pf-sheet a { display: block; width: 100%; height: 100%; border-radius: inherit; overflow: hidden; }
.pf-sheets-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.pf-sheets-wrap .sl-btn-secondary { gap: 6px; }

/* ============================================================
   Studio → Trending videos (js/trending-page.js): the AiVirals feed.
   Shares the page, header and card text styles above.
   ============================================================ */
.trd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 18px 14px; align-items: start; }
.trd-card { display: flex; flex-direction: column; gap: 5px; min-width: 0; cursor: pointer; outline: none; }
.trd-thumb {
    position: relative;
    aspect-ratio: 9 / 16;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--sl-r-10);
    background: var(--sl-card);
    color: var(--sl-text-3);
    box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.07);
}
.trd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trd-card:hover .trd-thumb, .trd-card:focus-visible .trd-thumb { box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.18), var(--sl-shadow-card); }
.trd-card:hover .prd-video-play { opacity: 1; transform: scale(1.08); }
.trd-shop { background: oklch(0.55 0.17 15 / 0.9); }

.trd-overlay { z-index: 10300; padding: 24px; box-sizing: border-box; }
.trd-box {
    display: flex;
    width: min(980px, 100%);
    height: min(720px, 100%);
    overflow: hidden;
    border-radius: var(--sl-r-14);
    background: var(--sl-raised);
    border: 1px solid oklch(1 0 0 / 0.1);
    box-shadow: var(--sl-shadow-modal);
}
.trd-media { flex: none; width: min(405px, 45%); background: #000; display: grid; place-items: center; }
.trd-media video, .trd-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.trd-side { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trd-side-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 16px 10px; border-bottom: 1px solid var(--sl-hairline); }
.trd-side-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.trd-title { font-size: 15px; font-weight: 650; line-height: 1.35; color: var(--sl-text-1); }
.trd-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.trd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.trd-chip { padding: 2px 9px; border-radius: 11px; background: var(--sl-wash); font-size: 11.5px; color: var(--sl-text-2); }
.trd-part { display: flex; flex-direction: column; gap: 4px; }
.trd-text { margin: 0; font-size: 13px; line-height: 1.5; color: var(--sl-text-1); }
.trd-product {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--sl-r-10);
    background: var(--sl-panel);
    border: 1px solid var(--sl-hairline);
}
.trd-product img, .trd-product-ph { width: 48px; height: 48px; flex: none; border-radius: var(--sl-r-8); object-fit: cover; display: grid; place-items: center; background: var(--sl-card); }
.trd-product-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trd-actions { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--sl-hairline); }
.trd-actions .sl-btn-primary { gap: 6px; }
body.pw-mobile .trd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.pw-mobile .trd-overlay { padding: 0; }
body.pw-mobile .trd-box { flex-direction: column; height: 100%; border-radius: 0; }
body.pw-mobile .trd-media { width: 100%; height: 48vh; }

body.pw-mobile .prd-page { padding: 20px 14px 32px; }
body.pw-mobile .prd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.pw-mobile .prd-cat { height: 34px; }
