/* ================================================================
   Virtual Try-On — Styles
   ================================================================ */

.vto-overlay {
  display: none; position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.72); backdrop-filter: blur(3px);
}
.vto-overlay.is-open { display: block; }

.vto-modal {
  position: fixed; inset: 0; z-index: 10001;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.vto-modal.is-open { display: flex; }

.vto-dialog {
  position: relative; background: #fff; border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.28);
  padding: 32px 28px 24px; width: 100%; max-height: 92vh; overflow-y: auto;
  animation: vto-in 0.22s ease;
}
.vto-dialog--sm  { max-width: 520px; }
.vto-dialog--xl  { max-width: 1100px; overflow: hidden; }

@keyframes vto-in {
  from { opacity:0; transform:scale(0.94) translateY(12px); }
  to   { opacity:1; transform:scale(1)    translateY(0);    }
}

.vto-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; cursor: pointer; color: #888;
  padding: 6px; border-radius: 6px; line-height: 1; z-index: 2;
  transition: color 0.15s, background 0.15s;
}
.vto-close:hover { color: #e53e3e; background: #fff0f0; }

/* ── Privacy popup ── */
.vto-icon-wrap { display: flex; justify-content: center; margin-bottom: 12px; }
.vto-modal-title {
  font-family: 'Sora','Poppins',sans-serif; font-size: 1.4rem; font-weight: 700;
  color: #0f2d2a; text-align: center; margin: 0 0 6px;
}
.vto-modal-sub { text-align: center; color: #5a7a76; font-size: 0.9rem; margin: 0 0 20px; }

.vto-policy-body {
  background: #f7fffe; border: 1px solid #d0f0ec; border-radius: 10px;
  padding: 18px 20px; max-height: 260px; overflow-y: auto;
  font-size: 0.87rem; color: #2d4a47; line-height: 1.65; margin-bottom: 22px;
}
.vto-policy-body h3 { font-size: 0.9rem; font-weight: 700; color: #0b7b6b; margin: 14px 0 5px; }
.vto-policy-body h3:first-child { margin-top: 0; }
.vto-policy-body ul { padding-left: 18px; margin: 4px 0 8px; }
.vto-policy-body li { margin-bottom: 3px; }

.vto-policy-actions { display: flex; gap: 12px; justify-content: flex-end; }
.vto-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 22px; border-radius: 8px; font-size: 0.9rem;
  font-weight: 600; cursor: pointer; border: none;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.vto-btn--ghost  { background: #f0f0f0; color: #555; }
.vto-btn--ghost:hover { background: #e0e0e0; }
.vto-btn--primary { background: #0b7b6b; color: #fff; box-shadow: 0 4px 14px rgba(11,123,107,0.28); }
.vto-btn--primary:hover { background: #0a6b5d; }

/* ── Spinner ── */
.vto-cam-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(45,212,191,0.25); border-top-color: #2DD4BF;
  border-radius: 50%; animation: vto-spin 0.75s linear infinite;
}
@keyframes vto-spin { to { transform: rotate(360deg); } }

/* ── Screen-reader-only utility ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── Embedded VTO iframe ── */
.vto-iframe-wrap {
  position: relative;
  width: 100%;
  height: calc(92vh - 56px);
  border-radius: 12px;
  overflow: hidden;
  background: #0f2d2a;
}
.vto-iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  display: block;
}
.vto-iframe-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; color: #fff; font-size: 0.9rem;
  background: rgba(15,45,42,0.92);
}

/* ── Main layout: camera left, frames right ── */
.vto-main-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
  max-height: calc(92vh - 80px);
}

.vto-col-title {
  font-family: 'Sora','Poppins',sans-serif;
  font-size: 1rem; font-weight: 700; color: #0f2d2a;
  margin: 0 0 10px;
}

/* ── Camera column ── */
.vto-camera-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: calc(92vh - 80px);
}

.vto-viewport-wrap {
  position: relative; width: 100%; aspect-ratio: 4/3;
  background: #0f2d2a; border-radius: 12px; overflow: hidden;
}
#vto-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1);
}
#vto-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.vto-cam-status {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: #fff; font-size: 0.9rem; background: rgba(15,45,42,0.85);
  transition: opacity 0.3s;
}
.vto-cam-status.is-hidden { opacity: 0; pointer-events: none; }

.vto-selected-label {
  font-size: 0.85rem; font-weight: 600; color: #0b7b6b;
  text-align: center; min-height: 20px;
}

