/* ==========================================================================
   QREvents Participant Web Application Stylesheet
   Modern, High-Contrast, Outdoor & Mobile-First Design System
   ========================================================================== */

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-glass: rgba(30, 41, 59, 0.85);
  --bg-card-hover: #334155;
  --border-color: rgba(255, 255, 255, 0.12);
  --border-focus: #38bdf8;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #38bdf8;
  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  --accent-hover: #0284c7;
  
  --success: #10b981;
  --success-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --success: #10b981;
  --success-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --success-bg: rgba(16, 185, 129, 0.18);
  --points-color: #34d399;
  --points-bg: rgba(16, 185, 129, 0.2);
  --points-border: rgba(16, 185, 129, 0.4);
  --score-color: #34d399;
  
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  
  --purple: #8b5cf6;
  --purple-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.35);
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Gaišais augsta kontrasta režīms saulainai dienai */
body.light-mode {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-glass: rgba(255, 255, 255, 0.96);
  --bg-card-hover: #f1f5f9;
  --border-color: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #1e293b;
  --text-muted: #475569;
  
  --success: #047857;
  --success-bg: #dcfce7;
  
  /* Augsta kontrasta zaļie punkti dienas režīmam */
  --points-color: #064e3b;
  --points-bg: #d1fae5;
  --points-border: #059669;
  --score-color: #047857;
  
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

/* Gaišais režīms GPS Bannerim */
body.light-mode .gps-proximity-banner {
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
  border-color: #f59e0b;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.15);
}

body.light-mode .gps-proximity-banner .gps-proximity-target {
  color: #0f172a;
}

body.light-mode .gps-proximity-banner.zone-close {
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
  border-color: #0284c7;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.15);
}

body.light-mode .gps-proximity-banner.zone-punch {
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
  border-color: #059669;
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.2);
}

body.light-mode .gps-status-badge.disabled,
body.light-mode .gps-status-badge.error,
body.light-mode .gps-status-badge.off {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.4;
  overflow: hidden; /* Tikai KP saraksts ritinās */
  user-select: none;
}

/* Galvenais konteiners */
.app-container {
  max-width: 540px;
  margin: 0 auto;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   Galvene (App Header)
   ========================================================================== */
.app-header {
  flex-shrink: 0;
  z-index: 40;
  background: var(--bg-card-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.header-app-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
  padding: 2px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.modal-app-logo {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  object-fit: contain;
  background: #ffffff;
  padding: 2px;
  vertical-align: middle;
  flex-shrink: 0;
}

.header-titles {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.event-title-display {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.participant-badge {
  font-size: 12px;
  color: var(--accent-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Apakšjosla zem virsraksta: Sinhronizācija un GPS */
.sub-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 12px 6px 12px;
  background: var(--bg-card-glass);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Sinhronizācijas Poga */
.top-sync-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.top-sync-btn:active {
  transform: scale(0.95);
}

.top-sync-btn.has-pending {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.5);
  animation: pulsePending 2s infinite;
}

.top-sync-btn.offline {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.3);
}

.top-sync-btn .sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
}

/* GPS Statusa Žetons */
.gps-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(56, 189, 248, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.gps-status-badge:active {
  transform: scale(0.95);
}

.gps-status-badge .gps-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.gps-status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.35);
}

.gps-status-badge.active .gps-dot {
  animation: gpsPulse 2s infinite ease-in-out;
}

.gps-status-badge.searching {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.35);
}

.gps-status-badge.searching .gps-dot {
  animation: pulsePending 1.2s infinite;
}

.gps-status-badge.disabled,
.gps-status-badge.error,
.gps-status-badge.off {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.5);
}

.gps-status-badge.disabled .gps-dot,
.gps-status-badge.error .gps-dot,
.gps-status-badge.off .gps-dot {
  background-color: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.9);
  animation: pulsePending 1.5s infinite;
}

@keyframes gpsPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

@keyframes pulsePending {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ==========================================================================
   GPS Tuvuma / Radara Paziņojums (< 60m)
   ========================================================================== */
.gps-proximity-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(30, 41, 59, 0.95) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.6);
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.25);
  animation: slideInDown 0.3s ease-out;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}

