/* ── HISTORY & TIMELINE SHARED ──────────────────────────────────────── */

body.history-page,
body.military-page {
  background: var(--bg);
}

/* ── PAGE HEADER ─────────────────────────────────────────────────────── */
.calibers-header {
  padding: 96px 0 32px;
  border-bottom: 0.5px solid var(--border);
}

.calibers-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.calibers-sub {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.5px;
}

/* Reuse calibers-header styles via class */
.breadcrumb {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb:hover { color: var(--text); }

/* ── FILTER BAR ─────────────────────────────────────────────────────── */
.filter-bar {
  position: sticky;
  top: 60px;
  z-index: 50;
  background: rgba(7,7,26,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 0.5px solid var(--border);
  padding: 12px 0;
}

.filter-row-1 {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--dim);
  pointer-events: none;
}

#search {
  width: 100%;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 36px 9px 34px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
#search:focus { border-color: rgba(255,212,59,0.35); }
#search::placeholder { color: var(--dim); }

.search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.filter-row-2 {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.chip-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.chip-group::-webkit-scrollbar { display: none; }

.chip-label {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--dim);
  margin-right: 2px;
  white-space: nowrap;
}

.chip {
  font-family: var(--mono);
  font-size: 9px;
  background: transparent;
  border: 0.5px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: var(--muted);
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.chip.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 700;
}

.db-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.result-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.db-sep { color: var(--dim); font-size: 10px; }

.db-action-btn {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  transition: color 0.15s;
}
.db-action-btn:hover { color: var(--muted); }

/* ── TIMELINE BODY ──────────────────────────────────────────────────── */
.tl-body {
  padding: 0 0 80px;
}

.table-empty {
  padding: 60px 24px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
}

/* ── VERTICAL TIMELINE ──────────────────────────────────────────────── */
.timeline-wrap {
  position: relative;
  padding-top: 8px;
}

/* The vertical spine */
.timeline-wrap::before {
  content: '';
  position: absolute;
  left: 56px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

/* ── ERA HEADER ─────────────────────────────────────────────────────── */
.tl-era {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 36px 0 16px 76px;
}

.tl-era-label {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--dim);
  text-transform: uppercase;
  white-space: nowrap;
}

.tl-era-line {
  flex: 1;
  height: 0.5px;
  background: var(--border);
}

/* ── ENTRY ROW ──────────────────────────────────────────────────────── */
.tl-entry {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
}

.tl-year-col {
  width: 48px;
  flex-shrink: 0;
  text-align: right;
  padding-top: 13px;
  padding-right: 0;
}

.tl-year {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.3px;
}

.tl-dot-col {
  width: 17px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding-top: 17px;
}

.tl-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--bg);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: transform 0.15s;
}

.tl-entry:hover .tl-dot,
.tl-entry.active .tl-dot {
  transform: scale(1.3);
}

.tl-card {
  flex: 1;
  padding: 10px 12px 10px 14px;
  border-radius: 6px;
  transition: background 0.1s;
  min-width: 0;
}

.tl-entry:hover .tl-card {
  background: rgba(255,255,255,0.03);
}

.tl-entry.active .tl-card {
  background: rgba(255,212,59,0.06);
}

.tl-cat-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 5px;
  opacity: 0.85;
}

.tl-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.tl-meta {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  margin-bottom: 4px;
}

.tl-tagline {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

/* ── DETAIL DRAWER ──────────────────────────────────────────────────── */
.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.detail-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 58%;
  max-width: 760px;
  min-width: 360px;
  z-index: 100;
  background: var(--bg);
  border-left: 0.5px solid var(--border);
  box-shadow: -24px 0 60px rgba(0,0,0,0.45);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.detail-panel.open {
  transform: translateX(0);
}

.detail-overlay-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(7,7,26,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 0.5px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
}

.detail-back {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s;
}
.detail-back:hover { color: var(--text); }

.detail-inner {
  padding: 28px 24px 80px;
}

.detail-name {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.2;
}

.detail-meta-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

.detail-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
}

.detail-badge-outline {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.1);
  padding: 3px 8px;
  border-radius: 4px;
}

.detail-body {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.85;
}

.detail-spec-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.spec-item {
  background: rgba(255,255,255,0.02);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}

.spec-label {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--dim);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.spec-value {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.spec-value.accent { color: var(--accent); }

/* ── FORM MODALS ─────────────────────────────────────────────────────── */
.form-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.form-modal-inner {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

.form-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 0.5px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
}

.form-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.form-modal-body {
  padding: 20px 20px 24px;
}

.form-modal-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

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

.form-field label {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.8px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: rgba(255,212,59,0.4); }
.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--dim); }

.form-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.form-field select option { background: var(--surface); color: var(--text); }
.form-field textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

.req { color: var(--accent); }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.form-cancel {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
}
.form-cancel:hover { color: var(--text); }

.form-success {
  text-align: center;
  padding: 32px 20px;
}

.form-success-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(46,204,113,0.15);
  border: 0.5px solid rgba(46,204,113,0.3);
  color: #2ecc71;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.form-success p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 300px;
  margin: 0 auto;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .detail-panel { width: 100%; min-width: unset; max-width: unset; border-left: none; box-shadow: none; }
  .db-sep { display: none; }
  .form-modal { align-items: flex-end; padding: 0; }
  .form-modal-inner { border-radius: 16px 16px 0 0; max-width: 100%; }
  .timeline-wrap::before { left: 44px; }
  .tl-era { padding-left: 60px; }
  .tl-year-col { width: 36px; }
  .tl-dot-col { width: 17px; }
}

@media (max-width: 420px) {
  .result-count { display: none; }
  .db-action-btn { font-size: 8px; }
}
