/* ============================================================
   components.css - Portside Mobile Reporter v3
   All UI components: glass cards, buttons, forms, scanner, etc.
   ============================================================ */

/* ==========  GLASS PRIMITIVES  ========== */

.glass {
  background: var(--bg-glass);
  -webkit-backdrop-filter: blur(var(--blur-glass));
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
}

.glass-card {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(var(--blur-glass));
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  transition: background var(--transition-base),
              border-color var(--transition-base),
              box-shadow var(--transition-base);
}

.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-hover);
}


/* ==========  LAYOUT  ========== */

.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 10px;
  padding-top: calc(10px + var(--safe-top));
  padding-bottom: calc(16px + var(--safe-bottom));
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

.view {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg-primary);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--transition-slow),
              visibility var(--transition-slow),
              transform var(--transition-slow);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}


/* ==========  HEADER  ========== */

.header {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(var(--blur-heavy));
  backdrop-filter: blur(var(--blur-heavy));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 12px 20px 10px;
  margin-bottom: 8px;
  text-align: center;
  position: relative;
  overflow: hidden;
  z-index: 0;
}

/* Animated shimmer border on header */
.header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 35%,
    rgba(99, 102, 241, 0.25) 40%,
    rgba(139, 92, 246, 0.15) 45%,
    transparent 50%,
    transparent 100%
  );
  animation: headerShimmer 6s linear infinite;
  z-index: -2;
  border-radius: inherit;
}

/* Inner fill to mask the center, leaving only border glow */
.header::after {
  content: '';
  position: absolute;
  inset: 1px;
  background: var(--bg-card);
  border-radius: inherit;
  z-index: -1;
}

@keyframes headerShimmer {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.header-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}


/* ==========  VIOLATION BUTTON GRID  ========== */

.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.violation-btn {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(var(--blur-glass));
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 5px 5px 4px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--transition-fast),
              background var(--transition-base),
              border-color var(--transition-base),
              box-shadow var(--transition-base);
}

/* Subtle per-type gradient overlay */
.violation-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.violation-btn:hover::before,
.violation-btn:focus-visible::before {
  opacity: 1;
}

/* Unique gradient per violation type */
.violation-btn[data-type="memorial"]::before {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(239, 68, 68, 0.06) 100%);
}
.violation-btn[data-type="lobby"]::before {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.06) 100%);
}
.violation-btn[data-type="door"]::before {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(6, 182, 212, 0.06) 100%);
}
.violation-btn[data-type="damage"]::before {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(244, 63, 94, 0.06) 100%);
}
.violation-btn[data-type="superintendent"]::before {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(249, 115, 22, 0.06) 100%);
}
.violation-btn[data-type="custom"]::before {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.08) 0%, rgba(236, 72, 153, 0.06) 100%);
}

.violation-btn .icon {
  width: 100%;
  aspect-ratio: 3 / 2;
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow var(--transition-base);
}

/* Per-type icon glow on hover */
.violation-btn[data-type="memorial"]:hover .icon,
.violation-btn[data-type="memorial"]:focus-visible .icon {
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35), 0 0 32px rgba(245, 158, 11, 0.15);
}
.violation-btn[data-type="lobby"]:hover .icon,
.violation-btn[data-type="lobby"]:focus-visible .icon {
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.35), 0 0 32px rgba(99, 102, 241, 0.15);
}
.violation-btn[data-type="door"]:hover .icon,
.violation-btn[data-type="door"]:focus-visible .icon {
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35), 0 0 32px rgba(16, 185, 129, 0.15);
}
.violation-btn[data-type="damage"]:hover .icon,
.violation-btn[data-type="damage"]:focus-visible .icon {
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.35), 0 0 32px rgba(239, 68, 68, 0.15);
}
.violation-btn[data-type="superintendent"]:hover .icon,
.violation-btn[data-type="superintendent"]:focus-visible .icon {
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35), 0 0 32px rgba(245, 158, 11, 0.15);
}
.violation-btn[data-type="custom"]:hover .icon,
.violation-btn[data-type="custom"]:focus-visible .icon {
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.35), 0 0 32px rgba(168, 85, 247, 0.15);
}