.gps-proximity-banner:active {
  transform: scale(0.98);
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.gps-radar-icon {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.radar-core {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 10px var(--warning);
  z-index: 2;
}

.radar-wave {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--warning);
  opacity: 0;
  animation: radarPing 1.8s infinite cubic-bezier(0, 0.2, 0.8, 1);
}

.radar-wave.wave-2 {
  animation-delay: 0.7s;
}

@keyframes radarPing {
  0% { transform: scale(0.3); opacity: 1; }
  80% { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

.gps-proximity-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gps-proximity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gps-proximity-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--warning);
  text-transform: uppercase;
}

.gps-proximity-distance {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 900;
  color: var(--warning);
}

.gps-proximity-target {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.15;
}

.gps-proximity-meter {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  margin-top: 4px;
  overflow: hidden;
}

.gps-proximity-fill {
  height: 100%;
  background: var(--warning);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  box-shadow: 0 0 8px var(--warning);
}

/* Zone 15m - 30m (Tuvojies) */
.gps-proximity-banner.zone-close {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(30, 41, 59, 0.95) 100%);
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.3);
}

.gps-proximity-banner.zone-close .radar-core,
.gps-proximity-banner.zone-close .gps-proximity-fill {
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary);
}

.gps-proximity-banner.zone-close .radar-wave {
  border-color: var(--accent-primary);
  animation-duration: 1.2s;
}

.gps-proximity-banner.zone-close .gps-proximity-tag,
.gps-proximity-banner.zone-close .gps-proximity-distance {
  color: var(--accent-primary);
}

/* Zone <= 15m (Auto-punch zone) */
.gps-proximity-banner.zone-punch {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(30, 41, 59, 0.95) 100%);
  border-color: rgba(16, 185, 129, 0.8);
  box-shadow: 0 4px 24px rgba(16, 185, 129, 0.45);
}

.gps-proximity-banner.zone-punch .radar-core,
.gps-proximity-banner.zone-punch .gps-proximity-fill {
  background: var(--success);
  box-shadow: 0 0 12px var(--success);
}

.gps-proximity-banner.zone-punch .radar-wave {
  border-color: var(--success);
  animation-duration: 0.8s;
}

.gps-proximity-banner.zone-punch .gps-proximity-tag,
.gps-proximity-banner.zone-punch .gps-proximity-distance {
  color: var(--success);
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 17px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.icon-btn:active {
  transform: scale(0.94);
  background: var(--bg-card-hover);
}

/* ==========================================================================
   Galvenais satura apgabals (Fixed, only KP list scrolls)
   ========================================================================== */
.main-content {
  flex: 1;
  min-height: 0;
  padding: 8px 12px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

/* ==========================================================================
   Taimera Karte (Timer Card) - Kompakts
   ========================================================================== */
.timer-card {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 6px 12px 8px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.timer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

.timer-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 2px;
}

.timer-mode-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(56, 189, 248, 0.25);
  white-space: nowrap;
}

.timer-mode-badge.finished {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
}

.timer-mode-badge.countdown {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.3);
}

.timer-digits {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: 1px;
  line-height: 1.05;
  margin: 1px 0 4px 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.timer-digits.countdown {
  color: var(--warning);
}

.timer-stats-compact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  width: 100%;
  gap: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-compact-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-compact-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-primary);
  line-height: 1.1;
}

.stat-compact-val.score {
  color: var(--score-color);
}

