/* ==========================================================================
   Rubik's 3D - Scanner & Solver Stylesheet
   ========================================================================== */

.scanner-card {
  gap: 1rem;
}

.scanner-header {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.scanner-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scan-method-pills {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  gap: 3px;
}

.pill-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pill-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.pill-btn.active {
  background: var(--accent-cyan);
  color: #000000;
  font-weight: 700;
}

/* Subviews (Camera, Upload, Manual Net) */
.scanner-subview {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
}

.scanner-subview.active {
  display: flex;
}

/* 1. Camera Viewfinder */
.face-step-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.step-face-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.face-badge-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.face-color-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.viewfinder-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border-glass);
}

#camera-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 3x3 Overlay Grid */
.grid-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72%;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  pointer-events: none;
}

.grid-cell {
  border: 2px dashed rgba(255, 255, 255, 0.75);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
}

.grid-cell.center-cell {
  border: 2px solid var(--accent-cyan);
}

.sample-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

.sample-dot.center {
  background: var(--accent-cyan);
}

.viewfinder-instruction {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: #ffffff;
  white-space: nowrap;
  pointer-events: none;
}

/* 6 Face Thumbnails Tracker */
.scanned-faces-tracker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
}

.face-thumb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.35rem 0.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.face-thumb-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.face-thumb-item.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
}

.thumb-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
}

.thumb-mini-grid {
  width: 32px;
  height: 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: #111;
  padding: 1px;
  border-radius: 3px;
}

.thumb-mini-sticker {
  background: #333;
  border-radius: 1px;
}

.camera-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* 2. Photo Upload Dropzone */
.upload-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.upload-dropzone:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
}

.icon-large {
  font-size: 2.2rem;
  color: var(--accent-cyan);
}

.upload-dropzone h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.upload-dropzone p {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 250px;
}

.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
}

/* 3. 2D Unfolded Cube Net & Color Palette */
.net-editor-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.color-palette-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.4rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.palette-swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.palette-swatch:hover {
  transform: scale(1.15);
}

.palette-swatch.active {
  transform: scale(1.2);
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

/* Unfolded Cube Net */
.unfolded-cube-net {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.net-row {
  display: flex;
  gap: 4px;
}

.net-spacer {
  width: 66px;
  height: 66px;
}

.net-face {
  width: 66px;
  height: 66px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  background: #111215;
  padding: 2px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.net-sticker {
  border-radius: 2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.net-sticker:hover {
  filter: brightness(1.2);
  transform: scale(1.08);
}

.net-sticker.sticker-center {
  cursor: not-allowed;
  position: relative;
}

.net-sticker.sticker-center::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
}

/* Validation & Solve Section */
.solver-validation-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: auto;
}

.validation-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.validation-status.valid {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border-color: rgba(16, 185, 129, 0.3);
}

.validation-status.invalid {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.3);
}

.solve-action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

/* Solution Step-by-Step Player Box */
.solution-player-box {
  background: rgba(15, 17, 26, 0.95);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}

.solution-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.solution-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.solution-title h4 {
  font-size: 0.9rem;
  font-weight: 700;
}

.cube-holding-guide {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(0, 240, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--accent-cyan);
}

.holding-icon {
  font-size: 1.4rem;
  color: var(--accent-cyan);
}

.holding-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.holding-text strong {
  font-size: 0.78rem;
  color: var(--text-main);
}

.holding-text span {
  font-size: 0.72rem;
  color: var(--accent-yellow);
  font-weight: 600;
}

.solution-ribbon {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.4rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.solution-ribbon::-webkit-scrollbar {
  height: 4px;
}

.sol-token {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.sol-token.active {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
  font-weight: 800;
  transform: scale(1.1);
}

.sol-token.done {
  color: var(--text-dim);
  text-decoration: line-through;
  opacity: 0.6;
}

.solution-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}
