/*
 * Nuzlocke — Item Selection Table
 *
 * Table-based held item picker used in teambuilding.
 * Equipped item is shown in a slot above the table; selecting a row from
 * the table equips it. The slot has an × to unequip.
 */

/* =============================================
   PANEL CONTAINER
   ============================================= */

.nz-item-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

/* =============================================
   EQUIPPED ITEM SLOT
   ============================================= */

.nz-item-equipped {
  width: 100%;
}

.nz-item-equipped-filled {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: color-mix(in srgb, var(--nz-accent) 8%, var(--nz-bg));
  border: 1px solid color-mix(in srgb, var(--nz-accent) 40%, var(--nz-border));
  clip-path: var(--nz-clip-sm);
  min-height: 40px;
  box-sizing: border-box;
}

.nz-item-equipped-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--nz-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.nz-item-equipped-desc {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--nz-text-dim);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nz-item-equipped-remove {
  flex-shrink: 0;
  position: relative;
  width: 20px;
  height: 20px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--nz-border);
  border-radius: 50%;
  color: var(--nz-text-dim);
  font-size: 0;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  margin-left: auto;
}

.nz-item-equipped-remove::before,
.nz-item-equipped-remove::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
}

.nz-item-equipped-remove::before { transform: translate(-50%, -50%) rotate(45deg); }
.nz-item-equipped-remove::after  { transform: translate(-50%, -50%) rotate(-45deg); }

.nz-item-equipped-remove:hover {
  border-color: var(--nz-danger);
  color: var(--nz-danger);
}

.nz-item-equipped-empty {
  padding: 7px 12px;
  min-height: 40px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  border: 1px dashed var(--nz-border);
  border-radius: var(--nz-radius);
  color: var(--nz-text-dim);
  font-size: 12px;
  font-style: italic;
}

/* =============================================
   SEARCH BAR
   ============================================= */

.nz-item-search {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  background: var(--nz-bg);
  border: 1px solid var(--nz-border);
  border-radius: var(--nz-radius);
  color: var(--nz-text);
  font-family: var(--nz-font-ui);
  font-size: 13px;
}

.nz-item-search::placeholder {
  color: var(--nz-text-dim);
}

.nz-item-search:focus {
  outline: none;
  border-color: var(--nz-accent);
}

/* =============================================
   TABLE CONTAINER
   ============================================= */

.nz-item-table-wrap {
  max-height: calc(100vh - 700px);
  min-height: 100px;
  overflow-y: auto;
  border: 1px solid var(--nz-border);
  border-radius: var(--nz-radius);
}

.nz-item-table-wrap::-webkit-scrollbar {
  width: 6px;
}
.nz-item-table-wrap::-webkit-scrollbar-track {
  background: var(--nz-bg);
}
.nz-item-table-wrap::-webkit-scrollbar-thumb {
  background: var(--nz-border);
  border-radius: 3px;
}

/* =============================================
   TABLE
   ============================================= */

.nz-item-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--nz-font-ui);
  font-size: 13px;
  table-layout: fixed;
}

.nz-item-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.nz-item-table th {
  background: var(--nz-surface);
  color: var(--nz-text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid var(--nz-border);
  white-space: nowrap;
  user-select: none;
}

.nz-item-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(46, 66, 104, 0.4);
  vertical-align: middle;
  color: var(--nz-text);
}

.nz-item-table tr:last-child td {
  border-bottom: none;
}

.nz-item-table tbody tr {
  background: var(--nz-bg);
  cursor: pointer;
  transition: background 0.1s;
}

.nz-item-table tbody tr:hover {
  background: var(--nz-elevated);
}

/* =============================================
   EMPTY STATE
   ============================================= */

.nz-item-table td.nz-item-no-results {
  height: 34px;
  padding: 0 8px;
  text-align: center;
  color: var(--nz-text-dim);
  font-style: italic;
}

/* =============================================
   COLUMN WIDTHS
   ============================================= */

.nz-item-col-sprite {
  width: 36px;
  min-width: 36px;
  text-align: center;
  padding: 3px 4px;
}

.nz-item-col-name {
  width: 150px;
  min-width: 100px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nz-item-col-desc {
  min-width: 140px;
}

.nz-item-col-desc-inner {
  font-size: 12px;
  color: var(--nz-text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nz-item-col-location {
  width: 140px;
  min-width: 100px;
  max-width: 140px;
  font-family: var(--nz-font-mono);
  font-size: 12px;
  color: var(--nz-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hidden on desktop; shown on mobile */
.nz-item-mobile { display: none; }

@media (max-width: 800px) {
  .nz-item-desktop { display: none !important; }
  .nz-item-mobile  { display: block; }

  /* ── Card list container ── */
  .nz-item-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 30vh;
    overflow-y: auto;
    border: 1px solid var(--nz-border);
    border-radius: var(--nz-radius);
  }

  .nz-item-list::-webkit-scrollbar { width: 6px; }
  .nz-item-list::-webkit-scrollbar-track { background: var(--nz-bg); }
  .nz-item-list::-webkit-scrollbar-thumb { background: var(--nz-border); border-radius: 3px; }

  /* ── Individual item cards ── */
  .nz-item-card {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(46, 66, 104, 0.4);
    background: var(--nz-bg);
    cursor: pointer;
    transition: background 0.1s;
  }

  .nz-item-card:last-child { border-bottom: none; }
  .nz-item-card:hover { background: var(--nz-elevated); }

  /* Line 1: icon + name + location right-aligned */
  .nz-item-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .nz-item-card-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--nz-text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nz-item-card-location {
    font-family: var(--nz-font-mono);
    font-size: 11px;
    color: var(--nz-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Line 2: effect description */
  .nz-item-card-desc {
    font-size: 11px;
    color: var(--nz-text-dim);
    line-height: 1.4;
    margin-top: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* No-results message */
  li.nz-item-no-results {
    padding: 12px 10px;
    text-align: center;
    color: var(--nz-text-dim);
    font-style: italic;
    font-size: 13px;
    list-style: none;
  }
}
