/* ═══════════════════════════════════════════════════════════════
   XAYDAB PREMIUM — Project Profile Canvas/Slide Viewer
   Dedicated QR-landing experience (/profile-du-an)
   ═══════════════════════════════════════════════════════════════ */

:root {
  --pv-navy-950: #060e1c;
  --pv-navy-900: #0a1628;
  --pv-navy-800: #0f2140;
  --pv-navy-700: #16305a;
  --pv-gold-500: #c9a84c;
  --pv-gold-400: #d4b85c;
  --pv-gold-300: #e0c96d;
  --pv-gold-grad: linear-gradient(135deg, #c9a84c, #e0c96d);
  --pv-text: #f8fafc;
  --pv-muted: #94a3b8;
  --pv-border: rgba(201, 168, 76, 0.22);
  --pv-surface: rgba(15, 33, 64, 0.72);
  --pv-topbar-h: 58px;
  --pv-thumbs-h: 78px;
  --pv-footer-h: 44px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body.xaydab-profile-viewer-body {
  height: 100%;
  background: radial-gradient(circle at 50% 0%, #122647 0%, var(--pv-navy-900) 48%, var(--pv-navy-950) 100%);
  color: var(--pv-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body.xaydab-profile-viewer-body.is-scroll-mode {
  overflow-y: auto;
  overflow-x: hidden;
}

.pv-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
}

body.admin-bar .pv-app {
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
}

body.xaydab-profile-viewer-body.is-scroll-mode .pv-app {
  height: auto;
  min-height: 100dvh;
}

/* ── Top Toolbar ── */
.pv-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--pv-topbar-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--pv-border);
  flex-shrink: 0;
}

.pv-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pv-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--pv-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s;
}

.pv-home-btn:hover {
  border-color: var(--pv-gold-400);
  background: rgba(201, 168, 76, 0.12);
}

.pv-logo-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.pv-logo-img {
  height: 30px;
  width: auto;
  flex-shrink: 0;
}

.pv-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pv-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--pv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pv-subtitle {
  font-size: 11px;
  color: var(--pv-gold-300);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Center Controls ── */
.pv-center-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pv-page-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pv-page-select {
  background: transparent;
  color: var(--pv-gold-300);
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.pv-page-select option {
  background: var(--pv-navy-900);
  color: var(--pv-text);
}

.pv-mode-switch {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 2px;
}

.pv-mode-btn {
  border: none;
  background: transparent;
  color: var(--pv-muted);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.2s, color 0.2s;
}

.pv-mode-btn.is-active {
  background: rgba(201, 168, 76, 0.22);
  color: var(--pv-gold-300);
}

/* ── Right Actions ── */
.pv-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pv-zoom-group {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
}

.pv-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--pv-text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.pv-icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--pv-gold-300);
}

.pv-icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pv-zoom-label {
  min-width: 48px;
  height: 34px;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--pv-text);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.pv-fullscreen-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.pv-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--pv-gold-grad);
  color: #0a1628;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(201, 168, 76, 0.28);
  transition: transform 0.15s, filter 0.15s;
}

.pv-download-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

/* ── Main Stage ── */
.pv-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px 64px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom;
}

body.xaydab-profile-viewer-body.is-scroll-mode .pv-stage {
  display: block;
  overflow: visible;
  padding: 20px 16px 40px;
}

.pv-slide-viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  flex-shrink: 0;
}

.pv-slide-frame {
  position: relative;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(201, 168, 76, 0.26);
  user-select: none;
  -webkit-user-select: none;
  line-height: 0;
}

.pv-slide-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pv-link-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pv-link-hotspot {
  position: absolute;
  pointer-events: auto;
  border-radius: 4px;
  transition: background 0.15s, box-shadow 0.15s;
}

.pv-link-hotspot:hover {
  background: rgba(201, 168, 76, 0.18);
  box-shadow: 0 0 0 1px rgba(201, 168, 76, 0.65);
}

/* ── Nav Arrows ── */
.pv-nav-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: 44px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 22, 40, 0.72);
  backdrop-filter: blur(10px);
  color: var(--pv-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, opacity 0.2s;
}

.pv-nav-arrow:hover:not(:disabled) {
  background: rgba(201, 168, 76, 0.24);
  border-color: var(--pv-gold-400);
  color: var(--pv-gold-300);
}

.pv-nav-arrow:disabled {
  opacity: 0.2;
  cursor: default;
}

