/* BADGER — Tactical Dark Theme */
:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-card: #1a1a1a;
  --bg-input: #222;
  --border: #2a2a2a;
  --border-focus: #555;
  --text-primary: #e8e8e8;
  --text-secondary: #aaa; /* Was #888, now 5.2:1 contrast on #141414 */
  --text-muted: #777; /* Was #555, now 4.6:1 contrast on #1a1a1a */
  --accent: #c8c8c8;
  --accent-hover: #fff;
  --danger: #c44;
  --success: #4a4;
  --warning: #ca4;
  --radius: 4px;
  --radius-lg: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    linear-gradient(45deg, rgba(120,120,120,0.4) 1px, transparent 1px),
    linear-gradient(-45deg, rgba(100,100,100,0.3) 1px, transparent 1px);
  background-size: 25px 25px, 30px 30px;
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

/* Typography */
h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
h2 { font-size: 1.1rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
h3 { font-size: 0.95rem; font-weight: 600; }

/* App Shell */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  font-family: Impact, 'Arial Black', sans-serif;
}

.content {
  flex: 1;
  padding: 20px;
  padding-bottom: 80px;
  overflow-y: auto;
}

/* Bottom Nav */
.nav {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  z-index: 50;
}

.nav-item {
  flex: 1;
  padding: 16px 0;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: color 0.15s;
  cursor: pointer;
}

.nav-item.active, .nav-item:hover {
  color: var(--text-primary);
}

.nav-item .icon {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 4px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.card:hover { border-color: var(--border-focus); }

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--text-primary); color: var(--bg-primary); border-color: var(--text-primary); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-full { width: 100%; }

/* Inputs */
input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus { border-color: var(--border-focus); }
input::placeholder { color: var(--text-muted); }

/* Checklist Items */
.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.check-item.checked { opacity: 0.4; }

.check-item .checkbox {
  width: 44px;
  height: 44px;
  border: 2px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.check-item .checkbox::before {
  content: '';
  width: 22px;
  height: 22px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--border-focus);
  border-radius: 3px;
}

.check-item.checked .checkbox::before {
  background: var(--text-primary);
  border-color: var(--text-primary);
}

.check-item.checked .checkbox {
  background: var(--text-primary);
  border-color: var(--text-primary);
}

.check-item .checkbox::after {
  content: '✓';
  color: var(--bg-primary);
  font-size: 0.8rem;
  font-weight: 700;
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.check-item.checked .checkbox::after { display: block; }

.check-item .item-photo {
  width: 64px;
  height: 40px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--bg-input);
}

.check-item .item-name {
  font-size: 0.9rem;
  font-weight: 500;
  flex: 1;
}

.check-item .item-category {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-bar .fill {
  height: 100%;
  background: var(--text-primary);
  transition: width 0.3s;
}

/* Search */
.search-wrap {
  position: relative;
  margin-bottom: 16px;
}

.search-wrap input { padding-left: 36px; }
.search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  font-size: 1.5rem;
  font-weight: 300;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: flex-end;
  z-index: 100;
}

.modal {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h2 { margin-bottom: 20px; }
.modal .field { margin-bottom: 16px; }
.modal label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Empty State */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty p { font-size: 0.85rem; margin-bottom: 20px; }

/* Utilities */
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }


/* Header Logo */
.header-logo {
  height: 32px;
  width: 32px;
  margin-right: 8px;
  vertical-align: middle;
  clip-path: inset(8% round 4px);
}

/* Empty state logo */
.empty .icon img {
  height: 64px;
  width: 56px;
  clip-path: inset(8% round 4px);
}

/* Enhanced Empty State */
.empty-illustration {
  margin-bottom: 24px;
  opacity: 0.6;
}

.empty-silhouette {
  width: 120px;
  height: 80px;
  filter: invert(1) opacity(0.8);
}

.empty-headline {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.empty-subtext {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.5;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.empty .btn-primary {
  min-width: 180px;
  margin-bottom: 12px;
}

.empty-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  min-width: 180px;
}

.empty-secondary:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ── FPS Calculator Styles ── */

.fps-input-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.fps-input-group {
  margin-bottom: 16px;
}

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

.fps-input-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.weight-select-wrapper {
  position: relative;
}

.fps-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  text-align: center;
}

.fps-result-main {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.fps-result-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.fps-result-value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin: 8px 0;
}

.fps-result-value-sm {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin: 8px 0;
}

