/* ==========================================================================
   EduPeak iOS & Mobile Camera Document Scanner & Live Proctoring Styles
   ========================================================================== */

/* Fullscreen Scanner Modal */
.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000000;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Scanner Top Bar */
.scanner-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
}

.scanner-title {
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 8px;
}

.scanner-page-counter {
  background: #2563EB;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
}

.scanner-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-scanner-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #FFFFFF;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.btn-scanner-icon:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.btn-scanner-icon.active {
  background: #F59E0B;
  color: #000000;
}

/* Live Video Viewfinder Container */
.scanner-viewfinder-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  overflow: hidden;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Document Alignment Bounding Box Frame */
.scanner-frame-overlay {
  position: absolute;
  width: 84%;
  height: 72%;
  max-width: 360px;
  max-height: 480px;
  border: 2px dashed rgba(56, 189, 248, 0.8);
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Corner bracket accents */
.scanner-frame-overlay::before,
.scanner-frame-overlay::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: #38BDF8;
  border-style: solid;
}

.scanner-frame-overlay::before {
  top: -2px;
  left: -2px;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 14px;
}

.scanner-frame-overlay::after {
  bottom: -2px;
  right: -2px;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 14px;
}

/* Animated Laser Scan Line */
.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #22D3EE, #38BDF8, #22D3EE, transparent);
  box-shadow: 0 0 12px #22D3EE, 0 0 24px #38BDF8;
  animation: laserScan 2.4s ease-in-out infinite alternate;
}

@keyframes laserScan {
  0% { top: 4%; opacity: 0.3; }
  50% { opacity: 1; }
  100% { top: 96%; opacity: 0.3; }
}

.scanner-hint-text {
  position: absolute;
  bottom: 14px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 20px;
  backdrop-filter: blur(6px);
}

/* Flash effect on capture */
.scanner-flash-overlay {
  position: absolute;
  inset: 0;
  background: #FFFFFF;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease-out;
  z-index: 50;
}

.scanner-flash-overlay.flashing {
  opacity: 0.85;
}

/* Filter selector bar */
.scanner-filter-bar {
  position: absolute;
  bottom: 124px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 20;
}

.filter-pill {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #E2E8F0;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.filter-pill.active {
  background: #2563EB;
  border-color: #38BDF8;
  color: #FFFFFF;
}

/* Bottom Controls & Shutter */
.scanner-bottom-bar {
  position: relative;
  z-index: 20;
  background: #090D16;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Thumbnail Gallery of Captured Pages */
.scanner-thumbnails-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
}
.scanner-thumbnails-strip::-webkit-scrollbar { display: none; }

.thumb-card {
  position: relative;
  width: 54px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #2563EB;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-del-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #EF4444;
  color: #FFFFFF;
  border: none;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.thumb-page-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #FFFFFF;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
}

/* Shutter Trigger Row */
.scanner-shutter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}

.shutter-btn-wrap {
  position: relative;
  width: 74px;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shutter-outer-ring {
  position: absolute;
  inset: 0;
  border: 4px solid #FFFFFF;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.btn-shutter {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #FFFFFF;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease, background-color 0.1s ease;
}

.btn-shutter:active {
  transform: scale(0.9);
  background: #E2E8F0;
}

.shutter-btn-wrap:active .shutter-outer-ring {
  transform: scale(1.08);
}

.btn-done-scanning {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
  border: none;
  border-radius: 14px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: transform 0.2s ease;
}

.btn-done-scanning:hover {
  transform: translateY(-1px);
}

.btn-done-scanning:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-upload-file-fallback {
  background: rgba(255, 255, 255, 0.1);
  color: #CBD5E1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Live Proctoring Floating Camera Box (Exam Room) ── */
.proctor-live-box {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 105px;
  height: 140px;
  border-radius: 16px;
  overflow: hidden;
  background: #000000;
  border: 2px solid #10B981;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 12px rgba(16, 185, 129, 0.4);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.proctor-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror */
}

.proctor-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(16, 185, 129, 0.9);
  color: #FFFFFF;
  font-size: 8.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.proctor-pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #FFFFFF;
  animation: pulse 1s infinite;
}