.violation-btn .icon svg,
.violation-btn .icon img {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: contain;
}

.violation-btn .label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.15;
  position: relative;
  z-index: 1;
  max-width: 100%;
  flex-shrink: 0;
  padding-top: 2px;
  transition: color var(--transition-base);
}

.violation-btn:hover,
.violation-btn:focus-visible {
  transform: translateY(-2px);
  border-color: var(--border-glass-hover);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.violation-btn:active {
  transform: scale(0.97);
}

/* Selected state */
.violation-btn.selected {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  box-shadow: 0 0 24px var(--accent-primary-glow),
              inset 0 0 16px rgba(99, 102, 241, 0.06);
}

.violation-btn.selected::before {
  opacity: 1;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.08) 100%);
}

.violation-btn.selected .label {
  color: var(--text-primary);
}


/* ==========  FORM CARD  ========== */

.form-card {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(var(--blur-glass));
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 18px;
  animation: slideUp var(--transition-slow) ease-out;
}

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

.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 16px; /* prevents iOS zoom */
  transition: border-color var(--transition-base),
              background var(--transition-base),
              box-shadow var(--transition-base);
  -webkit-appearance: none;
  appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='rgba(255,255,255,0.5)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
  overflow-y: hidden;
  line-height: 1.6;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-glass-hover);
  background: rgba(255, 255, 255, 0.06);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px var(--accent-primary-glow),
              0 0 16px rgba(99, 102, 241, 0.15),
              0 0 32px rgba(99, 102, 241, 0.05);
}

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  border-left: 3px solid var(--accent-primary);
  line-height: 1.5;
}

.required-indicator {
  color: var(--accent-danger);
  font-weight: 700;
}


/* ==========  PHOTO SECTION  ========== */

.photo-section {
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 16px;
  transition: border-color var(--transition-base),
              background var(--transition-base);
}

.photo-section:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
}

.photo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, #8b5cf6 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  min-height: 48px;
  box-shadow: 0 0 16px var(--accent-primary-glow);
  transition: opacity var(--transition-base),
              transform var(--transition-fast),
              box-shadow var(--transition-base);
  position: relative;
  overflow: hidden;
}

.photo-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.photo-btn:hover::after {
  transform: translateX(100%);
}

.photo-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.photo-preview {
  position: relative;
  width: calc(50% - 6px);
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border-glass);
  background: var(--bg-secondary);
  transition: border-color var(--transition-base),
              box-shadow var(--transition-base);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview.primary {
  border-color: var(--accent-success);
  box-shadow: 0 0 16px var(--accent-success-glow);
}

.photo-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--accent-success);
  color: #fff;
}

.photo-badge.context {
  background: var(--accent-primary);
}

.photo-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition-fast),
              transform var(--transition-fast);
}

.photo-remove:active {
  transform: scale(0.9);
  background: var(--accent-danger);
}

.photo-count {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
  font-weight: 500;
}


/* ==========  AI SECTION  ========== */

.ai-btn {
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--accent-success) 0%, #059669 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 17px;
  font-weight: 700;
  min-height: 56px;
  box-shadow: 0 0 20px var(--accent-success-glow);
  transition: opacity var(--transition-base),
              transform var(--transition-fast),
              box-shadow var(--transition-base);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.2px;
}

.ai-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.12) 50%, transparent 100%);
  animation: btnShimmer 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btnShimmer {
  0%, 80%, 100% { left: -100%; opacity: 0; }
  85%           { opacity: 1; }
  95%           { left: 150%; opacity: 1; }
  96%           { opacity: 0; }
}

.ai-btn:active {
  transform: scale(0.98);
}

.ai-btn.ready {
  animation: aiPulse 2s ease-in-out infinite;
}

