/* ─── Component Styles — Mobile-First, Touch-Friendly ─── */

/* ═══ Cards ═══ */
.card {
  background: var(--surface-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.card:active { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}
.card-body { color: var(--text-secondary); font-size: var(--font-size-sm); }
.card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
}

/* ── Case Card ── */
.case-card {
  background: var(--surface-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.case-card:active { box-shadow: var(--shadow-md); border-color: var(--color-primary-300); }
.case-card .case-id { font-size: var(--font-size-xs); color: var(--text-muted); font-weight: 600; }
.case-card .case-title { font-size: var(--font-size-base); font-weight: 600; color: var(--text-primary); margin: 4px 0; }
.case-card .case-meta { font-size: var(--font-size-xs); color: var(--text-muted); }

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-comfortable);
  min-width: var(--touch-comfortable);
  padding: var(--space-2) var(--space-5);
  font-size: var(--font-size-base);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--color-primary-600); }
.btn-primary:active { box-shadow: none; }

.btn-secondary {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}
.btn-secondary:hover { background: var(--surface-alt); }

.btn-danger {
  background: #DC2626;
  color: var(--text-inverse);
}
.btn-danger:hover { background: #B91C1C; }

.btn-ghost {
  background: transparent;
  color: var(--color-primary-500);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--color-primary-50); }

.btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--font-size-lg); min-height: 52px; }
.btn-block { width: 100%; }

/* ── Category Selection Buttons ── */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-2);
  background: var(--surface-primary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  min-height: 80px;
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}
.category-btn:active { transform: scale(0.96); }
.category-btn.selected {
  border-color: var(--color-primary-500);
  background: var(--color-primary-50);
  color: var(--color-primary-700);
}
.category-btn .cat-icon { font-size: 28px; line-height: 1; }

/* ═══ Forms ═══ */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}
.form-label .required { color: #DC2626; margin-left: 2px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-3);
  font-size: var(--font-size-base);
  background: var(--surface-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px var(--color-primary-100);
  outline: none;
}
.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-error {
  font-size: var(--font-size-xs);
  color: #DC2626;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Select arrow ── */
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* ═══ Step Indicator ─── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  padding: var(--space-2) 0;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--border-medium);
  transition: background 0.2s, transform 0.2s;
}
.step-dot.active { background: var(--color-primary-500); transform: scale(1.3); }
.step-dot.done { background: var(--color-primary-400); }

.step-line {
  width: 24px;
  height: 2px;
  background: var(--border-medium);
  border-radius: 1px;
}

/* ═══ Status Badge ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  white-space: nowrap;
}
.badge-pending { background: var(--status-pending-bg); color: var(--status-pending-text); border: 1px solid var(--status-pending-border); }
.badge-acknowledged { background: var(--status-acknowledged-bg); color: var(--status-acknowledged-text); border: 1px solid var(--status-acknowledged-border); }
.badge-resolved { background: var(--status-resolved-bg); color: var(--status-resolved-text); border: 1px solid var(--status-resolved-border); }
.badge-escalated { background: var(--status-escalated-bg); color: var(--status-escalated-text); border: 1px solid var(--status-escalated-border); }

/* ═══ Empty State ─── */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state .empty-title { font-size: var(--font-size-lg); font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state .empty-desc { font-size: var(--font-size-sm); }

/* ═══ Loading ─── */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) 0;
  gap: var(--space-3);
  color: var(--text-muted);
}
.loading-spinner .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-light);
  border-top-color: var(--color-primary-500);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

/* ═══ Photo Capture ─── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.photo-slot {
  aspect-ratio: 4/3;
  background: var(--surface-alt);
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: var(--touch-comfortable);
  overflow: hidden;
}
.photo-slot:active { border-color: var(--color-primary-400); background: var(--color-primary-50); }
.photo-slot.has-photo { border-style: solid; border-color: var(--border-light); }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot .photo-placeholder { font-size: 24px; color: var(--text-muted); }
.photo-slot .photo-label { font-size: 10px; color: var(--text-muted); }

/* ═══ Location Picker (Mini Map) ─── */
.mini-map {
  width: 100%;
  height: 180px;
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-3);
}
.location-coords {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-align: center;
  padding: var(--space-2);
  background: var(--color-primary-50);
  border-radius: var(--radius-md);
}

/* ═══ Greeting Card ─── */
.greeting-card {
  background: linear-gradient(135deg, var(--color-primary-50), var(--color-primary-100));
  border: 1px solid var(--color-primary-200);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.greeting-card .greeting { font-size: var(--font-size-lg); font-weight: 600; color: var(--color-primary-800); }
.greeting-card .location { font-size: var(--font-size-sm); color: var(--color-primary-600); margin-top: 2px; }

/* ═══ Pull to Refresh ─── */
.pull-indicator {
  text-align: center;
  padding: var(--space-4);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* ═══ Modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--surface-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fade-in 0.15s ease-out;
}

.modal {
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 360px;
  max-height: 85vh;
  overflow-y: auto;
  animation: scale-in 0.15s ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-light);
}
.modal-title { font-size: var(--font-size-lg); font-weight: 600; }
.modal-body { padding: var(--space-4); }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-light);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ═══ Tooltip/Help ─── */
.tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
}

/* ═══ Verification Page ─── */
.verify-container {
  max-width: 420px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
  text-align: center;
}
.verify-card {
  background: var(--surface-primary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
}
.verify-card.verified { border-color: var(--color-primary-400); }
.verify-card.invalid { border-color: #FCA5A5; }
.verify-icon { font-size: 48px; margin-bottom: var(--space-4); }
.verify-title { font-size: var(--font-size-xl); font-weight: 700; margin-bottom: var(--space-4); }
.verify-field { display: flex; justify-content: space-between; padding: var(--space-2) 0; border-bottom: 1px solid var(--border-light); font-size: var(--font-size-sm); }
.verify-field:last-child { border-bottom: none; }
.verify-field .v-label { color: var(--text-muted); }
.verify-field .v-value { color: var(--text-primary); font-weight: 500; text-align: right; }
.verify-hash { font-family: var(--font-mono); font-size: var(--font-size-xs); color: var(--text-muted); word-break: break-all; margin-top: var(--space-4); padding: var(--space-3); background: var(--surface-alt); border-radius: var(--radius-md); }
.verify-warning { font-size: var(--font-size-sm); color: #DC2626; margin-top: var(--space-4); padding: var(--space-3); background: #FEF2F2; border-radius: var(--radius-md); }

/* ═══ Camera Modal ─── */
.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.camera-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}
.camera-dialog {
  position: relative;
  width: 100%;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
}
.camera-dialog video {
  width: 100%;
  max-height: 70vh;
  border-radius: var(--radius-lg);
  background: #000;
  object-fit: cover;
}
.camera-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 360px;
  padding: 0 var(--space-2);
}
.camera-actions .btn-capture {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: transform 0.1s;
}
.camera-actions .btn-capture:active {
  transform: scale(0.9);
}