/* ===== 360 PANORAMA CAPTURE ===== */

.pano-capture-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: none;
}

.pano-capture-overlay .pano-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  z-index: 10002;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
}

.pano-back-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.pano-shot-counter {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  background: rgba(0,0,0,0.5);
  padding: 6px 14px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
}

.pano-camera-viewport {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  height: 210px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 12px;
  overflow: hidden;
  z-index: 10000;
  box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.pano-scene-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10001;
  pointer-events: none;
}

.pano-scene-container canvas {
  width: 100% !important;
  height: 100% !important;
  pointer-events: none;
}

.pano-camera-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pano-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  z-index: 10003;
  pointer-events: none;
}

.pano-reticle-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid #ef4444;
  border-radius: 50%;
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.pano-reticle-ring.locked {
  border-color: #22c55e;
  transform: scale(0.85);
}

.pano-reticle-ring.close {
  border-color: #eab308;
}

.pano-reticle-ring.approaching {
  border-color: #f97316;
}

.pano-reticle-crosshair {
  position: absolute;
  background: currentColor;
}

.pano-reticle-crosshair.h {
  top: 50%;
  left: 25%;
  width: 50%;
  height: 2px;
  transform: translateY(-50%);
}

.pano-reticle-crosshair.v {
  left: 50%;
  top: 25%;
  height: 50%;
  width: 2px;
  transform: translateX(-50%);
}

/* Bubble Level */
.pano-bubble-level {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10003;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pano-bubble-track {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.pano-bubble-crosshair-h {
  position: absolute;
  top: 50%;
  left: 20%;
  width: 60%;
  height: 1px;
  background: rgba(255,255,255,0.15);
  transform: translateY(-0.5px);
}

.pano-bubble-crosshair-v {
  position: absolute;
  left: 50%;
  top: 20%;
  height: 60%;
  width: 1px;
  background: rgba(255,255,255,0.15);
  transform: translateX(-0.5px);
}

.pano-bubble-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  margin-left: -9px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239,68,68,0.6);
  transition: transform 0.15s ease-out, background 0.3s ease, box-shadow 0.3s ease;
}

.pano-bubble-level.approaching .pano-bubble-dot {
  background: #f97316;
  box-shadow: 0 0 8px rgba(249,115,22,0.6);
}

.pano-bubble-level.approaching .pano-bubble-track {
  border-color: rgba(249,115,22,0.5);
}

.pano-bubble-level.close .pano-bubble-dot {
  background: #eab308;
  box-shadow: 0 0 8px rgba(234,179,8,0.6);
}

.pano-bubble-level.close .pano-bubble-track {
  border-color: rgba(234,179,8,0.5);
}

.pano-bubble-level.locked .pano-bubble-dot {
  background: #22c55e;
  box-shadow: 0 0 12px rgba(34,197,94,0.8);
}

.pano-bubble-level.locked .pano-bubble-track {
  border-color: rgba(34,197,94,0.6);
}

.pano-bubble-label {
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  background: rgba(0,0,0,0.5);
  padding: 4px 10px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

.pano-countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 72px;
  font-weight: 700;
  color: #22c55e;
  z-index: 10004;
  text-shadow: 0 4px 12px rgba(0,0,0,0.5);
  animation: pano-countdown-pulse 0.5s ease-in-out;
  pointer-events: none;
}

@keyframes pano-countdown-pulse {
  0% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.8; }
}

.pano-preview-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60vh;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  z-index: 10005;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding: 20px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 48px));
}

.pano-preview-panel.visible {
  transform: translateY(0);
}

.pano-preview-panel .pano-preview-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.pano-preview-panel img {
  flex: 1;
  width: 100%;
  object-fit: contain;
  border-radius: 12px;
  min-height: 0;
}

.pano-preview-actions {
  display: flex;
  gap: 12px;
  padding-top: 16px;
}

.pano-preview-actions button {
  flex: 1;
  padding: 16px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pano-btn-approve {
  background: #22c55e;
  color: #fff;
}

.pano-btn-approve:hover {
  background: #16a34a;
}

.pano-btn-retry {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2) !important;
}

.pano-btn-retry:hover {
  background: rgba(255,255,255,0.15);
}

.pano-instructions {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 10006;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 48px));
  text-align: center;
  color: #fff;
  overflow: hidden;
}

.pano-instructions h3 {
  font-size: 22px;
  margin-bottom: 16px;
}

.pano-instructions p {
  font-size: 16px;
  color: #94a3b8;
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: 32px;
}

.pano-instructions button {
  padding: 16px 48px;
  background: var(--accent, #6366f1);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.pano-progress-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 10010;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #fff;
}

.pano-progress-step {
  font-size: 18px;
  margin-bottom: 24px;
  color: #94a3b8;
}

.pano-progress-bar-container {
  width: 100%;
  max-width: 400px;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 32px;
}

.pano-progress-bar-fill {
  height: 100%;
  background: var(--accent, #6366f1);
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 0%;
}

.pano-progress-sphere {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.2);
  margin-bottom: 24px;
}

.pano-result-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-bottom: env(safe-area-inset-bottom, 48px);
}

.pano-result-actions button {
  padding: 14px 32px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.pano-btn-save {
  background: #22c55e;
  color: #fff;
}

.pano-btn-discard {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.pano-status-badge {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 10002;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

/* ===== CAMERA SETTINGS PANEL ===== */
#camera-settings-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(20px);
  z-index: 10020;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.5);
  animation: cam-slide-in 0.3s ease-out;
}

@keyframes cam-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.cam-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.cam-panel-header h3 {
  color: #fff;
  font-size: 16px;
  margin: 0;
}

.cam-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
}

.cam-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 48px));
}

.cam-panel-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 48px));
}

.cam-section {
  margin-bottom: 16px;
}

.cam-section-title {
  color: #6366f1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.cam-control {
  margin-bottom: 12px;
}

.cam-control-header {
  display: flex;
  justify-content: space-between;
  color: #e2e8f0;
  font-size: 13px;
  margin-bottom: 4px;
}

.cam-control-header span:last-child {
  color: #94a3b8;
  font-size: 12px;
}

.cam-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
}

.cam-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6366f1;
  cursor: pointer;
  border: 2px solid #fff;
}

.cam-select {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
}

.cam-select option {
  background: #1e293b;
  color: #e2e8f0;
}

.cam-info {
  color: #64748b;
  font-size: 11px;
  margin-top: 6px;
}

.cam-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #e2e8f0;
  font-size: 13px;
}

.cam-switch {
  position: relative;
  width: 44px;
  height: 24px;
}

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

.cam-switch-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.cam-switch-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.cam-switch input:checked + .cam-switch-slider {
  background: #6366f1;
}

.cam-switch input:checked + .cam-switch-slider::before {
  transform: translateX(20px);
}

.cam-reset-btn {
  width: 100%;
  padding: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #ef4444;
  font-size: 13px;
  cursor: pointer;
}

.pano-settings-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}