.fps-result-unit {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fps-result-secondary {
  margin-top: 20px;
}

.fps-limit-input-row {
  display: flex;
  gap: 8px;
}

.fps-limit-input-row select {
  flex: 1;
}

.fps-limit-input-row input {
  width: 90px;
  flex-shrink: 0;
  text-align: center;
  font-weight: 600;
}

.fps-limit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.9rem;
}

.fps-limit-card.pass {
  background: rgba(68, 170, 68, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
}

.fps-limit-card.fail {
  background: rgba(204, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.fps-limit-icon {
  font-size: 1.2rem;
  font-weight: 700;
}

.fps-limit-text {
  flex: 1;
  font-size: 0.85rem;
}

.fps-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.fps-table-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.fps-table-scroll {
  max-height: 400px;
  overflow-y: auto;
  border-radius: var(--radius);
}

.fps-table {
  width: 100%;
  border-collapse: collapse;
}

.fps-table thead {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.fps-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.fps-table td {
  padding: 10px 12px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.fps-table tbody tr:last-child td {
  border-bottom: none;
}

.fps-table tbody tr.highlight {
  background: var(--bg-input);
  font-weight: 600;
}

.fps-table tbody tr:hover {
  background: var(--bg-secondary);
}

/* Update nav for 4 items */
.nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.nav-item {
  padding: 10px 0;
  font-size: 0.65rem;
}

.nav-item .icon {
  font-size: 1.1rem;
  margin-bottom: 3px;
}

/* Silhouette Picker */
.silhouette-cat-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.sil-cat-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.sil-cat-btn.active {
  border-color: var(--accent);
  color: var(--text-primary);
}

.silhouette-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}

.silhouette-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.15s;
}

.silhouette-item:hover, .silhouette-item:active {
  border-color: var(--accent);
}

.silhouette-item img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  opacity: 0.9;
}

.silhouette-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
}

/* Photo action sheet */
.photo-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.photo-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
}

.photo-action-btn:hover, .photo-action-btn:active {
  border-color: var(--accent);
}

.photo-action-icon {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
}

/* Suggestion Form */
.suggest-type-row {
  display: flex;
  gap: 8px;
}

.suggest-type-btn {
  flex: 1;
  font-size: 0.7rem !important;
  padding: 8px 6px !important;
}

.suggest-type-btn.active {
  border-color: var(--accent) !important;
  color: var(--text-primary) !important;
}

/* ── Loadout Image Picker ── */
.loadout-image-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-preview {
  width: 100%;
  height: 120px;
  background: #1a1a1a;
  border: 1px dashed #444;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-placeholder {
  color: #666;
  font-size: 0.85rem;
}

.image-picker-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 12px !important;
  font-size: 0.8rem !important;
}

.btn-danger-subtle {
  color: #e74c3c !important;
  border-color: #e74c3c !important;
}

/* ── Loadout card with cover image ── */
.loadout-card.has-image {
  min-height: 80px;
  background-size: cover;
  background-position: center right;
}

.loadout-card.has-image .card-title,
.loadout-card.has-image .card-meta {
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* ── Image Cropper ── */
#badger-cropper-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cropper-container {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.cropper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cropper-title {
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
}

.cropper-btn {
  background: none;
  border: 1px solid #555;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
}

.cropper-btn:active {
  background: #333;
}