/* ── Frames column ── */
.vto-frames-col {
  display: flex; flex-direction: column; gap: 8px;
  max-height: calc(92vh - 120px); overflow: hidden;
}

.vto-glasses-grid {
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; flex: 1;
  padding-right: 4px;
}
/* Custom scrollbar */
.vto-glasses-grid::-webkit-scrollbar { width: 4px; }
.vto-glasses-grid::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 4px; }
.vto-glasses-grid::-webkit-scrollbar-thumb { background: #2DD4BF; border-radius: 4px; }

.vto-picker-loading {
  display: flex; align-items: center; gap: 10px;
  color: #5a7a76; font-size: 0.88rem; padding: 8px 0;
}

/* ── Frame card — horizontal layout in sidebar ── */
.vto-thumb-card {
  display: flex; align-items: center; gap: 10px;
  border: 2px solid #e8e8e8; border-radius: 10px; overflow: hidden;
  cursor: pointer; background: #f8f8f8; padding: 6px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.15s;
  flex-shrink: 0;
}
.vto-thumb-card:hover { border-color: #2DD4BF; background: #f0fffe; box-shadow: 0 2px 10px rgba(45,212,191,0.18); }
.vto-thumb-card.is-selected { border-color: #0b7b6b; background: #f0fffe; box-shadow: 0 0 0 3px rgba(11,123,107,0.15); }

.vto-thumb-img-wrap {
  width: 72px; height: 54px; flex-shrink: 0;
  background: #f0f0f0; border-radius: 6px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.vto-thumb-img-wrap img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.vto-thumb-info { flex: 1; min-width: 0; }
.vto-thumb-model {
  font-size: 0.8rem; font-weight: 700; color: #0f2d2a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}
.vto-thumb-brand {
  font-size: 0.72rem; color: #6b8f8b; font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}

/* ── Responsive: stack on mobile ── */
@media (max-width: 700px) {
  .vto-main-layout { grid-template-columns: 1fr; }
  .vto-frames-col { max-height: 200px; }
  .vto-glasses-grid { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  .vto-thumb-card { flex-direction: column; width: 110px; flex-shrink: 0; padding: 8px; }
  .vto-thumb-img-wrap { width: 100%; height: 70px; }
  .vto-dialog--xl { padding: 20px 14px 16px; }
  .vto-policy-actions { flex-direction: column; }
  .vto-btn { justify-content: center; }
}

/* ── Customisation panel ── */
.vto-customise {
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 14px 16px;
  background: #fafafa;
  margin-top: 10px;
  flex-direction: column;
  gap: 14px;
  /* display is controlled by JS: none → flex when a frame is selected */
}

.vto-customise-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vto-frame-name  { font-size: 1rem; font-weight: 700; color: #0f2d2a; }
.vto-frame-brand { font-size: 0.82rem; color: #6b8f8b; }

.vto-option-group { display: flex; flex-direction: column; gap: 8px; }
.vto-option-label {
  font-size: 0.82rem; font-weight: 700; color: #0f2d2a;
  display: flex; align-items: center; gap: 6px;
}
.vto-option-value { font-weight: 400; color: #5a7a76; }

/* ── Color swatches ── */
.vto-swatches { display: flex; flex-wrap: wrap; gap: 8px; }

.vto-swatch {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid #e0e0e0; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  position: relative;
}
.vto-swatch:hover { transform: scale(1.12); border-color: #aaa; }
.vto-swatch.is-selected {
  border-color: #0b7b6b;
  box-shadow: 0 0 0 3px rgba(11,123,107,0.22);
  transform: scale(1.12);
}
/* "No lens" swatch — diagonal line */
.vto-swatch--none {
  background: #fff;
  border-color: #ccc;
}
.vto-swatch--none::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: linear-gradient(
    to bottom right,
    transparent calc(50% - 1px),
    #ccc calc(50% - 1px),
    #ccc calc(50% + 1px),
    transparent calc(50% + 1px)
  );
  border-radius: 50%;
}

/* ── Size buttons ── */
.vto-size-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.vto-size-btn {
  padding: 6px 18px; border-radius: 8px; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; border: 2px solid #e0e0e0; background: #fff; color: #444;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.vto-size-btn:hover { border-color: #2DD4BF; }
.vto-size-btn.is-selected { background: #0f2d2a; color: #fff; border-color: #0f2d2a; }