@keyframes aiPulse {
  0%, 100% { box-shadow: 0 0 20px var(--accent-success-glow); }
  50%      { box-shadow: 0 0 36px var(--accent-success-glow), 0 0 60px rgba(16, 185, 129, 0.15); }
}

.ai-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  animation: none;
  box-shadow: none;
}

.ai-context-field {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 16px;
  min-height: 80px;
  resize: vertical;
  margin-bottom: 12px;
}

.ai-context-field:focus {
  outline: none;
  border-color: var(--accent-success);
  box-shadow: 0 0 0 3px var(--accent-success-glow);
}


/* ==========  TICKET PREVIEW  ========== */

.ticket-preview {
  background: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(var(--blur-glass));
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 18px;
  max-height: 300px;
  overflow-y: auto;
}

.preview-summary {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-danger);
  margin-bottom: 12px;
  line-height: 1.4;
}

.preview-body {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  line-height: 1.6;
  word-break: break-word;
}


/* ==========  SUBMIT BUTTON  ========== */

.submit-btn {
  width: 100%;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--accent-danger) 0%, #dc2626 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 17px;
  font-weight: 700;
  min-height: 60px;
  letter-spacing: 0.3px;
  box-shadow: 0 0 24px var(--accent-danger-glow);
  transition: opacity var(--transition-base),
              transform var(--transition-fast),
              box-shadow var(--transition-base);
  position: relative;
  overflow: hidden;
}

/* Auto-shimmer on submit button */
.submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
  animation: btnShimmer 4.5s ease-in-out 1s infinite;
  pointer-events: none;
  z-index: 1;
}

.submit-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.submit-btn:hover:not(:disabled)::after {
  transform: translateX(100%);
}

.submit-btn:active:not(:disabled) {
  transform: scale(0.98);
  opacity: 0.9;
}

.submit-btn:disabled {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%);
  color: var(--text-tertiary);
  box-shadow: none;
  cursor: not-allowed;
}

.submit-btn.submitting {
  animation: submitPulse 1.5s ease-in-out infinite;
}

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


/* ==========  SCANNER OVERLAY  ========== */

.scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.scanner-overlay.active {
  opacity: 1;
  visibility: visible;
}

.scanner-frame {
  position: relative;
  width: calc(100% - 40px);
  max-width: 400px;
  aspect-ratio: 4 / 3;
  border: 2px solid var(--accent-scanner);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 255, 136, 0.4),
              0 0 60px rgba(0, 255, 136, 0.15);
  animation: scannerFramePulse 3s ease-in-out infinite;
}

@keyframes scannerFramePulse {
  0%, 100% { box-shadow: 0 0 30px rgba(0, 255, 136, 0.4), 0 0 60px rgba(0, 255, 136, 0.15); }
  50%      { box-shadow: 0 0 40px rgba(0, 255, 136, 0.5), 0 0 80px rgba(0, 255, 136, 0.2), 0 0 120px rgba(0, 255, 136, 0.08); }
}

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

/* Subtle targeting grid overlay */
.scanner-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 136, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 136, 0.04) 1px, transparent 1px);
  background-size: 20% 20%;
  z-index: 1;
  pointer-events: none;
}

/* Scan line sweeping top to bottom with fading trail */
.scan-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--accent-scanner) 20%, var(--accent-scanner) 80%, transparent 100%);
  box-shadow: 0 0 12px var(--accent-scanner),
              0 0 30px rgba(0, 255, 136, 0.3),
              0 20px 40px rgba(0, 255, 136, 0.08),
              0 40px 60px rgba(0, 255, 136, 0.04);
  animation: scanSweep 2s linear infinite;
}

/* Trail effect behind scan line */
.scan-line::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(180deg, rgba(0, 255, 136, 0.1) 0%, transparent 100%);
  pointer-events: none;
}

@keyframes scanSweep {
  0%   { top: 0; }
  100% { top: 100%; }
}