.stat-compact-lbl {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ==========================================================================
   Darbības Pogas (Action Buttons Row - Zem Taimera)
   ========================================================================== */
.action-buttons-row {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 8px;
  flex-shrink: 0;
  width: 100%;
}

.action-btn {
  height: 42px; /* ~2/3 no iepriekšējā augstuma */
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, filter 0.15s ease;
  padding: 0 10px;
  white-space: nowrap;
}

.action-btn:active {
  transform: scale(0.96);
}

.btn-manual-code {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-manual-code:active {
  background: var(--bg-card-hover);
}

.btn-scan-qr {
  background: var(--success-gradient);
  border: none;
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.35);
}

.btn-scan-qr:active {
  filter: brightness(0.92);
}

/* Paziņojumu Banneris */
.toast-banner {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  display: none;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.25s ease;
}

.toast-banner.success {
  display: flex;
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: var(--success);
}

.toast-banner.error {
  display: flex;
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: #f87171;
}

.toast-banner.warning {
  display: flex;
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  color: var(--warning);
}

.toast-banner.info {
  display: flex;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid var(--accent);
  color: #60a5fa;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Apmeklēto KP Saraksts (Visited KPs List - Vienīgais ritināmais bloks)
   ========================================================================== */
.punches-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  box-shadow: var(--shadow-md);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.punches-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.punches-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.punches-count-badge {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.punches-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.punch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  animation: fadeIn 0.2s ease;
  transition: background 0.3s ease;
}

/* 5x Mirkšķināšanas animācija jaunākajam atzīmētajam KP */
.punch-item.just-punched {
  animation: punchFlashDark 0.5s ease-in-out 5;
}

body.light-mode .punch-item.just-punched {
  animation: punchFlashLight 0.5s ease-in-out 5;
}

@keyframes punchFlashDark {
  0%, 100% {
    background: rgba(0, 0, 0, 0.18);
    border-color: var(--border-color);
    box-shadow: none;
    transform: scale(1);
  }
  50% {
    background: rgba(16, 185, 129, 0.4);
    border-color: #34d399;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.8);
    transform: scale(1.02);
  }
}

@keyframes punchFlashLight {
  0%, 100% {
    background: #ffffff;
    border-color: var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transform: scale(1);
  }
  50% {
    background: #a7f3d0;
    border-color: #059669;
    box-shadow: 0 0 16px rgba(5, 150, 105, 0.6);
    transform: scale(1.02);
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.punch-item.start-punch {
  border-left: 4px solid var(--warning);
}

.punch-item.finish-punch {
  border-left: 4px solid var(--danger);
}

.punch-item.regular-punch {
  border-left: 4px solid var(--success);
}

.punch-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.punch-num-badge {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  min-width: 40px;
  padding: 0 8px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.punch-meta {
  display: flex;
  flex-direction: column;
}

.punch-time {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  white-space: nowrap;
}

.punch-code-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.punch-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.punch-points-tag {
  font-size: 13px;
  font-weight: 800;
  color: var(--points-color);
  background: var(--points-bg);
  border: 1.5px solid var(--points-border);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.punch-points-tag.dup {
  color: #d97706;
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.5);
}

.punch-points-tag.negative {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(239, 68, 68, 0.5);
}

body.light-mode .punch-points-tag.dup {
  color: #b45309;
  background: #fef3c7;
  border-color: #f59e0b;
}

body.light-mode .punch-points-tag.negative {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #f87171;
}

.punch-sync-icon {
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.punch-sync-icon.synced {
  color: var(--success);
}

.punch-sync-icon.pending {
  color: var(--warning);
}

.empty-punches-state {
  text-align: center;
  padding: 24px 10px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================================
   Liels Ekrāna Centra Alert Paziņojums (Emergency Alert Style Dialog)
   ========================================================================== */
.kp-punch-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 2147483647; /* Maksimālais iespējamais z-index */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
  cursor: pointer;
  padding: 24px;
}

.kp-punch-overlay.show {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.kp-alert-card {
  background: #ffffff;
  color: #111827;
  border-radius: 26px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 290px;
  padding: 36px 20px 22px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transform: scale(0.85);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: default;
}

.kp-punch-overlay.show .kp-alert-card {
  transform: scale(1);
}

/* Success state: ONLY the big KP number */
.kp-alert-body {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 96px;
  font-weight: 900;
  color: #111827;
  line-height: 1;
  letter-spacing: 1px;
  margin-bottom: 24px;
  word-break: break-word;
}

.kp-alert-btn {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #111827;
  font-size: 16px;
  font-weight: 700;
  padding: 8px 34px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background 0.15s ease, transform 0.1s ease;
  min-width: 110px;
}

.kp-alert-btn:hover {
  background: #e5e7eb;
}

.kp-alert-btn:active {
  background: #d1d5db;
  transform: scale(0.96);
}

/* Error dialog (Non-existing code) */
.kp-alert-card.error {
  border-top: 6px solid #ef4444;
}

.kp-alert-card.error .kp-alert-body {
  font-size: 20px;
  font-weight: 800;
  color: #dc2626;
  line-height: 1.35;
  margin-bottom: 20px;
}

.kp-alert-card.error .kp-alert-btn {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

/* Warning dialog (Duplicate consecutive scan) */
.kp-alert-card.warning {
  border-top: 6px solid #f59e0b;
}

.kp-alert-card.warning .kp-alert-body {
  font-size: 20px;
  font-weight: 800;
  color: #d97706;
  line-height: 1.35;
  margin-bottom: 20px;
}

.kp-alert-card.warning .kp-alert-btn {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

/* ==========================================================================
   Apakšējā Rīkjosla (Bottom Action Bar)
   ========================================================================== */
.bottom-actions {
  flex-shrink: 0;
  display: flex;
  width: 100%;
}

.action-btn {
  padding: 11px 12px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.action-btn.full-width {
  width: 100%;
}

.action-btn:active {
  transform: scale(0.96);
}

.sync-btn {
  background: var(--bg-card);
  color: var(--accent-primary);
  border: 1.5px solid var(--accent-primary);
}

.sync-btn.has-pending {
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
}

.referee-btn {
  background: var(--purple-gradient);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.3);
}

/* ==========================================================================
   Modālie Logi (Modals)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

#manualEntryModal {
  align-items: flex-start;
  padding-top: max(20px, env(safe-area-inset-top, 20px));
  padding-bottom: 20px;
}

#manualEntryModal .modal-dialog {
  margin-top: 10px;
  max-width: 400px;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.94);
  transition: transform 0.2s ease;
  position: relative;
}

.modal-backdrop.open .modal-dialog {
  transform: scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.2);
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Reģistrācijas Forma */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-select,
.form-input {
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  outline: none;
  width: 100%;
}

.form-select:focus,
.form-input:focus {
  border-color: var(--border-focus);
}

.primary-modal-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}

/* Kameras Skenera Modālis */
.scanner-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#qr-reader {
  width: 100% !important;
  min-height: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  border: 2px solid var(--accent-primary) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#qr-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: var(--radius-md);
  display: block;
}

#qr-reader__scan_region {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-controls-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.scanner-control-btn {
  flex: 1;
  padding: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

/* Tiesneša Rezerves QR Modālis */
.referee-qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 10px 0;
  color: #0f172a;
}

#referee-qrcode-canvas {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 220px;
}

.referee-meta-summary {
  width: 100%;
  font-size: 12px;
  color: #334155;
  background: #f1f5f9;
  padding: 10px;
  border-radius: var(--radius-sm);
  word-break: break-all;
  font-family: var(--font-mono);
  max-height: 120px;
  overflow-y: auto;
}

/* Izvēlne Drawer (Menu) */
.drawer-menu {
  position: fixed;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100%;
  background: var(--bg-secondary);
  z-index: 120;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
  transition: right 0.25s ease;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
}

.drawer-menu.open {
  right: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.drawer-item:visited,
.drawer-item:active,
.drawer-item:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.drawer-item.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-toggle-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.45);
  margin-left: auto;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.drawer-toggle-badge.off {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.35);
}

.drawer-toggle-badge.disabled-badge {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.25);
  font-size: 10px;
}

.drawer-item.danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 110;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   Darbvirsmas (Desktop) Bloķēšanas Ekrāns
   ========================================================================== */
.desktop-block-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: radial-gradient(circle at 50% 25%, #1e293b 0%, #0a0f1d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.desktop-block-card {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(56, 189, 248, 0.15);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: desktopFadeInScale 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes desktopFadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.desktop-block-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.desktop-block-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.35);
}

.desktop-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.desktop-block-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.25;
  margin: 0;
}

.desktop-block-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.desktop-block-desc strong {
  color: var(--text-primary);
}

.desktop-qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 4px;
}

.desktop-qr-card {
  background: #ffffff;
  padding: 14px;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  line-height: 0;
}

.desktop-qr-card img,
.desktop-qr-card canvas {
  display: block !important;
  border-radius: 6px;
}

.desktop-qr-caption {
  font-size: 13px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.desktop-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
  animation: desktopPulse 1.8s infinite;
  flex-shrink: 0;
}

@keyframes desktopPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 14px var(--accent-primary); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.desktop-url-box {
  display: flex;
  width: 100%;
  gap: 8px;
  margin-top: 6px;
}

.desktop-url-input {
  flex: 1;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
  text-overflow: ellipsis;
  user-select: all;
}

.desktop-copy-btn {
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
}

.desktop-copy-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.desktop-copy-btn:active {
  transform: translateY(1px);
}

.desktop-footer-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   KP Foto Apraksta Modālis (Pan & Zoom) un Progresa Indikators
   ========================================================================== */

/* Foto Apraksta Modālis */
.photo-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  max-height: 100dvh !important;
  z-index: 2147483640 !important;
  background: rgba(10, 15, 29, 0.95) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 8px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.2s ease, visibility 0.2s ease !important;
}

