/* =====================================================================
   CardLink Pro v4.6 - Card Design Studio (guest editor + live preview)
   v4.5: the studio uses the SAME editor widgets as the user panel
   (design-grid / soc-picker / link rows / fa-picker come from style.css)
   and the live preview renders the REAL .pub-card design, scaled to a
   phone frame. stu- namespace only for the studio layout itself.
   v4.6: the preview sits in a TRUE phone frame - fixed width + height,
   the card scrolls inside the screen like a real mobile page - and a
   small design slider (.stu-dsg-*) with slide navigation sits under the
   phone so visitors can slide through every design and re-theme the
   preview instantly.
   ===================================================================== */

/* ---------- layout: Card Info | Links | Live preview ---------- */
.stu-grid{display:grid;gap:24px;align-items:start;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 320px}
.stu-form{grid-column:1;grid-row:1}
.stu-linkscol{grid-column:2;grid-row:1}
.stu-side{grid-column:3;grid-row:1;position:sticky;top:88px;display:flex;flex-direction:column}
@media (max-width:1199px){
  .stu-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .stu-side{grid-column:1/-1;grid-row:1;position:static}
  .stu-form{grid-column:1;grid-row:2}
  .stu-linkscol{grid-column:2;grid-row:2}
}
@media (max-width:991px){
  .stu-grid{grid-template-columns:minmax(0,1fr)}
  .stu-side{grid-column:1;grid-row:1}
  .stu-form{grid-column:1;grid-row:2}
  .stu-linkscol{grid-column:1;grid-row:3}
}

/* ---------- preview rail: v4.6 TRUE PHONE FRAME ----------
   Fixed width AND height like a real phone - the card no longer stretches
   the frame; it SCROLLS inside the screen exactly like a mobile page
   (#stuPreview is the screen). The notch pill overlays the top like on a
   real device while the content scrolls under it. */
