/* Recycle planner — single page layout */

.page-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-head__icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(55, 211, 154, 0.12);
  color: var(--ok);
  font-size: 1.25rem;
}

.page-head__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
}

.page-head__sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.page-stats {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.z5-app-layout--single {
  min-height: 100dvh;
}

.z5-app-content--single {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.craft-row__name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.craft-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.craft-layout--browse,
.craft-layout--detail {
  grid-template-columns: 1fr;
}

.craft-layout--detail {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.craft-panel--loadout {
  display: flex;
  flex-direction: column;
}

.craft-panel--loadout .card-body {
  flex: 1;
}

.craft-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
}

.craft-foot__actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.craft-page .btn-primary--compact {
  appearance: none;
  border: 1px solid rgba(55, 211, 154, 0.45);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(55, 211, 154, 0.22), rgba(39, 168, 122, 0.18));
  color: #dffef0;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: auto;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s, opacity 0.15s;
}

.craft-page .btn-primary--compact:hover:not(:disabled) {
  border-color: rgba(55, 211, 154, 0.7);
  box-shadow: 0 0 16px rgba(55, 211, 154, 0.16);
  transform: translateY(-1px);
}

.craft-page .btn-primary--compact:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.craft-page .craft-foot .btn-sm {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s, opacity 0.15s;
}

.craft-page .craft-foot .btn-sm:hover:not(:disabled) {
  border-color: #4d6fa8;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.craft-page .craft-foot .btn-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Inventory-style tooltips for catalog grid */
.inv-item__tooltip {
  display: none;
  position: fixed;
  z-index: 9999;
  background: #1a1b23;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font-size: 0.72rem;
  pointer-events: none;
  max-width: 220px;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.inv-item__tooltip strong {
  font-size: 0.75rem;
  font-weight: 600;
}

.inv-item__tooltip-mods {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.68rem;
  text-align: left;
  line-height: 1.45;
}

.inv-item__tooltip-mod { color: #c4cad6; }
.inv-item__tooltip-mod--Common    { color: #9ca3af; }
.inv-item__tooltip-mod--Uncommon  { color: #22c55e; }
.inv-item__tooltip-mod--Rare      { color: #3b82f6; }
.inv-item__tooltip-mod--Epic      { color: #a855f7; }
.inv-item__tooltip-mod--Legendary { color: #f59e0b; }

.craft-panel--catalog .card-body {
  max-height: min(72vh, 760px);
  overflow: auto;
}

.craft-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.craft-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.craft-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.craft-search:focus-within {
  border-color: rgba(55, 211, 154, 0.45);
  box-shadow: 0 0 0 2px rgba(55, 211, 154, 0.12);
}

.craft-search__icon {
  flex-shrink: 0;
  opacity: 0.75;
}

.craft-search:focus-within .craft-search__icon {
  color: var(--ok);
  opacity: 1;
}

.craft-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font-size: 0.88rem;
}

.craft-search input::placeholder {
  color: var(--dim);
}

.craft-search input::-webkit-search-cancel-button,
.craft-search input::-webkit-search-decoration {
  display: none;
}

.craft-search__clear {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.craft-search__clear:hover {
  background: rgba(248, 131, 131, 0.16);
  color: var(--err);
}

.craft-search__clear[hidden] {
  display: none !important;
}

.craft-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.craft-tab {
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.craft-tab:hover {
  color: var(--text);
  border-color: rgba(101, 216, 255, 0.35);
}

.craft-tab.is-on {
  color: #dffef0;
  border-color: rgba(55, 211, 154, 0.5);
  background: rgba(55, 211, 154, 0.14);
}

.craft-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}

.craft-grid {
  --craft-cell: 72px;
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--craft-cell));
  gap: 0.5rem;
  justify-content: start;
}

.craft-grid-empty,
.craft-muted {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.5rem 0.5rem;
  margin: 0;
}

.craft-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--craft-cell);
  height: var(--craft-cell);
  aspect-ratio: 1;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  overflow: hidden;
  flex-shrink: 0;
}

.craft-item[data-rarity="Common"] {
  border-bottom: 2px solid #9ca3af;
  background: rgba(156, 163, 175, 0.05);
}

.craft-item[data-rarity="Uncommon"] {
  border-bottom: 2px solid #22c55e;
  background: rgba(34, 197, 94, 0.05);
}

.craft-item[data-rarity="Rare"] {
  border-bottom: 2px solid #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.craft-item[data-rarity="Epic"] {
  border-bottom: 2px solid #a855f7;
  background: rgba(168, 85, 247, 0.05);
}

.craft-item[data-rarity="Legendary"] {
  border-bottom: 2px solid #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.craft-item:hover {
  border-color: rgba(55, 211, 154, 0.45);
  background: rgba(55, 211, 154, 0.06);
  transform: translateY(-1px);
}

.craft-item.is-added {
  border-color: rgba(55, 211, 154, 0.55);
  background: rgba(55, 211, 154, 0.1);
}

.craft-img {
  display: block;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 5px;
}

.craft-item .craft-img,
.craft-item .craft-img--missing {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.craft-img--missing {
  display: grid;
  place-items: center;
  color: #6b7280;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.04);
}

.craft-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.craft-empty__icon {
  font-size: 1.4rem;
  color: var(--dim);
  margin-bottom: 0.5rem;
}

.craft-empty p { margin: 0; }

.craft-empty[hidden],
.craft-list[hidden] {
  display: none !important;
}

.craft-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.craft-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto 28px;
  gap: 0.55rem;
  align-items: center;
  padding: 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
}

.craft-row__main { min-width: 0; }

.craft-row__name {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f3f4f6;
  line-height: 1.25;
}

.craft-row__name:hover { color: var(--cyan); }

.craft-row__type {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.craft-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.45rem;
}

.craft-level {
  min-width: 1.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.craft-level:hover {
  border-color: rgba(55, 211, 154, 0.35);
  color: var(--text);
}

.craft-level.is-on {
  border-color: rgba(55, 211, 154, 0.55);
  background: rgba(55, 211, 154, 0.12);
  color: var(--ok);
}

.craft-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
}

.craft-qty button {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.craft-qty button:hover { color: var(--text); background: rgba(255,255,255,0.04); }

.craft-qty input {
  width: 42px;
  height: 28px;
  border: 0;
  border-inline: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: center;
  font-size: 0.78rem;
  -moz-appearance: textfield;
}

.craft-qty input::-webkit-outer-spin-button,
.craft-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.craft-row__remove {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(248, 131, 131, 0.08);
  color: #f88383;
  cursor: pointer;
}

.craft-row__remove:hover { background: rgba(248, 131, 131, 0.16); }

/* Modal */
.craft-modal[hidden] { display: none !important; }

.craft-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z5-z-modal);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.craft-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.craft-modal__dialog {
  position: relative;
  width: min(720px, 100%);
  max-height: min(calc(100dvh - 2rem), 820px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(175deg, #111d32 0%, #0c1424 100%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.craft-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.craft-modal__eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.craft-modal__title {
  margin: 0.25rem 0 0;
  font-size: 1.15rem;
}

.craft-modal__close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
}

.craft-modal__body {
  overflow: auto;
  padding: 1rem 1.1rem 1.2rem;
  display: grid;
  gap: 1rem;
}

.craft-modal__section h3 {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.craft-modal__hint {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.craft-modal__empty {
  justify-content: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.craft-modal__meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.craft-edge__body {
  flex: 1;
  min-width: 0;
}

.craft-modal__materials .craft-edge__name,
.craft-modal__loadout .craft-edge__name { flex: unset; font-size: 0.85rem; font-weight: 600; }

.craft-modal__loadout,
.craft-modal__materials {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.craft-modal__materials li,
.craft-modal__loadout li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}

.craft-modal__materials .craft-edge__qty,
.craft-modal__loadout .craft-edge__qty {
  color: var(--cyan);
  font-weight: 700;
  font-size: 0.85rem;
}

/* Detail page */
.craft-detail__hero-body {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.craft-detail__name {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.craft-detail__quote {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.5;
}

.craft-detail__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
}

.tag--rarity { color: var(--cyan); border-color: rgba(101, 216, 255, 0.25); }
.tag--ok { color: var(--ok); border-color: rgba(55, 211, 154, 0.3); }

.craft-edge-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.craft-edge__link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.craft-edge__link:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.craft-edge__name { flex: 1; font-size: 0.85rem; font-weight: 600; }
.craft-edge__qty { color: var(--cyan); font-weight: 700; }

.craft-edge__meta {
  display: block;
  margin: 0.1rem 0 0 3.4rem;
  font-size: 0.72rem;
  color: var(--warn);
}

.craft-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.craft-tree__children {
  list-style: none;
  margin: 0.35rem 0 0.35rem calc(0.75rem + var(--depth, 0) * 0.5rem);
  padding-left: 0.75rem;
  border-left: 1px dashed rgba(55, 211, 154, 0.25);
}

.craft-tree__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  flex-wrap: wrap;
}

.craft-tree__name {
  font-size: 0.82rem;
  font-weight: 600;
}

.craft-tree__name:hover { color: var(--cyan); }

.craft-tree__qty {
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 700;
}

.craft-tree__workshop {
  font-size: 0.68rem;
  color: var(--warn);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(247, 186, 83, 0.25);
}

.craft-tree__node--leaf .craft-tree__name { color: #dffef0; }

.craft-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
}

.craft-empty-state i {
  font-size: 2rem;
  color: var(--warn);
  margin-bottom: 0.75rem;
}

.craft-empty-state h2 { margin: 0 0 0.5rem; }
.craft-empty-state p { color: var(--muted); margin: 0 0 1rem; }

.rarity-rare { border-color: rgba(59, 130, 246, 0.35) !important; }
.rarity-epic { border-color: rgba(168, 85, 247, 0.35) !important; }
.rarity-legendary { border-color: rgba(245, 158, 11, 0.35) !important; }
.rarity-uncommon { border-color: rgba(34, 197, 94, 0.35) !important; }

@media (max-width: 1100px) {
  .craft-layout--detail { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .craft-grid { --craft-cell: 64px; }
  .craft-detail__hero-body { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
  .craft-grid { --craft-cell: 56px; }
}

.craft-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(55, 211, 154, 0.45);
  background: rgba(8, 28, 20, 0.95);
  color: #80f0c4;
  font-size: 0.82rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.craft-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