/* Horizontal scan line (slower, offset timing) */
.scan-line-h {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 255, 136, 0.6) 30%, rgba(0, 255, 136, 0.6) 70%, transparent 100%);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
  animation: scanSweepH 3.5s linear infinite;
  z-index: 2;
  pointer-events: none;
}

@keyframes scanSweepH {
  0%   { left: 0; }
  100% { left: 100%; }
}

/* Coordinate readout in corner */
.scan-coords {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 10px;
  color: var(--accent-scanner);
  text-shadow: 0 0 4px rgba(0, 255, 136, 0.6);
  background: rgba(0, 0, 0, 0.6);
  padding: 3px 8px;
  border-radius: 3px;
  z-index: 3;
  pointer-events: none;
  opacity: 0.8;
}

/* Corner brackets */
.scan-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scan-corner {
  position: absolute;
  width: 28px;
  height: 28px;
}

.scan-corner::before,
.scan-corner::after {
  content: '';
  position: absolute;
  background: var(--accent-scanner);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}

/* Top-left */
.scan-corner--tl { top: 8px; left: 8px; }
.scan-corner--tl::before { top: 0; left: 0; width: 28px; height: 3px; }
.scan-corner--tl::after  { top: 0; left: 0; width: 3px;  height: 28px; }

/* Top-right */
.scan-corner--tr { top: 8px; right: 8px; }
.scan-corner--tr::before { top: 0; right: 0; width: 28px; height: 3px; }
.scan-corner--tr::after  { top: 0; right: 0; width: 3px;  height: 28px; }

/* Bottom-left */
.scan-corner--bl { bottom: 8px; left: 8px; }
.scan-corner--bl::before { bottom: 0; left: 0; width: 28px; height: 3px; }
.scan-corner--bl::after  { bottom: 0; left: 0; width: 3px;  height: 28px; }

/* Bottom-right */
.scan-corner--br { bottom: 8px; right: 8px; }
.scan-corner--br::before { bottom: 0; right: 0; width: 28px; height: 3px; }
.scan-corner--br::after  { bottom: 0; right: 0; width: 3px;  height: 28px; }

/* Green pulse overlay */
.scan-pulse {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0, 255, 136, 0.12) 0%, transparent 70%);
  animation: scanPulseAnim 1.5s ease-in-out infinite;
  pointer-events: none;
}

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

/* Focus boxes that appear to analyze areas */
.focus-box {
  position: absolute;
  border: 2px solid var(--accent-scanner);
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.5),
              inset 0 0 15px rgba(0, 255, 136, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: top 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              left 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.35s ease,
              height 0.35s ease,
              opacity 0.25s ease;
  z-index: 5;
}

/* Crosshair inside focus box */
.focus-box::before,
.focus-box::after {
  content: '';
  position: absolute;
  background: var(--accent-scanner);
  opacity: 0.5;
}

.focus-box::before {
  top: 50%;
  left: 20%;
  right: 20%;
  height: 1px;
  transform: translateY(-50%);
}

.focus-box::after {
  left: 50%;
  top: 20%;
  bottom: 20%;
  width: 1px;
  transform: translateX(-50%);
}

/* Floating analysis labels that pop up near focus boxes */
.scan-float-label {
  position: absolute;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 9px;
  font-weight: 700;
  color: var(--accent-scanner);
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.8);
  letter-spacing: 1px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(0, 255, 136, 0.4);
  border-radius: 3px;
  pointer-events: none;
  z-index: 6;
  animation: floatLabelIn 0.8s ease-out forwards;
  white-space: nowrap;
}