.cropper-confirm {
  background: var(--accent, #E8A317) !important;
  border-color: var(--accent, #E8A317) !important;
  color: #000 !important;
}

.cropper-canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.cropper-canvas {
  display: block;
  touch-action: none;
}

.cropper-frame {
  position: absolute;
  border: 2px solid rgba(255,255,255,0.5);
  pointer-events: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.cropper-frame.cropper-circle {
  border-radius: 50%;
}

.cropper-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.cropper-zoom-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #222;
  border: 1px solid #555;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cropper-zoom-btn:active {
  background: #444;
}

.cropper-slider {
  flex: 1;
  accent-color: var(--accent, #E8A317);
  height: 4px;
}

/* ── Add to Loadout button ── */
.add-to-loadout-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #222;
  border: 1px solid #444;
  color: var(--accent, #E8A317);
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.add-to-loadout-btn:active {
  background: #333;
}

/* ── Toast notification ── */
.toast-msg {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 1.7s forwards;
  border: 1px solid var(--accent, #E8A317);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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

/* ── Loadout thumbnail icon ── */
.loadout-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #1a1a1a;
  border: 1px solid #333;
}

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

/* ── Pack Mode ── */
.pack-item {
  margin-bottom: 2px;
}

.pack-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card-bg, #1a1a1a);
  border-radius: 8px;
  cursor: pointer;
}

.pack-item-row .checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid #555;
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.pack-item-row .checkbox.checked {
  background: var(--accent, #E8A317);
  border-color: var(--accent, #E8A317);
}

.pack-item-row .checkbox.checked::after {
  content: '✓';
  color: #000;
  font-size: 0.8rem;
  font-weight: bold;
}

.line-through {
  text-decoration: line-through;
  opacity: 0.5;
}

.note-btn {
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.note-btn:hover, .note-btn:active {
  opacity: 1;
}

.item-note-preview {
  font-size: 0.75rem;
  color: var(--accent, #E8A317);
  margin-top: 2px;
  font-style: italic;
}

.pack-note-field {
  padding: 4px 12px 8px 44px;
}

.pack-note-field textarea {
  width: 100%;
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  padding: 8px;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

/* ── Item Detail Panel (notes in loadout view) ── */
.loadout-item-wrap {
  margin-bottom: 2px;
}

.item-detail-panel {
  padding: 4px 12px 10px 12px;
  background: #111;
  border-radius: 0 0 8px 8px;
  margin-top: -4px;
}

.item-detail-note label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 4px;
}

.item-detail-note textarea {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  padding: 8px;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 50px;
  font-family: inherit;
}

/* ── iOS Safe Area ── */
.nav {
  padding-bottom: env(safe-area-inset-bottom, 0px) !important;
}

.app {
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
}

.fab {
  bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
}

/* ── Fix nav text clipping ── */
.nav-item {
  line-height: 1.3 !important;
  overflow: visible !important;
  padding-top: 8px !important;
}

/* Pack mode item photos */
.pack-item-row .item-photo {
  width: 64px;
  height: 40px;
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
}

/* Drag to reorder */
.loadout-item-wrap.dragging {
  opacity: 0.5;
  background: var(--accent);
  border-radius: var(--radius);
}
.loadout-item-wrap.drag-over {
  border-top: 2px solid var(--accent);
}
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 8px 4px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  flex-shrink: 0;
}
.drag-handle:active {
  cursor: grabbing;
  color: var(--accent);
}

/* Loadout list drag-to-reorder */
.loadout-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 8px 4px 8px 10px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}
.loadout-drag-handle:active {
  cursor: grabbing;
  color: var(--accent);
}
.loadout-list-item {
  position: relative;
  padding-right: 36px; /* room for drag handle */
}
.loadout-list-item.dragging {
  opacity: 0.45;
  background: var(--accent);
  border-radius: var(--radius);
}
.loadout-list-item.drag-over {
  border-top: 2px solid var(--accent);
}
.loadout-drop-end-zone {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 12px 0 8px;
  opacity: 0.5;
  user-select: none;
  -webkit-user-select: none;
}
.loadout-drop-end-zone.drag-over-end {
  opacity: 1;
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  padding: 14px 0;
  background: rgba(0,255,0,0.05);
}

/* ── Pack Completion Celebration ── */
.pack-celebration {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 10, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: celebrationFadeIn 0.3s ease;
}

.pack-celebration.hidden {
  display: none;
}

.pack-celebration-content {
  text-align: center;
  animation: celebrationBounce 0.6s ease;
}

.pack-celebration-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: celebrationPulse 1.2s ease-in-out infinite;
}

.pack-celebration-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--success);
  margin-bottom: 8px;
}

.pack-celebration-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.pack-celebration-btn {
  background: var(--success);
  color: #000;
  border: none;
  border-radius: var(--radius);
  padding: 14px 32px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.pack-celebration-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

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

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

@keyframes celebrationBounce {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes celebrationPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ── Stop Clock / Game Timer Styles ── */

.timer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 16px;
}

.timer-display {
  font-size: 4.5rem;
  font-weight: 700;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  text-align: center;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  line-height: 1;
  margin-bottom: 20px;
  text-shadow: 0 0 30px rgba(200, 200, 200, 0.1);
  transition: color 0.3s, text-shadow 0.3s;
}

.timer-display.timer-expired {
  color: var(--danger);
  text-shadow: 0 0 40px rgba(204, 68, 68, 0.5);
  animation: timerExpiredPulse 0.5s ease-in-out infinite alternate;
}

@keyframes timerExpiredPulse {
  from { opacity: 1; }
  to { opacity: 0.7; }
}

.timer-progress {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 24px;
}

.timer-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--text-primary));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.timer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.timer-preset-btn {
  padding: 8px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.timer-preset-btn:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.timer-preset-btn.active {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--bg-card);
}

.timer-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.timer-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}

.timer-btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.timer-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.timer-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.timer-btn-icon {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.timer-btn-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timer-start {
  border-color: var(--success);
  color: var(--success);
}

.timer-start:hover:not(:disabled) {
  background: rgba(68, 170, 68, 0.1);
}

.timer-pause {
  border-color: var(--warning);
  color: var(--warning);
}

.timer-pause:hover:not(:disabled) {
  background: rgba(204, 170, 68, 0.1);
}

.timer-reset {
  border-color: var(--text-secondary);
}

.timer-info {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.timer-info p {
  margin: 0;
}

/* Timer tab alert animation */
.nav-item.timer-tab-alert {
  animation: timerTabPulse 0.5s ease-in-out infinite alternate;
  color: var(--accent) !important;
}

.nav-item.timer-tab-alert .icon {
  animation: timerTabShake 0.3s ease-in-out infinite;
}

@keyframes timerTabPulse {
  from {
    opacity: 1;
    text-shadow: 0 0 0 transparent;
  }
  to {
    opacity: 1;
    text-shadow: 0 0 8px var(--accent);
  }
}

@keyframes timerTabShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

/* Update nav for 5 items */
.nav {
  grid-template-columns: repeat(5, 1fr);
}

.nav-item {
  padding: 8px 2px;
  font-size: 0.6rem;
}

.nav-item .icon {
  font-size: 1rem;
  margin-bottom: 2px;
}

/* Screen reader only content */
.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;
}

/* Focus indicators — WCAG 2.4.7 Focus Visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:focus-visible,
.nav-item:focus-visible,
.card:focus-visible,
.fab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Remove default outline for mouse users, keep for keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion support — WCAG 2.3.3 Animation from Interactions */
@media (prefers-reduced-motion: reduce) {
  .pack-celebration,
  .pack-celebration-content,
  .pack-celebration-icon {
    animation: none !important;
    transition: none !important;
  }

  /* Still show the celebration, just without motion */
  .pack-celebration {
    opacity: 1;
  }
}

/* Shot Timer Styles */
.shot-timer-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  margin: 20px auto;
  max-width: 500px;
  box-shadow: var(--shadow);
}

.shot-timer-mode-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.mode-btn {
  flex: 1;
  padding: 8px 16px;
  border: 2px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  border-color: var(--accent);
}

.mode-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.par-time-selector {
  margin-bottom: 20px;
  padding: 12px;
  background: var(--bg-alt);
  border-radius: 8px;
}

.par-time-selector label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.par-time-selector select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
}

