/**
 * 3D Sphere Studio - Stylesheet & HUD Layout
 * 100% Fluid, Mobile-Responsive Design System
 */

/* 3D Stage Viewport */
.sphere-stage-wrapper {
  position: relative;
  width: 100%;
  height: 520px;
  background: #060913;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8), 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

#sphereCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#sphereCanvas:active {
  cursor: grabbing;
}

/* Stage Floating HUD Overlay */
.stage-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.hud-badge-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  animation: pulse-hud 2s infinite ease-in-out;
}

@keyframes pulse-hud {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.stage-hud-bottom {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.stage-instructions-hint {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.stage-actions-group {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.stage-icon-btn {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stage-icon-btn:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  transform: scale(1.05);
}

/* Preset Carousel Pills */
.preset-pills-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  margin-bottom: 18px;
}

.preset-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-pill:hover {
  border-color: var(--brand-primary);
  color: #fff;
  transform: translateY(-1px);
}

.preset-pill.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

/* Upload Dropzone */
.dropzone-compact {
  display: block;
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  background: rgba(15, 23, 42, 0.5);
  cursor: pointer;
  transition: all 0.25s ease;
  margin-bottom: 16px;
  user-select: none;
}

.dropzone-compact:hover,
.dropzone-compact.drag-over {
  border-color: var(--brand-primary);
  background: rgba(99, 102, 241, 0.12);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

.dropzone-icon {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.dropzone-text {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dropzone-browse-link {
  color: var(--brand-primary, #6366f1);
  text-decoration: underline;
  font-weight: 700;
}

.dropzone-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.dropzone-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.76rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dropzone-compact:hover .dropzone-action-btn {
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

/* Color Picker Row */
.color-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.color-input-styled {
  width: 44px;
  height: 28px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

/* Modal for Video Recording Progress */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

/* Mobile & Tablet Responsiveness */
@media (max-width: 1024px) {
  .sphere-stage-wrapper {
    height: 440px;
  }
}

@media (max-width: 768px) {
  .sphere-stage-wrapper {
    height: 350px;
  }
  .stage-instructions-hint {
    display: none;
  }
}

@media (max-width: 480px) {
  .sphere-stage-wrapper {
    height: 300px;
  }
}

/* Upload Preview Box */
.upload-preview-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md, 8px);
  padding: 8px 12px;
  margin-top: 10px;
}

.upload-preview-img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #000;
}

.upload-preview-info {
  flex: 1;
  min-width: 0;
}

.upload-preview-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-preview-dims {
  font-size: 0.72rem;
  color: var(--text-secondary, #94a3b8);
  font-family: var(--font-mono, monospace);
}

.btn-clear-thumb {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-secondary, #94a3b8);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.btn-clear-thumb:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

/* Toast Pill */
.toast-pill {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #fff;
  border: 1px solid rgba(99, 102, 241, 0.4);
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100000;
}

.toast-pill.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-pill.success {
  border-color: #10b981;
}

.toast-pill.error {
  border-color: #ef4444;
  color: #fca5a5;
}

/* Toggle Switch Safeguards */
.switch-toggle,
.toggle-switch {
  position: relative !important;
  display: inline-block !important;
  width: 44px !important;
  height: 24px !important;
  flex-shrink: 0;
  vertical-align: middle;
}

.switch-toggle input,
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute !important;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .2s;
  border-radius: 24px;
}