@keyframes floatLabelIn {
  0%   { opacity: 0; transform: translateY(4px) scale(0.8); }
  20%  { opacity: 1; transform: translateY(0) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}

/* Status terminal text */
.scan-status-container {
  width: calc(100% - 40px);
  max-width: 400px;
  margin-top: 20px;
  background: rgba(0, 255, 136, 0.06);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.scan-status {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-scanner);
  margin-bottom: 6px;
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
  animation: statusFlicker 3s ease-in-out infinite;
}

@keyframes statusFlicker {
  0%, 100% { opacity: 1; }
  92%      { opacity: 1; }
  93%      { opacity: 0.6; }
  94%      { opacity: 1; }
  96%      { opacity: 0.7; }
  97%      { opacity: 1; }
}

.scan-progress {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Three blinking dots */
.scan-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.scan-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-scanner);
  animation: dotBlink 1s ease-in-out infinite;
}

.scan-dot:nth-child(2) { animation-delay: 0.2s; }
.scan-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBlink {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1); }
}

/* Focus box movement keyframes (JS toggles classes to move them) */
@keyframes focusFloat {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(20px, -15px); }
  50%  { transform: translate(-10px, 25px); }
  75%  { transform: translate(15px, 10px); }
  100% { transform: translate(0, 0); }
}


/* ==========  SUCCESS SCREEN  ========== */

.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-slow),
              visibility var(--transition-slow);
}

.success-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Success background glow */
.success-overlay.active::before {
  content: '';
  position: absolute;
  top: 30%;
  left: 50%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, transparent 70%);
  transform: translateX(-50%);
  pointer-events: none;
  animation: successGlow 3s ease-in-out infinite;
}

@keyframes successGlow {
  0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(1); }
  50%      { opacity: 1;   transform: translateX(-50%) scale(1.2); }
}

.success-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(var(--blur-heavy));
  backdrop-filter: blur(var(--blur-heavy));
  border: 1px solid var(--accent-success);
  border-radius: var(--radius-xl);
  padding: 40px 28px;
  text-align: center;
  box-shadow: 0 0 40px var(--accent-success-glow);
  animation: scaleIn var(--transition-slow) ease-out;
  position: relative;
  overflow: visible;
}

/* Celebration particles on success */
.success-overlay.active .success-card::before,
.success-overlay.active .success-card::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 0;
}

.success-overlay.active .success-card::before {
  background: var(--accent-success);
  box-shadow:
    30px 0 0 0 rgba(99, 102, 241, 0.8),
    -25px 10px 0 0 rgba(245, 158, 11, 0.8),
    15px -20px 0 0 rgba(16, 185, 129, 0.8),
    -40px -15px 0 0 rgba(139, 92, 246, 0.7);
  left: 50%;
  top: 50%;
  animation: celebrateUp 2s ease-out 0.3s forwards;
}

.success-overlay.active .success-card::after {
  background: rgba(99, 102, 241, 0.8);
  box-shadow:
    -30px 5px 0 0 rgba(16, 185, 129, 0.8),
    20px -10px 0 0 rgba(245, 158, 11, 0.8),
    -10px 20px 0 0 rgba(236, 72, 153, 0.7),
    35px 15px 0 0 var(--accent-success);
  left: 50%;
  top: 50%;
  animation: celebrateDown 2.2s ease-out 0.5s forwards;
}

@keyframes celebrateUp {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(0); }
  30%  { opacity: 1; transform: translate(-50%, -50%) scale(1.5); }
  100% { opacity: 0; transform: translate(-50%, -200%) scale(0.5); }
}

@keyframes celebrateDown {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(0); }
  30%  { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%, 100%) scale(0.5); }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.success-ticket-id {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.success-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
  font-size: 14px;
  font-weight: 600;
  margin-top: 16px;
  transition: background var(--transition-base),
              border-color var(--transition-base);
}

.success-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-primary);
}

.success-link:active {
  transform: scale(0.97);
}

.success-privacy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 100px;
  margin-top: 16px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}


/* ==========  REPORTS VIEWER  ========== */

.reports-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-primary);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--transition-slow),
              visibility var(--transition-slow),
              transform var(--transition-slow);
}