.photo-modal-backdrop.open,
.photo-modal-backdrop.show {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.photo-modal-dialog {
  background: var(--bg-card) !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: var(--radius-lg) !important;
  width: 100% !important;
  max-width: min(500px, 96vw) !important;
  height: 100% !important;
  max-height: calc(100dvh - 16px) !important;
  max-height: calc(100vh - 16px) !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8) !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin: auto !important;
}

.photo-modal-backdrop.open .photo-modal-dialog,
.photo-modal-backdrop.show .photo-modal-dialog {
  transform: scale(1) !important;
}

.photo-modal-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 8px 12px !important;
  background: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border-color) !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  min-height: 48px !important;
}

.photo-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.photo-kp-badge {
  background: var(--accent-gradient);
  color: #ffffff;
  font-weight: 800;
  font-size: 16px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.photo-kp-sub {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.photo-modal-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.photo-tool-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.photo-tool-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.photo-tool-btn:active {
  transform: scale(0.95);
}

.photo-close-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  margin-left: 4px;
  transition: all 0.15s ease;
}

.photo-close-btn:hover {
  background: var(--danger);
  color: #fff;
}

/* Viewport un Pan-Zoom konteiners */
.photo-viewport {
  position: relative !important;
  width: 100% !important;
  flex: 1 1 0% !important;
  min-height: 0 !important;
  min-width: 0 !important;
  height: auto !important;
  background: #000000 !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  touch-action: none !important;
  cursor: grab !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  box-sizing: border-box !important;
}

.photo-pan-container {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transform-origin: center center !important;
  will-change: transform !important;
  touch-action: none !important;
  box-sizing: border-box !important;
  pointer-events: none !important;
}

.photo-pan-container img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  display: block !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  pointer-events: none !important;
  -webkit-user-drag: none !important;
  user-select: none !important;
}