.sensitivity-control {
  margin-bottom: 20px;
  padding: 12px;
  background: var(--bg-alt);
  border-radius: 8px;
}

.sensitivity-control label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.sensitivity-control input[type="range"] {
  width: 100%;
  margin: 8px 0;
}

.shot-timer-display {
  text-align: center;
  margin-bottom: 24px;
}

.shot-count {
  font-size: 1.5em;
  font-weight: bold;
  margin-bottom: 20px;
  color: var(--accent);
}

.shot-count .label {
  font-size: 0.8em;
  color: var(--text-secondary);
  margin-right: 8px;
}

.time-display {
  margin-bottom: 20px;
}

.time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px 12px;
  background: var(--bg-alt);
  border-radius: 6px;
}

.time-row .label {
  font-weight: 500;
  color: var(--text-secondary);
}

.time-row .value {
  font-family: 'Courier New', monospace;
  font-weight: bold;
  color: var(--text);
}

.par-time-display {
  margin-top: 20px;
  padding: 16px;
  background: var(--accent-light);
  border-radius: 8px;
  border: 2px solid var(--accent);
}

.par-time-value {
  font-size: 1.8em;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
}

.par-time-value.par-time-expired {
  animation: timerExpiredPulse 0.5s ease-in-out infinite alternate;
}

.par-time-status {
  text-align: center;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9em;
}

.shot-timer-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.shot-timer-btn {
  flex: 1;
  padding: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.shot-timer-btn.start {
  background: var(--success);
  color: white;
}

.shot-timer-btn.stop {
  background: var(--danger);
  color: white;
}

.shot-timer-btn.reset {
  background: var(--warning);
  color: white;
}

.shot-timer-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.shot-timer-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-icon {
  font-size: 1.2em;
}

.btn-label {
  font-size: 0.9em;
}

.shot-timer-info {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9em;
}

.shot-timer-info p {
  margin: 8px 0;
}
