/* Jobs Browser — Dark FFXI theme */

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #16213e;
  color: #e0e0e0;
  height: 100vh;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
#header {
  display: flex;
  flex-direction: column;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  flex-shrink: 0;
}

#header-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 2px;
}

#header-row2 {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 10px 5px;
  flex-wrap: wrap;
}

#header h1 {
  font-size: 16px;
  color: #e94560;
  white-space: nowrap;
}

.nav-icon { height: 20px; vertical-align: middle; margin-right: 4px; image-rendering: pixelated; }

#nav { display: flex; gap: 4px; }
#nav a { color: #aaa; text-decoration: none; font-size: 12px; padding: 2px 6px; border-radius: 3px; }
#nav a:hover { color: #fff; }
#nav a.nav-active { color: #e94560; font-weight: bold; }

/* Job/Sub selects */
#job-select-wrap, #sub-select-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

#job-select-wrap label, #sub-select-wrap label {
  font-size: 12px;
  color: #aaa;
  white-space: nowrap;
}

#header-row2 select {
  padding: 3px 4px;
  border: 1px solid #0f3460;
  border-radius: 3px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 12px;
}

#header-row2 select:focus { border-color: #e94560; outline: none; }

#header-row2 input[type="number"] {
  width: 42px;
  padding: 3px 2px;
  border: 1px solid #0f3460;
  border-radius: 3px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 16px;
  text-align: center;
}

#header-row2 input[type="number"]:focus { border-color: #e94560; outline: none; }

/* Stat bar */
#stat-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: #0c0c28;
  border-bottom: 1px solid #8b7d3c;
  flex-shrink: 0;
  flex-wrap: wrap;
}

#stat-bar.hidden { display: none; }

.stat-item {
  font-size: 12px;
  white-space: nowrap;
}

.stat-label { color: #aaa; }
.stat-value { color: #f0c040; font-weight: bold; margin-left: 2px; }
.stat-hp .stat-value { color: #5fd35f; }
.stat-mp .stat-value { color: #7fc8ff; }

/* Skill caps summary */
#skill-caps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 16px;
  padding: 6px 12px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  flex-shrink: 0;
  max-width: 420px;
}

#skill-caps.hidden { display: none; }

.cap-item {
  font-size: 11px;
  padding: 1px 0;
}

.cap-header {
  display: flex;
  gap: 6px;
}

.cap-has-ws .cap-header {
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 2px;
  margin: -1px -2px;
}

.cap-has-ws .cap-header:hover { background: rgba(255,255,255,0.05); }

.cap-name { color: #aaa; flex: 1; }
.cap-val { font-weight: bold; font-variant-numeric: tabular-nums; min-width: 26px; text-align: right; }
.cap-combat .cap-val { color: #e0d0a0; }
.cap-defense .cap-val { color: #a0d0ff; }
.cap-magic .cap-val { color: #d0b0f0; }

.cap-arrow {
  font-size: 8px;
  color: #666;
  transition: transform 0.15s;
  width: 10px;
  text-align: center;
  flex-shrink: 0;
}
.cap-arrow-open { transform: rotate(90deg); }

/* WS accordion list */
.ws-list {
  padding: 2px 0 4px 4px;
}
.ws-list.hidden { display: none; }

.ws-entry {
  display: flex;
  gap: 6px;
  font-size: 10px;
  padding: 1px 0;
  color: #ccc;
}

.ws-entry.ws-locked { color: #555; }

.ws-lvl {
  min-width: 24px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #888;
}
.ws-locked .ws-lvl { color: #444; }

.ws-name { white-space: nowrap; }

/* Skill table */
#results-wrap {
  flex: 1;
  overflow: auto;
}

#skill-table {
  border-collapse: collapse;
  font-size: 11px;
  width: 100%;
}

#skill-table.hidden { display: none; }

#skill-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

#skill-table th {
  background: #16213e;
  border-bottom: 2px solid #0f3460;
  padding: 4px 6px;
  text-align: center;
  font-weight: bold;
  font-size: 10px;
  color: #aaa;
  white-space: nowrap;
}

#skill-table th:first-child {
  text-align: right;
  position: sticky;
  left: 0;
  z-index: 11;
}

#skill-table td {
  padding: 2px 6px;
  border-bottom: 1px solid #0f3460;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

#skill-table td:first-child {
  text-align: right;
  font-weight: bold;
  color: #aaa;
  background: #1a1a2e;
  position: sticky;
  left: 0;
  z-index: 1;
}

#skill-table tbody tr:hover { background: rgba(233, 69, 96, 0.08); }

/* Highlight current level row */
#skill-table tr.current-level {
  background: rgba(240, 192, 64, 0.12);
}

#skill-table tr.current-level td:first-child {
  color: #f0c040;
  background: rgba(240, 192, 64, 0.12);
}

/* Column type coloring */
.col-combat { color: #e0d0a0; }
.col-defense { color: #a0d0ff; }
.col-magic { color: #d0b0f0; }

/* Section header cells in thead */
th.section-combat { color: #f0c040; border-bottom-color: #f0c040; }
th.section-defense { color: #7fc8ff; border-bottom-color: #7fc8ff; }
th.section-magic { color: #d0a0ff; border-bottom-color: #d0a0ff; }

/* Zero values dimmed */
.skill-zero { color: #444; }

#loading {
  text-align: center;
  color: #888;
  padding: 40px;
  font-size: 14px;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #1a1a2e; }
::-webkit-scrollbar-thumb { background: #0f3460; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #e94560; }

/* Mobile responsive */
@media (max-width: 768px) {
  #header-row1 { padding: 3px 6px 1px; gap: 4px; }
  #header-row2 { padding: 1px 6px 3px; gap: 6px; }
  #header h1 { font-size: 13px; }
  #stat-bar { padding: 4px 8px; gap: 8px; }
  .stat-item { font-size: 11px; }
  #skill-table { font-size: 10px; }
  #skill-table th { padding: 3px 4px; font-size: 9px; }
  #skill-table td { padding: 2px 4px; }
}

@media (max-width: 480px) {
  #header h1 { display: none; }
}
