/* Rotavue Viewer Studio Style Sheets */

/* No web font: the exported viewer makes no third-party request and works offline. */

:root {
  /* Light Mode Variables (Default) */
  --bg-color-radial: radial-gradient(circle at center, #ffffff 0%, #e2e8f0 100%);
  --grid-color: rgba(15, 23, 42, 0.04);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent-color: #f97316; /* Signal Orange */
  --brand-color: #0f172a;  /* brand color */
  
  --panel-bg: rgba(255, 255, 255, 0.85);
  --panel-border: rgba(15, 23, 42, 0.08);
  --panel-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
  
  --btn-bg: transparent;
  --btn-border: rgba(15, 23, 42, 0.08);
  --btn-text: #475569;
  --btn-hover-bg: #0f172a;
  --btn-hover-text: #ffffff;
  --btn-hover-border: #0f172a;

  --modal-bg: rgba(255, 255, 255, 0.95);
  --divider-color: rgba(15, 23, 42, 0.06);

  --brand-watermark-opacity: 0.35;
}

.dark-mode {
  /* Dark Mode Overrides — deeper, richer dark */
  --bg-color-radial: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
  --grid-color: rgba(255, 255, 255, 0.04);
  --text-main: #f1f5f9;
  --text-muted: #64748b;
  --accent-color: #fb923c; /* Warmer Orange for dark */
  --brand-color: #fb923c;  /* brand mark glows orange in dark */
  
  --panel-bg: rgba(2, 6, 23, 0.88);
  --panel-border: rgba(255, 255, 255, 0.06);
  --panel-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  
  --btn-bg: transparent;
  --btn-border: rgba(255, 255, 255, 0.08);
  --btn-text: #94a3b8;
  --btn-hover-bg: #fb923c;
  --btn-hover-text: #020617;
  --btn-hover-border: #fb923c;

  --modal-bg: rgba(2, 6, 23, 0.96);
  --divider-color: rgba(255, 255, 255, 0.06);

  --brand-watermark-opacity: 0.6;
}

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

body {
  background: var(--bg-color-radial);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.5s ease;
}

/* Studio Background Grid */
#grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
  z-index: 1;
}

#viewer-container {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 2;
}

#viewer-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#viewer-canvas:active {
  cursor: grabbing;
}

/* Top Progress Bar */
#progress-bar-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 100;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-color);
  transition: width 0.2s ease, opacity 0.3s ease;
  box-shadow: 0 0 8px var(--accent-color);
}

/* Rotavue brand watermark */
#brand-watermark {
  position: absolute;
  top: 14px;
  left: 16px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--brand-color);
  opacity: var(--brand-watermark-opacity);
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.5s ease, color 0.5s ease;
  text-shadow: 0 0 20px rgba(251, 146, 60, 0);
}

.dark-mode #brand-watermark {
  text-shadow: 0 0 20px rgba(251, 146, 60, 0.3);
}

/* Footer control bar panel shared style */
.hud-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 4px;
  padding: 12px 16px;
  pointer-events: auto;
}

/* Floating Bottom Control Bar */
#controls-wrapper {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

#controls {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 9999px;
  white-space: nowrap;
}

.control-btn {
  flex: 0 0 auto; /* never squeezed into an oval when the bar is narrow */
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn svg {
  transition: transform 0.2s ease;
}

.control-btn:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  border-color: var(--btn-hover-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.control-btn:hover svg {
  transform: scale(1.1);
}

.control-btn:active svg {
  transform: scale(0.95);
}

/* Control groups and separators */
.ctl-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.ctl-sep {
  width: 1px;
  height: 20px;
  background: var(--divider-color);
  margin: 0 6px;
  flex: 0 0 auto;
}

/* The one action people reach for first: a little larger, accent-coloured. */
.control-primary {
  width: 40px;
  height: 40px;
  background: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
}

.control-primary:hover {
  background: var(--accent-color);
  color: #ffffff;
  filter: brightness(1.08);
}

.control-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-color);
}

.control-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.hotkey-note {
  margin: 0 0 16px;
  font-size: 12px;
  opacity: 0.7;
}

/* Tooltip definitions */
.control-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0f172a;
  color: #ffffff;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 500;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.15s ease;
  z-index: 100;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.control-btn:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Interactive Help / Specs Modal */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--modal-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  border-radius: 6px;
  width: 90%;
  max-width: 440px;
  padding: 24px;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
  background: var(--panel-border);
  color: var(--text-main);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.modal-body h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.modal-body ul {
  list-style: none;
  margin-bottom: 20px;
}

.modal-body li {
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--divider-color);
  display: flex;
  justify-content: space-between;
}

.modal-body li span:first-child {
  color: var(--text-muted);
}

.modal-body li span:last-child {
  font-weight: 500;
}

.hotkey-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hotkey-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.hotkey-action {
  color: var(--text-muted);
}

.hotkey-key {
  font-family: ui-monospace, monospace;
  background: var(--panel-border);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}

/* Animations */
@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.5;
  }
}

/* Hide specific class toggles when inactive */
#controls button.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

/* Responsive adjustment: one row always; theme and help give way first */
@media (max-width: 520px) {
  #controls-wrapper {
    bottom: 14px;
  }
  #controls {
    padding: 5px 8px;
  }
  .ctl-sep {
    margin: 0 3px;
  }
  .ctl-optional {
    display: none;
  }
  #brand-watermark {
    top: 10px;
    left: 12px;
    font-size: 10px;
  }
}

/* Hotspot Overlay & Markers Styles */
#hotspot-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5; /* between canvas and HUD panels */
}

.hotspot-marker {
  position: absolute;
  width: 32px; /* overridden per hotspot from its style.size */
  height: 32px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--accent-color);
  background: var(--panel-bg);
  border: 1.5px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hotspot-marker:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  border-color: var(--btn-hover-border);
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 100;
}

.hotspot-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.25;
  pointer-events: none;
  animation: hotspot-pulse-keyframes 2s infinite ease-in-out;
}

@keyframes hotspot-pulse-keyframes {
  0% {
    transform: scale(1);
    opacity: 0.25;
  }
  50% {
    transform: scale(1.6);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

.hotspot-icon {
  width: 55%;
  height: 55%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.marker-icon {
  width: 100%;
  height: 100%;
}

/* Tooltip / Label styling for hotspots */
.hotspot-label {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--modal-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  width: max-content;
  max-width: 200px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.2s ease-in-out;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 101;
}

.hotspot-marker:hover .hotspot-label {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.label-title {
  font-weight: 700;
  margin-bottom: 2px;
  font-size: 12px;
}

.label-description {
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.3;
}

/* Hotspot media popup (F-33 parity with the desktop editor) */
.hotspot-popup {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  animation: hotspot-popup-fade 0.15s ease-out;
}

.hotspot-popup-card {
  position: relative;
  max-width: min(720px, 92vw);
  max-height: 85vh;
  overflow: auto;
  background: var(--bg-panel, #ffffff);
  color: var(--text-main, #1f2937);
  border-radius: 12px;
  padding: 18px 20px 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.hotspot-popup-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted, #6b7280);
}

.hotspot-popup-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
  padding-right: 28px;
}

.hotspot-popup-body img,
.hotspot-popup-body video {
  max-width: 100%;
  max-height: 60vh;
  display: block;
  border-radius: 8px;
}

.hotspot-popup-body iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
}

.hotspot-popup-body a {
  color: var(--accent, #2563eb);
  word-break: break-all;
}

@keyframes hotspot-popup-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