.pv-nav-prev {
  left: 14px;
}

.pv-nav-next {
  right: 14px;
}

body.xaydab-profile-viewer-body.is-scroll-mode .pv-nav-arrow,
body.xaydab-profile-viewer-body.is-scroll-mode .pv-thumbs-wrap {
  display: none;
}

/* ── Scroll Mode Stack ── */
.pv-scroll-stack {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 1120px;
  margin: 0 auto;
}

body.xaydab-profile-viewer-body.is-scroll-mode .pv-slide-viewport {
  display: none;
}

body.xaydab-profile-viewer-body.is-scroll-mode .pv-scroll-stack {
  display: flex;
}

.pv-scroll-card {
  position: relative;
  width: 100%;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(201, 168, 76, 0.22);
  aspect-ratio: 16 / 9;
}

.pv-scroll-card canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.pv-scroll-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(10, 22, 40, 0.78);
  color: var(--pv-gold-300);
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

/* ── Loading & Error Overlay ── */
.pv-status-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: rgba(6, 14, 28, 0.86);
  backdrop-filter: blur(8px);
}

.pv-status-overlay.is-hidden {
  display: none;
}

.pv-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(201, 168, 76, 0.22);
  border-top-color: var(--pv-gold-400);
  animation: pv-spin 0.85s linear infinite;
}

@keyframes pv-spin {
  to {
    transform: rotate(360deg);
  }
}

.pv-progress-bar {
  width: min(260px, 75vw);
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.pv-progress-fill {
  height: 100%;
  width: 8%;
  border-radius: 999px;
  background: var(--pv-gold-grad);
  transition: width 0.2s ease;
}

.pv-status-text {
  font-size: 14px;
  color: var(--pv-text);
  font-weight: 500;
}

.pv-status-sub {
  font-size: 12px;
  color: var(--pv-muted);
}

.pv-retry-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--pv-gold-400);
  background: rgba(201, 168, 76, 0.16);
  color: var(--pv-gold-300);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Bottom Thumbnail Strip ── */
.pv-thumbs-wrap {
  height: var(--pv-thumbs-h);
  flex-shrink: 0;
  background: rgba(10, 22, 40, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  padding: 0 12px;
}

.pv-thumbs-track {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 4px;
  width: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 168, 76, 0.45) transparent;
}

.pv-thumb-btn {
  position: relative;
  flex: 0 0 auto;
  width: 92px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  background: #142544;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, transform 0.15s;
}

.pv-thumb-btn:hover {
  border-color: rgba(201, 168, 76, 0.7);
}

.pv-thumb-btn.is-active {
  border-color: var(--pv-gold-400);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.25);
  transform: translateY(-2px);
}

.pv-thumb-btn canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.pv-thumb-num {
  position: absolute;
  bottom: 3px;
  right: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(6, 14, 28, 0.8);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

/* ── Bottom Quick-Action Contact Bar ── */
.pv-footer-bar {
  height: var(--pv-footer-h);
  flex-shrink: 0;
  background: rgba(6, 14, 28, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--pv-muted);
}

.pv-footer-hint {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pv-footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.pv-footer-cta {
  color: var(--pv-gold-300);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.pv-footer-cta:hover {
  text-decoration: underline;
}

/* ── Mobile Responsive (< 768px) ── */
@media (max-width: 768px) {
  :root {
    --pv-topbar-h: 54px;
    --pv-thumbs-h: 64px;
    --pv-footer-h: 42px;
  }

  .pv-topbar {
    padding: 0 10px;
    gap: 6px;
  }

  .pv-title-group,
  .pv-zoom-group,
  .pv-fullscreen-btn,
  .pv-home-label,
  .pv-footer-hint {
    display: none;
  }

  .pv-home-btn {
    padding: 6px 8px;
  }

  .pv-logo-img {
    height: 24px;
  }

  .pv-mode-btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  .pv-download-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .pv-stage {
    padding: 10px 8px;
  }

  .pv-nav-arrow {
    top: auto;
    bottom: calc(var(--pv-thumbs-h) + var(--pv-footer-h) + 12px);
    transform: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }

  .pv-nav-prev {
    left: 12px;
  }

  .pv-nav-next {
    right: 12px;
  }

  .pv-thumb-btn {
    width: 72px;
  }

  .pv-footer-bar {
    justify-content: center;
  }
}