.reports-overlay.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.reports-header {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(var(--blur-heavy));
  backdrop-filter: blur(var(--blur-heavy));
  border-bottom: 1px solid var(--border-glass);
  padding: 20px;
  padding-top: calc(20px + var(--safe-top));
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.date-filter {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-base),
              border-color var(--transition-base),
              color var(--transition-base);
  white-space: nowrap;
}

.date-filter:active {
  transform: scale(0.96);
}

.date-filter.active,
.date-filter.selected {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-primary-glow);
}

.report-card {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(var(--blur-glass));
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 18px;
  margin: 0 16px 12px;
  transition: background var(--transition-base),
              border-color var(--transition-base);
}

.report-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-hover);
}

.report-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.report-status.open {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.report-status.acknowledged {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.report-status.closed {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(var(--blur-glass));
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}


/* ==========  TOAST  ========== */

.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 9999;
  max-width: calc(100% - 32px);
  width: 400px;
  padding: 16px 20px;
  background: rgba(30, 30, 40, 0.92);
  -webkit-backdrop-filter: blur(var(--blur-heavy));
  backdrop-filter: blur(var(--blur-heavy));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.35s ease;
  pointer-events: none;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast.error,
.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 20px var(--accent-danger-glow);
}

.toast.success,
.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 20px var(--accent-success-glow);
}

.toast.info,
.toast-info {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 20px var(--accent-primary-glow);
}

.toast.warning,
.toast-warning {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.toast-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-exit {
  transform: translateX(-50%) translateY(100px);
  opacity: 0;
  pointer-events: none;
}


/* ==========  MODAL  ========== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base),
              visibility var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-secondary);
  -webkit-backdrop-filter: blur(var(--blur-heavy));
  backdrop-filter: blur(var(--blur-heavy));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  animation: scaleIn var(--transition-base) ease-out;
}

.modal-card .modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-card .modal-body {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions button {
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  min-height: 48px;
  transition: background var(--transition-base),
              transform var(--transition-fast);
}

.modal-actions button:active {
  transform: scale(0.97);
}

.modal-actions .modal-cancel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.modal-actions .modal-confirm {
  background: var(--accent-primary);
  color: #fff;
}

.modal-actions .modal-confirm.danger {
  background: var(--accent-danger);
}

.modal-detail {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-glass);
}

.modal-detail span:first-child {
  color: var(--text-tertiary);
  font-weight: 500;
}

.modal-note {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 12px;
  line-height: 1.5;
}

.modal-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}


/* ==========  UTILITIES  ========== */

.hidden {
  display: none !important;
}

/* Submit progress overlay */
.submit-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base),
              visibility var(--transition-base);
}

.submit-overlay.active {
  opacity: 1;
  visibility: visible;
}

.submit-progress {
  text-align: center;
}

.submit-status {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  margin-top: 16px;
}

/* Stats overlay */
.stats-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-primary);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--transition-slow),
              visibility var(--transition-slow),
              transform var(--transition-slow);
}

.stats-overlay.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Ticket detail overlay */
.ticket-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg-primary);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--transition-slow),
              visibility var(--transition-slow),
              transform var(--transition-slow);
}

.ticket-overlay.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Toast container */
.toast-container {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: 100%;
  max-width: 440px;
}

/* Form title */
.form-card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* Photo section titles */
.photo-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.photo-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.photo-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.photo-btn-alt {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  box-shadow: none;
}

/* Preview title/subtitle */
.preview-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.preview-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

/* Privacy note */
.privacy-note {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 12px;
  line-height: 1.5;
}

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  transition: background var(--transition-base);
}

.back-btn:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.97);
}

.back-btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}

.back-arrow {
  flex-shrink: 0;
}

/* Classifier result */
.classifier-result {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  display: block;
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 100px;
  position: relative;
  transition: background var(--transition-base);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform var(--transition-base);
}

.toggle input:checked + .toggle-track {
  background: var(--accent-success);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Sound toggle row */
.sound-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-glass);
}

