/* skills/styles.css — NPC-style layout for Skills (self-contained, no NPC file links) */

:root{
  --bg-x: 0px;
  --bg-y: 0px;
  --zoom: 1;

  --accent: #22c55e;
  --danger: #f87171;

  --radius: 14px;
  --pixel-border: 1px;
  --shadow-soft: 0 18px 45px rgba(0,0,0,0.70);

  --surface: rgba(10, 12, 16, 0.72);
  --surface-soft: rgba(255,255,255,0.10);

  --border-subtle: rgba(148,163,184,0.25);
  --border-strong: rgba(148,163,184,0.55);

  --text-main: rgba(255,255,255,0.92);
  --text-dim: rgba(255,255,255,0.78);
  --text-faint: rgba(255,255,255,0.66);

  --hover: rgba(255,255,255,0.06);

  --bg-overlay: rgba(0,0,0,0.58);

  --transition-fast: 140ms ease;
}

*{ box-sizing: border-box; }

html,body{
  height:100%;
  margin:0;
  background: #05070a;
}

body{
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text-main);
  background: transparent;
  image-rendering: pixelated;
  position: relative;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(100,116,139,0.7) transparent;
}
*::-webkit-scrollbar { width: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(100,116,139,0.7);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(148,163,184,0.95);
}

/* Fixed background layer */
.bg{
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("https://myfo2.com/zones/noob-island.png");
  background-repeat: no-repeat;

  background-size: calc(4096px / var(--zoom)) calc(3072px / var(--zoom));
  background-position: var(--bg-x) var(--bg-y);
  background-color: #05070a;
  image-rendering: pixelated;
}

.bg::after{
  content:"";
  position:absolute;
  inset:0;
  background: var(--bg-overlay);
  pointer-events:none;
}

#fo2-skills-app{ width: 100%; }
body.has-skill-modal{ overflow: hidden; }

.wrap{
  margin: 0 auto;
  padding: 14px;
  position: relative;
  z-index: 1;
}

/* App container (same feel as NPC app-inner) */
.app-inner{
  min-height: 0;
  display: flex;
  flex-direction: column;

  background-image: linear-gradient(135deg, rgba(15,23,42,0.97), rgba(34,197,94,0.12));
  background-repeat: no-repeat;
  background-position: top left;
  background-size: 100% 100vh;
  background-attachment: fixed;

  border: var(--pixel-border) solid rgba(148,163,184,0.35);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(15,23,42,0.8),
    var(--shadow-soft);
  backdrop-filter: blur(22px);
  overflow: hidden;
}

/* -----------------------------
   Toolbar (same pattern)
----------------------------- */

.tool-bar{
  padding: 8px 18px 6px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  align-items: center;
}

.tool-left,
.tool-right{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tool-left{
  flex: 1 1 520px;
  min-width: 0;
}

.tool-right{
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-faint);
}

/* Search */
.search-wrap{ position: relative; flex: 1 1 auto; width: 100%; min-width: 0; }

.search-wrap::before{
  content: "⌕";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-faint);
}

.search-input{
  background: rgb(255 255 255 / 11%);
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 6px 10px 6px 26px;
  font-size: 1rem;
  color: var(--text-main);
  outline: none;
  width: 90%;
  min-width: 0;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

.search-input::placeholder{ color: var(--text-faint); }

/* Selects */
.select-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
}

.select-wrap select{
  background: rgba(15,23,42,0.96);
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 5px 26px 5px 10px;
  font-size: 1rem;
  color: var(--text-main);
  outline: none;
  appearance: none;
  cursor: pointer;
  min-width: 140px;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

.select-wrap::after{
  content: "";
  position: absolute;
  right: 9px;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 2px solid var(--text-faint);
  border-top-color: transparent;
  border-left-color: transparent;
  transform: translateY(-1px) rotate(45deg);
  pointer-events: none;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.search-input:focus,
.select-wrap select:focus{
  border-color: rgba(34,197,94,0.7);
  box-shadow:
    0 0 0 1px rgba(34,197,94,0.45),
    0 0 20px rgba(34,197,94,0.3);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.select-wrap:focus-within::after{
  border-color: var(--accent);
  transform: translateY(-1px) rotate(45deg) scale(1.04);
}

/* Make these filters dark/opaque like NPC page filters */
#skillLevelFilter,
#skillEffectFilter,
#skillRankFilter{
  background: rgba(0,0,0,0.62);
}
#skillLevelFilter:focus,
#skillEffectFilter:focus,
#skillRankFilter:focus{
  background: rgba(0,0,0,0.72);
}
#skillLevelFilter option,
#skillEffectFilter option,
#skillRankFilter option{
  background-color: #000;
  color: var(--text-main);
}

