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

html {
  scroll-behavior: smooth;
}

:root {
  --bg: #0a0a0f;
  --surface: #111118;
  --surface2: #1a1a24;
  --border: #2a2a3a;
  --accent: #ff6b2b;
  --accent2: #ff9a5c;
  --text: #e8e8f0;
  --muted: #6b6b88;
  --success: #3de68e;
  --success-dim: rgba(61, 230, 142, 0.08);
  --warning: #f9c74f;
  --warning-dim: rgba(249, 199, 79, 0.08);
  --danger: #ff6b6b;
  --info: #4cc9f0;
  --info-dim: rgba(76, 201, 240, 0.06);
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Syne', sans-serif;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 60px;
  position: relative;
  z-index: 1;
}

/* ── Navbar ── */
.navbar {
  position: relative;
  padding: 48px 0 36px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
  background: linear-gradient(180deg, #0f0f1a 0%, var(--bg) 100%);
  overflow: hidden;
}

.navbar::after {
  content: '';
  position: absolute;
  top: -60px;
  left: -40px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255, 107, 43, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.navbar-inner {
  position: relative;
  z-index: 1;
}

.navbar h1 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  margin: 0;
}

/* ── Alerts ── */
.alert {
  padding: 16px 18px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.7;
  border: 1.5px solid;
}

.alert strong {
  color: #fff;
  font-weight: 700;
}

.alert a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.alert a:hover {
  color: var(--accent2);
}

.alert ul {
  margin: 8px 0 8px 18px;
}

.alert-info {
  background: var(--info-dim);
  border-color: rgba(76, 201, 240, 0.2);
  color: var(--text);
}

.alert-warning {
  background: rgba(255, 107, 107, 0.06);
  border-color: rgba(255, 107, 107, 0.2);
  color: var(--text);
}

/* ── Overall Progress ── */
.overall-progress {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  background: var(--success-dim);
  border: 1.5px solid rgba(61, 230, 142, 0.2);
  color: var(--success);
  font-weight: 700;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.5px;
}

/* ── Buttons ── */
.btn {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-export {
  background: var(--accent);
  color: #fff;
}

.btn-export:hover {
  background: var(--accent2);
  box-shadow: 0 4px 20px rgba(255, 107, 43, 0.3);
}

.btn-import {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-import:hover {
  border-color: var(--muted);
}

.import-label {
  cursor: pointer;
  color: inherit;
}

.progress-buttons {
  margin-bottom: 20px;
}

/* ── Quick Navigation ── */
.quick-navigation {
  margin-top: 10px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 24px;
}

.quick-navigation h4 {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.quick-navigation ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-navigation li {
  display: inline;
}

.quick-navigation a {
  color: var(--muted);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 12px;
  font-family: var(--mono);
  border: 1px solid var(--border);
  background: var(--surface2);
}

.quick-navigation a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Layout ── */
.layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.panel {
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 18px;
}

.inventory-panel {
  flex: 1;
  min-width: 260px;
  max-width: 320px;
}

.recipes-panel {
  flex: 3;
}

/* ── Headings ── */
h2 {
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}

h3 {
  margin-top: 28px;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

/* ── Small Text ── */
.small-text {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

/* ── Inventory ── */
.inventory-bulk-buttons {
  margin-bottom: 10px;
}

.inventory-list {
  max-height: none;
  overflow-y: visible;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface2);
}

.inventory-item {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text);
}

.inventory-item input[type="checkbox"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  margin-right: 6px;
  transition: all 0.15s;
}

.inventory-item input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.inventory-item input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

/* ── Tables ── */
.table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 16px;
}

.table th {
  text-align: left;
  background: linear-gradient(135deg, #2a2a3a, #1a1a24);
  color: #fff;
  padding: 10px 12px;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-family: var(--mono);
  vertical-align: top;
  color: var(--text);
}

.table-striped tbody tr:nth-child(odd) td,
.table-striped tbody tr:nth-child(odd) th {
  background: var(--surface2);
}

.table-striped tbody tr:nth-child(even) td,
.table-striped tbody tr:nth-child(even) th {
  background: var(--surface);
}

.table-hover tbody tr:hover {
  background: rgba(255, 107, 43, 0.04);
}

.table-hover tbody tr:hover td {
  background: rgba(255, 107, 43, 0.04);
}

.table-responsive {
  overflow-x: auto;
}

/* ── Craftable / Created Styles ── */
.craftable-row {
  background: var(--warning-dim);
}

.table tbody tr.craftable-row td {
  background: var(--warning-dim) !important;
  border-left: 2px solid var(--warning);
}

.table-hover tbody tr.craftable-row:hover td {
  background: rgba(249, 199, 79, 0.12) !important;
}

.created-row {
  background: var(--success-dim) !important;
}

.table tbody tr.created-row td {
  background: var(--success-dim) !important;
  border-left: 2px solid var(--success);
}

.table-hover tbody tr.created-row:hover td {
  background: rgba(61, 230, 142, 0.12) !important;
}

.craftable-yes {
  font-weight: 700;
  color: var(--success);
}

.craftable-no {
  color: var(--muted);
}

/* ── Created List ── */
.created-list {
  list-style: none;
  padding-left: 0;
  font-size: 12px;
  font-family: var(--mono);
}

.created-list li {
  margin-bottom: 5px;
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  border-left: 3px solid var(--success);
  color: var(--text);
}

/* ── Recipe Filters ── */
.recipe-filters {
  margin: 10px 0 16px 0;
  font-size: 12px;
  font-family: var(--mono);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
  color: var(--muted);
}

.recipe-filters label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.recipe-filters input[type="checkbox"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  margin-right: 4px;
  transition: all 0.15s;
}

.recipe-filters input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.recipe-filters input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

.recipe-filters select {
  margin-left: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
}

.recipe-filters select:focus {
  border-color: var(--accent);
}

.recipe-filters select option {
  background: var(--surface);
  color: var(--text);
}

/* ── Optimizer ── */
.optimizer-panel {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.optimizer-output {
  margin-top: 12px;
}

.optimizer-output .table {
  margin-top: 12px;
}

.optimizer-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.optimizer-options select {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
}

.optimizer-options select:focus {
  border-color: var(--accent);
}

.optimizer-options select option {
  background: var(--surface);
  color: var(--text);
}

.optimizer-options input[type="checkbox"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  margin-right: 4px;
  transition: all 0.15s;
}

.optimizer-options input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.optimizer-options input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

/* ── Optimizer Weapon Filters ── */
.optimizer-weapon-filters {
  margin: 10px 0 12px 0;
}

.optimizer-weapon-filters .weapon-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 6px;
}

.optimizer-weapon-filters .weapon-filter-name {
  font-weight: 700;
  min-width: 70px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--accent);
}

.optimizer-weapon-filters label {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
}

.optimizer-weapon-filters input[type="checkbox"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  margin-right: 4px;
  transition: all 0.15s;
}

.optimizer-weapon-filters input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.optimizer-weapon-filters input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .inventory-panel {
    max-width: none;
  }
}