.sound-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Tools section */
.tools-card {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(var(--blur-glass));
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}

.tools-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  min-height: 40px;
  border: 1px solid var(--border-glass);
  transition: background var(--transition-base),
              transform var(--transition-fast);
}

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

.tool-btn-primary {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-primary);
  border-color: rgba(99, 102, 241, 0.2);
}

.tool-btn-success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.2);
}

.tool-icon {
  display: flex;
  align-items: center;
}

/* Required marker */
.required {
  color: var(--accent-danger);
  font-weight: 700;
}

/* Stats utility classes */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.stat-item {
  text-align: center;
  padding: 12px 8px;
}

.stat-item.stat-centered {
  grid-column: 1 / -1;
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
}

.stat-note {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.stat-open .stat-number { color: var(--accent-success); }
.stat-acknowledged .stat-number { color: var(--accent-warning); }
.stat-closed .stat-number { color: var(--accent-danger); }

.stat-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.stat-bar-label {
  font-size: 12px;
  color: var(--text-secondary);
  width: 120px;
  flex-shrink: 0;
}

.stat-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 4px;
  transition: width var(--transition-slow);
}

.stat-bar-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  width: 28px;
  text-align: right;
}

.stat-overview h3,
.stat-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* Empty/error/loading states */
.empty-state,
.error-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.loading-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

/* Success content layout */
.success-content {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.success-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.success-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.success-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.success-value {
  display: block;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.success-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  background: var(--accent-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  margin-top: 20px;
  text-decoration: none;
}

.success-another-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.success-note {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 16px;
  line-height: 1.5;
}

/* Badge utility */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-private {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Ticket detail styles */
.ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ticket-id {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 14px;
  color: var(--text-secondary);
}

.ticket-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.3;
}

.ticket-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.ticket-meta {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.ticket-photo {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.ticket-footer {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border-glass);
}

.ticket-footer a {
  color: var(--accent-primary);
}

.ticket-comments {
  margin-top: 20px;
}

.ticket-comments h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.ticket-comment {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}

.ticket-comment.comment-official {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.04);
}

.comment-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.comment-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Reports header layout */
.stats-header,
.reports-header {
  margin-bottom: 16px;
}

.date-filters {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.reports-summary {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.reports-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px;
}

/* CSS-only loading spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton loading shimmer */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.08) 40%,
    rgba(255, 255, 255, 0.04) 80%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Animation utility classes */
.fade-in {
  animation: fadeIn var(--transition-slow) ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.slide-up {
  animation: slideUp var(--transition-slow) ease-out forwards;
}

/* slideUp keyframes already defined above under .form-card */

.scale-in {
  animation: scaleIn var(--transition-slow) ease-out forwards;
}

/* scaleIn keyframes already defined above under .success-card */

/* Camera flash overlay */
.camera-flash {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 9998;
  pointer-events: none;
  opacity: 0;
}

.camera-flash.flash-active {
  animation: flashBurst 0.3s ease-out;
}

@keyframes flashBurst {
  0%   { opacity: 0; }
  15%  { opacity: 0.9; }
  100% { opacity: 0; }
}

/* Live Camera Overlay (getUserMedia rear camera) */
.live-camera-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.live-camera-overlay.hidden { display: none; }
.live-camera-overlay video {
  width: 100%;
  height: calc(100% - 120px);
  object-fit: cover;
}
.live-camera-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 48px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(0,0,0,0.9);
  z-index: 10001;
}
.live-camera-btn.cancel {
  background: none;
  border: 2px solid rgba(255,255,255,0.7);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 28px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.live-camera-btn.snap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 5px solid #fff;
  background: rgba(255,255,255,0.25);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.live-camera-btn.snap:active {
  background: rgba(255,255,255,0.7);
}

/* Back/close button (reusable) */
.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 20px;
  transition: background var(--transition-base);
}

.btn-back:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.95);
}
