/* ---------- Trigger button (product page) ---------- */
.tv-trigger{display:inline-flex;align-items:center;gap:14px;margin:26px 0 6px;padding:0;background:none;border:0;cursor:pointer;font-family:inherit;color:#555;font-size:14px;letter-spacing:.06em;text-transform:uppercase;transition:color .3s}
.tv-trigger .tv-eye{flex:none;width:46px;height:46px;border-radius:50%;background:#f4f2ee;display:grid;place-items:center;transition:.3s}
.tv-trigger .tv-eye svg{width:20px;height:20px;color:#666}
.tv-trigger:hover{color:#111}
.tv-trigger:hover .tv-eye{background:#d4af37}
.tv-trigger:hover .tv-eye svg{color:#fff}

/* ---------- Modal shell ---------- */
.tv-modal{position:fixed;inset:0;z-index:100000;background:#fff;display:none;flex-direction:column;font-family:Inter,Montserrat,Arial,sans-serif;color:#2b2b2b}
.tv-modal.open{display:flex}
.tv-modal *{box-sizing:border-box}
body.tv-lock{overflow:hidden}
.tv-top{display:flex;align-items:center;gap:18px;padding:22px 40px 10px}
.tv-icon-btn{width:42px;height:42px;border:0;background:none;border-radius:50%;display:grid;place-items:center;cursor:pointer;color:#444;flex:none;transition:.2s}
.tv-icon-btn:hover{background:#f2f0ec}
.tv-icon-btn svg{width:22px;height:22px}
.tv-product{display:flex;align-items:center;gap:20px;border:1px solid #e7e4df;border-radius:10px;padding:8px 22px 8px 8px;min-width:0;max-width:720px;flex:1}
.tv-product img.tv-swatch{width:96px;height:96px;object-fit:cover;border-radius:7px;flex:none;background:#f3f1ec}
.tv-product .tv-pname{font-size:16px;font-weight:600;color:#444;flex:1;min-width:0}
.tv-product .tv-pname small{display:block;font-weight:400;color:#999;font-size:12.5px;margin-top:3px}
.tv-product img.tv-logo{height:30px;width:auto;flex:none}
.tv-close{margin-inline-start:auto}

.tv-body{flex:1;min-height:0;overflow:auto;padding:16px 40px 40px}
.tv-home{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);gap:40px}
.tv-h{font-size:clamp(22px,2.3vw,32px);font-weight:700;margin:0 0 22px;color:#2b2b2b;letter-spacing:-.01em}
.tv-h em{font-style:normal;color:#b07a1f}
.tv-h.light{color:#666;font-weight:600}

.tv-upload-box{background:#f2f2f2;border-radius:16px;padding:22px;display:grid;grid-template-columns:1fr 1fr;gap:22px}
.tv-drop,.tv-qr{background:#fafafa;border-radius:14px;min-height:180px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:20px;gap:8px}
.tv-drop{border:1.5px dashed #c9c9c9;cursor:pointer;transition:.25s}
.tv-drop:hover,.tv-drop.drag{border-color:#b07a1f;background:#fff}
.tv-drop svg{width:62px;height:62px;color:#2b2b2b}
.tv-drop b,.tv-qr b{font-size:17px;font-weight:600}
.tv-drop span,.tv-qr span{font-size:12.5px;color:#444}
.tv-drop u{cursor:pointer}
.tv-qr .tv-qr-code{width:96px;height:96px}
.tv-qr .tv-qr-code img,.tv-qr .tv-qr-code canvas{width:96px!important;height:96px!important}
.tv-camera-btn{display:none}
.tv-steps{list-style:none;margin:30px 0 0;padding:0;display:grid;gap:18px}
.tv-steps li{display:flex;align-items:center;gap:14px;font-size:15.5px;font-weight:600;color:#2b2b2b}
.tv-steps svg{width:28px;height:28px;flex:none}

.tv-rooms{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px 30px}
.tv-room{cursor:pointer;background:none;border:0;padding:0;text-align:start;font-family:inherit}
.tv-room .tv-thumb{aspect-ratio:4/3;border-radius:8px;overflow:hidden;background:#eeece8 linear-gradient(110deg,#eeece8 30%,#f7f6f3 50%,#eeece8 70%) 0 0/300% 100%;animation:tvShimmer 1.4s linear infinite}
.tv-room .tv-thumb.ready{animation:none;background:#eeece8}
.tv-room .tv-thumb img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .5s}
.tv-room:hover .tv-thumb img{transform:scale(1.05)}
.tv-room span{display:block;margin-top:9px;font-size:14.5px;font-weight:600;color:#666}
@keyframes tvShimmer{to{background-position:-300% 0}}

/* ---------- Viewer (room or photo) ---------- */
.tv-viewer{display:none;grid-template-columns:minmax(0,1fr) 300px;gap:26px;height:100%}
.tv-modal.viewing .tv-home{display:none}
.tv-modal.viewing .tv-viewer{display:grid}
.tv-stage{position:relative;background:#f2f0ec;border-radius:14px;overflow:hidden;min-height:420px;touch-action:none}
.tv-stage canvas{display:block;width:100%;height:100%}
.tv-stage .tv-hint{position:absolute;left:50%;bottom:16px;transform:translateX(-50%);background:rgba(20,20,20,.72);color:#fff;font-size:12.5px;padding:8px 16px;border-radius:999px;pointer-events:none;white-space:nowrap;transition:opacity .4s}
.tv-loading{position:absolute;inset:0;display:grid;place-items:center;background:#f2f0ec;font-size:14px;color:#777;z-index:3}
.tv-loading::before{content:"";width:34px;height:34px;border:3px solid #ddd;border-top-color:#b07a1f;border-radius:50%;animation:tvSpin .8s linear infinite;margin-bottom:60px;position:absolute}
@keyframes tvSpin{to{transform:rotate(360deg)}}
.tv-handle{position:absolute;width:26px;height:26px;margin:-13px 0 0 -13px;border-radius:50%;background:#fff;border:3px solid #b07a1f;box-shadow:0 2px 8px rgba(0,0,0,.35);cursor:grab;z-index:4;touch-action:none}
.tv-handle:active{cursor:grabbing}
.tv-quad-svg{position:absolute;inset:0;pointer-events:none;z-index:3}

.tv-panel{display:flex;flex-direction:column;gap:22px;overflow-y:auto;overflow-x:hidden}
.tv-panel h4{margin:0 0 10px;font-size:12px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:#999}
.tv-seg{display:flex;background:#f2f0ec;border-radius:10px;padding:4px;gap:4px}
.tv-seg button{flex:1;border:0;background:none;padding:10px 6px;border-radius:7px;font-family:inherit;font-size:13.5px;font-weight:600;color:#666;cursor:pointer}
.tv-seg button.on{background:#fff;color:#2b2b2b;box-shadow:0 1px 4px rgba(0,0,0,.12)}
.tv-range{width:100%;accent-color:#b07a1f}
.tv-row{display:flex;justify-content:space-between;font-size:13px;color:#777;margin-top:4px}
.tv-mini-rooms{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.tv-mini-rooms button{border:2px solid transparent;border-radius:8px;padding:0;overflow:hidden;cursor:pointer;aspect-ratio:4/3;background:#eee}
.tv-mini-rooms button.on{border-color:#b07a1f}
.tv-mini-rooms img{width:100%;height:100%;object-fit:cover;display:block}
.tv-actions{display:grid;gap:10px;margin-top:auto}
.tv-btn{display:flex;align-items:center;justify-content:center;gap:10px;padding:14px 18px;border-radius:10px;border:1px solid #2b2b2b;background:#2b2b2b;color:#fff;font-family:inherit;font-size:12.5px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;cursor:pointer;text-decoration:none;transition:.25s}
.tv-btn:hover{background:#b07a1f;border-color:#b07a1f;color:#fff}
.tv-btn.ghost{background:#fff;color:#2b2b2b}
.tv-btn.ghost:hover{background:#f2f0ec;color:#2b2b2b;border-color:#2b2b2b}
.tv-btn svg{width:17px;height:17px}
.tv-note{font-size:12px;color:#999;line-height:1.6}

[dir=rtl] .tv-back svg{transform:scaleX(-1)}

/* ---------- Responsive ---------- */
@media (max-width:1100px){
  .tv-home{grid-template-columns:1fr}
  .tv-viewer{grid-template-columns:1fr;grid-template-rows:minmax(320px,62vh) auto;height:auto}
}
@media (max-width:700px){
  .tv-top{padding:12px 14px 6px;gap:8px}
  .tv-product{padding:6px 12px 6px 6px;gap:12px}
  .tv-product img.tv-swatch{width:56px;height:56px}
  .tv-product .tv-pname{font-size:14px}
  .tv-product img.tv-logo{display:none}
  .tv-body{padding:10px 14px 30px}
  .tv-upload-box{grid-template-columns:1fr;padding:14px}
  .tv-qr{display:none}
  .tv-camera-btn{display:flex}
  .tv-drop{min-height:150px}
  .tv-rooms{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
  .tv-steps{display:none}
  .tv-viewer{grid-template-rows:minmax(280px,52vh) auto}
}

/* ---------- Photo rooms: before/after, AI loading ---------- */
.tv-stage canvas{position:absolute}
.tv-compare{position:absolute;z-index:2;cursor:ew-resize;touch-action:none}
.tv-compare[hidden]{display:none}
.tv-compare img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none}
.tv-split{position:absolute;top:0;bottom:0;width:2px;margin-left:-1px;background:#fff;box-shadow:0 0 6px rgba(0,0,0,.4);pointer-events:none}
.tv-split span{position:absolute;top:50%;left:50%;width:38px;height:38px;margin:-19px 0 0 -19px;border-radius:50%;background:#fff;box-shadow:0 2px 10px rgba(0,0,0,.35)}
.tv-split span::before,.tv-split span::after{content:"";position:absolute;top:50%;width:0;height:0;border:6px solid transparent;margin-top:-6px}
.tv-split span::before{left:5px;border-right-color:#b07a1f}
.tv-split span::after{right:5px;border-left-color:#b07a1f}
.tv-loading.tv-ai{background:rgba(242,240,236,.82);backdrop-filter:blur(2px)}
.tv-loading.tv-ai::before{display:none}
.tv-loading.tv-ai b{display:block;font-size:15px;color:#2b2b2b;margin-bottom:12px;text-align:center}
.tv-bar{width:220px;height:4px;background:#e2ddd5;border-radius:4px;overflow:hidden;margin:0 auto}
.tv-bar i{display:block;height:100%;width:8%;background:#b07a1f;transition:width .3s}
.tv-check{display:flex;align-items:center;gap:10px;font-size:14px;font-weight:600;color:#555;cursor:pointer}
.tv-check input{accent-color:#b07a1f;width:17px;height:17px}
.tv-handle[hidden],.tv-quad-svg[hidden]{display:none}