.stu-preview .card-title{margin-bottom:14px}
.stu-phone{position:relative;margin:0 auto 14px;width:100%;max-width:330px;height:620px;border-radius:36px;border:11px solid #0f172a;overflow:hidden;background:#fff;box-shadow:0 18px 40px rgba(2,8,20,.16),0 2px 0 2px rgba(15,23,42,.35)}
.stu-phone::before{content:"";position:absolute;top:9px;left:50%;transform:translateX(-50%);width:88px;height:17px;border-radius:12px;background:#0f172a;z-index:6}
.stu-phone::after{content:"";position:absolute;bottom:7px;left:50%;transform:translateX(-50%);width:92px;height:4px;border-radius:99px;background:rgba(15,23,42,.18);z-index:6;pointer-events:none}
.stu-phone #stuPreview{position:absolute;inset:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;scrollbar-width:none}
.stu-phone #stuPreview::-webkit-scrollbar{width:0;height:0}
.stu-phone:hover #stuPreview{scrollbar-width:thin;scrollbar-color:rgba(15,23,42,.22) transparent}
.stu-phone:hover #stuPreview::-webkit-scrollbar{width:4px}
.stu-phone:hover #stuPreview::-webkit-scrollbar-thumb{background:rgba(15,23,42,.22);border-radius:99px}

/* ---------- REAL pub-card inside the phone frame ----------
   Identical markup/design as card.php - only the geometry is scaled so
   the card renders like the phone breakpoint of the public page. */
.stu-phone .pub-card{max-width:none;margin:0;padding:26px 16px 22px}
.stu-phone .pub-cover{height:116px;border-radius:14px}
.stu-phone .pub-avatar{width:68px;height:68px;margin:-34px auto 0;border-width:4px}
.stu-phone .pub-head h1{font-size:1.08rem;margin:8px 0 3px}
.stu-phone .pub-head .pub-about{font-size:.8rem}
.stu-phone .pub-stats{font-size:.68rem;gap:14px;margin-top:10px}
.stu-phone .social-btn{width:34px;height:34px;font-size:.85rem;border-radius:10px}
.stu-phone .social-row{gap:8px;margin:14px 0 4px}
.stu-phone .links-heading{font-size:.85rem;margin:16px 0 10px}
.stu-phone .link-btn{padding:9px 12px;font-size:.8rem;gap:9px;margin-bottom:8px}
.stu-phone .link-btn .lb-icon{font-size:1rem;width:24px}
.stu-phone .link-btn .lb-thumb{width:38px;height:38px;border-radius:8px}
.stu-phone .link-btn .lb-desc,.stu-phone .link-btn .lb-price{font-size:.68rem}
.stu-phone .link-btn .lb-offer{font-size:.58rem;padding:2px 7px}
.stu-phone .link-btn .lb-arrow{font-size:.8rem}
.stu-phone .pub-card .report-bar{display:none}
.stu-phone .links-grid{grid-template-columns:repeat(auto-fill,minmax(110px,1fr))!important}

/* ---------- inline in homepage builder section ---------- */
.hs-section .stu, .hs-band + .hs-section .stu{margin:0}
.hs-stu-wrap{max-width:1180px;margin:0 auto}
.hs-stu-wrap .stu-phone{max-width:300px;height:570px}

/* ---------- v4.6 MINI DESIGN SLIDER (live preview rail) ----------
   Small design tiles in a draggable horizontal slider with prev/next
   buttons. Same design-tile markup as the Card design grid (same radios)
   - only the geometry is smaller. */
.stu-dsg{margin-top:4px;border:1px solid var(--border);border-radius:14px;background:var(--surface);padding:10px 10px 9px}
.stu-dsg-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
.stu-dsg-title{font-weight:700;font-size:.85rem;display:inline-flex;align-items:center;gap:7px;color:var(--text)}
.stu-dsg-nav{display:flex;gap:6px}
.stu-dsg-btn{width:30px;height:30px;border-radius:9px;border:1px solid var(--border);background:var(--bg);color:var(--text);display:inline-flex;align-items:center;justify-content:center;font-size:.72rem;cursor:pointer;transition:all .15s}
.stu-dsg-btn:hover{border-color:var(--primary);color:var(--primary)}
.stu-dsg-btn:disabled{opacity:.4;cursor:not-allowed;border-color:var(--border);color:var(--muted)}
.stu-dsg-viewport{overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;border-radius:10px}
.stu-dsg-viewport::-webkit-scrollbar{display:none}
.stu-dsg-track{display:flex;gap:8px;width:max-content}
.stu-dsg-tile{flex:0 0 auto;width:88px;gap:6px;padding:8px;border-radius:12px}
.stu-dsg-tile .dt-preview{height:62px;padding:8px;gap:4px;border-radius:9px}
.stu-dsg-tile .dt-avatar{width:14px;height:14px;border-width:0}
.stu-dsg-tile .dt-line{width:34px;height:4px}
.stu-dsg-tile .dt-btn{height:9px;border-radius:4px}
.stu-dsg-tile .dt-name{font-size:.6rem;line-height:1.15}
.stu-dsg-tile:has(input:checked)::after{top:6px;right:6px;width:15px;height:15px;font-size:.5rem}
.stu-dsg-tile.dt-locked .dt-lock{top:6px;right:6px;font-size:.56rem;padding:1px 6px}
.stu-dsg-hint{margin-top:8px;text-align:center;font-size:.68rem}

.stu-foot{margin-top:16px;display:grid;gap:8px}
.stu-publish.busy{opacity:.75;pointer-events:none}

/* ---------- showcase slides: real card preview scaled to the slide --- */
.hs-tpl-preview{padding:14px 14px 0;background:linear-gradient(180deg,color-mix(in srgb,var(--primary) 7%,transparent),transparent 70%)}
.hs-tpl-preview .pub-pv{margin:0}
.hs-tpl-preview .pub-card{max-width:none;margin:0;padding:18px 14px 14px;border-radius:14px 14px 0 0;box-shadow:none}
.hs-tpl-preview .pub-cover{height:96px;border-radius:12px}
.hs-tpl-preview .pub-avatar{width:56px;height:56px;margin:-28px auto 0;border-width:3px}
.hs-tpl-preview .pub-head h1{font-size:.95rem;margin:6px 0 2px}
.hs-tpl-preview .pub-head .pub-about{font-size:.72rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.hs-tpl-preview .pub-stats{display:none}
.hs-tpl-preview .social-btn{width:28px;height:28px;font-size:.72rem;border-radius:8px}
.hs-tpl-preview .social-row{gap:6px;margin:12px 0 2px}
.hs-tpl-preview .links-heading{font-size:.78rem;margin:12px 0 8px}
.hs-tpl-preview .link-btn{padding:7px 10px;font-size:.74rem;gap:8px;margin-bottom:7px}
.hs-tpl-preview .link-btn .lb-icon{font-size:.9rem;width:20px}
.hs-tpl-preview .link-btn .lb-desc,.hs-tpl-preview .link-btn .lb-price{font-size:.64rem}
.hs-tpl-preview .link-btn .lb-arrow{font-size:.7rem}
.hs-tpl-preview .links-grid{grid-template-columns:repeat(auto-fill,minmax(96px,1fr))!important}
.hs-tpl-preview .pub-card .report-bar{display:none}
.hs-tpl-preview .pub-card{padding-bottom:16px}

/* ---------- scrollbar polish ---------- */
.stu-preview::-webkit-scrollbar{width:8px}
.stu-preview::-webkit-scrollbar-thumb{background:var(--border);border-radius:8px}

/* ---------- v4.6 phone frame on small screens ----------
   Keeps the TRUE phone proportions on narrow viewports instead of
   shrinking into a wide, short box. */
@media (max-width:480px){
  .stu-phone{max-width:292px;height:540px;border-radius:32px;border-width:10px}
  .hs-stu-wrap .stu-phone{max-width:280px;height:500px}
}

@media (prefers-reduced-motion: reduce){
  .stu-publish{transition:none}
}