.photo-gesture-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

.photo-modal-footer {
  padding: 8px 12px !important;
  background: var(--bg-secondary) !important;
  border-top: 1px solid var(--border-color) !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  min-height: 52px !important;
}

.photo-modal-footer .primary-modal-btn {
  margin-top: 0 !important;
  padding: 11px 14px !important;
  font-size: 15px !important;
}

/* ==========================================================================
   KP Viktorīnas Jautājuma Modālis (Quiz Pan & Zoom) un Atbilžu Izvēle
   ========================================================================== */

.quiz-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  max-height: 100dvh !important;
  z-index: 2147483640 !important;
  background: rgba(10, 15, 29, 0.95) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 8px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.2s ease, visibility 0.2s ease !important;
}

.quiz-modal-backdrop.open,
.quiz-modal-backdrop.show {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.quiz-modal-dialog {
  background: var(--bg-card) !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: var(--radius-lg) !important;
  width: 100% !important;
  max-width: min(500px, 96vw) !important;
  height: 100% !important;
  max-height: calc(100dvh - 16px) !important;
  max-height: calc(100vh - 16px) !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8) !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin: auto !important;
  position: relative !important;
}

.quiz-modal-backdrop.open .quiz-modal-dialog,
.quiz-modal-backdrop.show .quiz-modal-dialog {
  transform: scale(1) !important;
}