/* -----------------------------
   Main
----------------------------- */

.app-main{
  padding: 10px 18px 14px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* -----------------------------
   Skills list (NPC-style shell + grid)
----------------------------- */

.skill-list-shell{
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  position: relative;
  overflow: visible;
}

.skill-list-shell::after{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(148,163,184,0.04), transparent 70%);
  pointer-events: none;
}

.skill-list-header{
  display: grid;
  grid-template-columns: minmax(0, 2.6fr) minmax(0, 1.6fr) minmax(0, 2.2fr);
  gap: 8px;
  font-size: 1.2rem;
  color: var(--text-faint);
  padding: 4px 4px 6px;
  border-bottom: 1px solid #ffffff2b;
}

.skill-list-header span{
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.skill-row{
  display: grid;
  grid-template-columns: minmax(0, 2.6fr) minmax(0, 1.6fr) minmax(0, 2.2fr);
  gap: 8px;
  padding: 6px 4px;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  background: transparent;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
}

.skill-row:hover{
  background: rgb(255 255 255 / 6%);
  transform: translateY(-1px);
  scale: 1.02;
  transition: 0.2s;
  border-radius: 7px;
}

.skill-main-cell{
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.skill-swatch{
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
  background-color: rgba(15,23,42,0.9);
}

.skill-name-wrap{ min-width: 0; }

.skill-name{
  font-size: 1.2rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skill-subline,
.skill-col{
  font-size: 1rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skill-col{ color: var(--text-dim); }

/* Empty state */
.empty-state{
  padding: 16px 4px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}

/* Responsive list */
@media (max-width: 768px){
  .skill-list-header{ display: none; }

  .skill-row{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
  }

  .skill-main-cell{ flex: 1 1 auto; }

  .skill-col.skill-basics{
    flex: 0 0 auto;
    margin-left: auto;
    text-align: right;
    max-width: 52%;
  }

  .skill-col.skill-costs{ display: none; }
}

/* -----------------------------
   Pager (shared)
----------------------------- */

.pager-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 6px;
  font-size: 1.2rem;
  color: var(--text-faint);
}

.pager-bottom{
  margin-top: 6px;
  border-top: 1px solid rgba(15,23,42,0.9);
  padding-top: 6px;
}

.pager-count{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
}

.pager-controls{
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pager-label{
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pager-select select{ min-width: 80px; }

.pager-btn{
  padding: 3px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(15,23,42,0.96);
  font-size: 0.8rem;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast),
    color var(--transition-fast);
}

.pager-btn:hover:not(.pager-btn-disabled):not(:disabled){
  background: rgba(34,197,94,0.18);
  border-color: rgba(34,197,94,0.9);
  box-shadow:
    0 0 0 1px rgba(34,197,94,0.7),
    0 8px 18px rgba(0,0,0,0.8);
  transform: translateY(-1px);
  text-decoration: none;
}

.pager-btn-disabled,
.pager-btn:disabled{
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

/* -----------------------------
   Modal (NPC-style)
----------------------------- */

.modal-backdrop{
  position: fixed;
  inset: 0;
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop.open{
  display: flex;
  animation: backdropFade 180ms ease-out;
}

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

.modal{
  width: 100%;
  max-width: 640px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(34,197,94,0.18), transparent 65%),
    radial-gradient(circle at bottom right, rgba(59,130,246,0.16), transparent 70%),
    #020617;
  border: var(--pixel-border) solid rgba(148,163,184,0.45);
  box-shadow:
    0 0 0 1px rgba(15,23,42,0.9),
    0 28px 70px rgba(0,0,0,0.9);
  overflow: visible;
  animation: modalIn 200ms cubic-bezier(0.25, 0.9, 0.3, 1.2);
}

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

.modal-header{
  padding: 10px 14px 14px;
  border-bottom: 1px solid #ffffff14;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top-right-radius: 16px;
  border-top-left-radius: 16px;
  overflow: visible;
}

.modal-swatch{
  width: 40px;
  height: 40px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,0.75));
  background-color: rgba(15,23,42,0.85);
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

@media (max-width: 640px){
  .modal-swatch{ transform: translateY(-6px) scale(1.35); }
}

.modal-title-wrap{ flex: 1; min-width: 0; }

.modal-title{
  font-size: 1.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-sub{
  font-size: 1.2rem;
  color: var(--text-faint);
}

.modal-close{
  border: 0;
  background: rgba(15,23,42,0.95);
  color: var(--text-dim);
  border-radius: 10px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  padding: 0;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.modal-close:hover{
  background: rgba(248,113,113,0.1);
  color: var(--danger);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(248,113,113,0.4);
}

.modal-body{
  padding: 10px 14px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr);
  gap: 10px;
  font-size: 12px;
  color: var(--text-dim);
  background: radial-gradient(circle at bottom, rgba(15,23,42,0.6), transparent 60%);
}

@media (max-width: 640px){
  .modal-body{ grid-template-columns: 1fr; }
}

.modal-section-title{
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 4px;
}

.modal-description{
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--border-subtle);
  padding: 6px 7px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.modal-pills{
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.modal-pill{
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(148,163,184,0.5);
  background: rgba(15,23,42,0.95);
  color: var(--text-faint);
}

.modal-rows{
  margin-top: 4px;
  font-size: 11px;
}

.modal-row{
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px dotted rgba(15,23,42,0.95);
}

.modal-row:last-child{ border-bottom: none; }

.modal-row-label{ color: var(--text-faint); }
.modal-row-value{
  text-align: right;
  color: var(--text-main);
  white-space: nowrap;
}

/* Force visibility if other global CSS messes with .modal */
#skillModalBackdrop .modal{
  display: block;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

/* Modal footer */
.modal-footer{
  padding: 8px 14px 10px;
  border-top: 1px solid rgba(15,23,42,0.95);
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

.modal-footer-actions{
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.skill-edit-btn{
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid rgba(148,163,184,0.7);
  background: rgba(15,23,42,0.96);
  font-size: 0.8rem;
  color: var(--text-main);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast),
    color var(--transition-fast);
}

.skill-edit-btn:hover{
  border-color: rgba(34,197,94,0.9);
  background: rgba(34,197,94,0.18);
  box-shadow:
    0 0 0 1px rgba(34,197,94,0.7),
    0 10px 24px rgba(0,0,0,0.9);
  transform: translateY(-1px);
}

/* -----------------------------
   Linked item card (modal)
----------------------------- */

.skill-linked-item-wrapper{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skill-linked-item-empty{
  border-radius: 10px;
  border: 1px dashed rgba(148,163,184,0.35);
  background: rgba(15,23,42,0.65);
  padding: 8px 10px;
  color: var(--text-faint);
  font-size: 1rem;
}

.skill-linked-item-card{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background:
    radial-gradient(circle at top left, rgba(34,197,94,0.14), transparent 60%),
    rgba(15,23,42,0.96);
  box-shadow: 0 10px 22px rgba(15,23,42,0.75), 0 0 0 1px rgba(15,23,42,0.8);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast),
    background var(--transition-fast);
  text-decoration: none;
}

.skill-linked-item-card:hover{
  transform: translateY(-1px);
  border-color: rgba(34,197,94,0.85);
  box-shadow:
    0 0 0 1px rgba(34,197,94,0.55),
    0 12px 26px rgba(0,0,0,0.9);
  text-decoration: none;
}

.skill-linked-item-icon{
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(15,23,42,0.95);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.skill-linked-item-name{
  font-size: 1.1rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.skill-linked-item-id{
  font-size: 1rem;
  color: var(--text-faint);
}

/* -----------------------------
   Toast (same feel)
----------------------------- */

.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(12px);
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.6);
  background:
    radial-gradient(circle at top left, rgba(34,197,94,0.25), transparent 60%),
    rgba(15,23,42,0.98);
  color: #f9fafb;
  font-size: 1rem;
  line-height: 1.3;
  box-shadow: 0 18px 45px rgba(0,0,0,0.85);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 80;
  transition:
    opacity 180ms ease-out,
    transform 180ms ease-out;
}

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

/* Mobile toolbar */
@media (max-width: 640px){
  .tool-bar{
    flex-direction: column;
    align-items: flex-start;
  }
  .tool-right{ width: 100%; margin-left: 0; }
  .search-input{ width: 90%; }
}
