/* ========================================================
   Mobile App Scanner View (스마트폰 앱 스캔 화면 전용 스타일)
   ======================================================== */

@import './variables.css';

* {
  -webkit-tap-highlight-color: transparent;
}

body.mobile-scan-body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000000;
  color: var(--text-main);
  font-family: var(--font-body);
  user-select: none;
  touch-action: manipulation;
}

/* 1. Fullscreen Camera Layer */
.mobile-camera-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #05070f;
}

#mobile-reader {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
}

#mobile-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* 2. Dimmed Viewport Mask with Central Cutout */
.scanner-mask-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.scan-target-box {
  width: min(72vw, 280px);
  height: min(72vw, 280px);
  position: relative;
  border-radius: 24px;
  box-shadow: 0 0 0 9999px rgba(5, 7, 15, 0.65);
  box-sizing: content-box;
}

/* 4 Glowing Corner Brackets */
.corner-bracket {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: #06b6d4;
  border-style: solid;
  pointer-events: none;
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.8));
}

.corner-tl {
  top: -2px;
  left: -2px;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 20px;
}

.corner-tr {
  top: -2px;
  right: -2px;
  border-width: 4px 4px 0 0;
  border-top-right-radius: 20px;
}

.corner-bl {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 4px 4px;
  border-bottom-left-radius: 20px;
}

.corner-br {
  bottom: -2px;
  right: -2px;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 20px;
}

/* Animated Cyber Laser Line */
.scan-laser-line {
  position: absolute;
  left: 5%;
  right: 5%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #22d3ee, #6366f1, #22d3ee, transparent);
  box-shadow: 0 0 16px #06b6d4, 0 0 6px #6366f1;
  border-radius: var(--radius-full);
  animation: appLaserLoop 2.2s ease-in-out infinite alternate;
}

@keyframes appLaserLoop {
  0% { top: 8%; opacity: 0.3; }
  50% { opacity: 1; }
  100% { top: 92%; opacity: 0.3; }
}

.scan-hint-text {
  position: absolute;
  bottom: -48px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  letter-spacing: -0.01em;
}

/* 3. Floating App Top Header */
.app-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: env(safe-area-inset-top, 1rem) 1rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
  backdrop-filter: blur(8px);
}

.app-back-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.2rem;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.app-back-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.25);
}

.app-session-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  max-width: 55vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-tool-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.app-tool-btn:active {
  transform: scale(0.92);
}

.app-tool-btn.active {
  background: var(--primary-gradient);
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 0 14px var(--primary-glow);
}

/* 4. Bottom Controls & Live Count */
.app-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 1.25rem 1.5rem calc(env(safe-area-inset-bottom, 1rem) + 1.25rem);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.app-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.1rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: #0284c7;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.app-status-pill .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0284c7;
  box-shadow: 0 0 8px #0284c7;
  animation: pulseDot 1.5s infinite;
}

/* 5. Slide-up Result Card (Native App Sheet) */
.scan-result-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  border-radius: 28px 28px 0 0;
  padding: 1.5rem 1.75rem calc(env(safe-area-inset-bottom, 1rem) + 1.5rem);
  transform: translateY(105%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 40px rgba(60, 45, 25, 0.15);
}

.scan-result-sheet.active {
  transform: translateY(0);
}

.sheet-drag-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 0 auto 1.25rem;
}

.sheet-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.sheet-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #ffffff;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.sheet-avatar.duplicate {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.sheet-avatar.error {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}

.sheet-info {
  flex-grow: 1;
}

.sheet-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sheet-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.sheet-time-tag {
  font-size: 0.78rem;
  color: var(--text-muted);
}