.quiz-modal-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 8px 12px !important;
  background: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border-color) !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  min-height: 48px !important;
}

.quiz-kp-badge {
  background: var(--purple-gradient);
  color: #ffffff;
  font-weight: 800;
  font-size: 16px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.quiz-viewport {
  position: relative !important;
  width: 100% !important;
  flex: 1 1 0% !important;
  min-height: 0 !important;
  min-width: 0 !important;
  height: auto !important;
  background: #000000 !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  touch-action: none !important;
  cursor: grab !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  box-sizing: border-box !important;
}

.quiz-pan-container {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transform-origin: center center !important;
  will-change: transform !important;
  touch-action: none !important;
  box-sizing: border-box !important;
  pointer-events: none !important;
}

.quiz-pan-container img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  display: block !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  pointer-events: none !important;
  -webkit-user-drag: none !important;
  user-select: none !important;
}

.quiz-modal-footer {
  padding: 8px 12px !important;
  background: var(--bg-secondary) !important;
  border-top: 1px solid var(--border-color) !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  min-height: 52px !important;
}

.quiz-answer-main-btn {
  width: 100% !important;
  padding: 12px 16px !important;
  background: var(--purple-gradient) !important;
  border: none !important;
  border-radius: var(--radius-md) !important;
  color: #ffffff !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4) !important;
  transition: transform 0.15s ease, filter 0.15s ease !important;
}

.quiz-answer-main-btn:active {
  transform: scale(0.97) !important;
}

/* Atbilžu Izvēles Apakšlogs / Dialogs (Answer Sheet) */
.quiz-answer-sheet-overlay {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(10, 15, 29, 0.96) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 50 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px 16px !important;
  box-sizing: border-box !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.quiz-answer-sheet-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.quiz-sheet-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px 16px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.quiz-sheet-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.quiz-sheet-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 10px;
  width: 100%;
  margin: 6px 0;
}

.quiz-opt-btn {
  background: var(--bg-primary);
  border: 2px solid var(--accent-primary);
  color: var(--accent-primary);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 900;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.quiz-opt-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
}

.quiz-opt-btn:active {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: transparent;
  transform: scale(0.95);
}

.quiz-sheet-cancel-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.15s ease;
}

.quiz-sheet-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

body.light-mode .quiz-modal-backdrop,
body.light-mode .quiz-answer-sheet-overlay {
  background: rgba(15, 23, 42, 0.75) !important;
}

body.light-mode .quiz-sheet-card {
  background: #ffffff;
  border-color: #cbd5e1;
}

body.light-mode .quiz-opt-btn {
  background: #f8fafc;
  border-color: #0284c7;
  color: #0284c7;
}

body.light-mode .quiz-opt-btn:hover {
  background: #f0f9ff;
}

body.light-mode .quiz-sheet-cancel-btn {
  border-color: #cbd5e1;
  color: #475569;
}

/* Foto Žetons Apmeklēto KP Sarakstā */
.punch-photo-badge {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  border: none;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 6px rgba(56, 189, 248, 0.3);
}

.punch-photo-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(56, 189, 248, 0.5);
}

.punch-item.has-photo {
  border-right: 3px solid var(--accent-primary);
  cursor: pointer;
}

.punch-item.has-photo:hover {
  background: rgba(56, 189, 248, 0.08);
}

.punch-item.has-photo:active {
  background: rgba(56, 189, 248, 0.18);
}

/* Progresa Indikators Reģistrācijas logā */
.login-progress-container {
  margin-top: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  animation: fadeIn 0.2s ease;
}

.progress-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.2s ease;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.progress-status-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
  font-style: italic;
}

/* Gaišā režīma pielāgojumi */
body.light-mode .photo-modal-backdrop {
  background: rgba(15, 23, 42, 0.75) !important;
}

body.light-mode .photo-tool-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

body.light-mode .photo-tool-btn:hover {
  background: #e2e8f0;
}

body.light-mode .login-progress-container {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

body.light-mode .progress-bar-track {
  background: #e2e8f0;
}


