/* Palia Section Tracker — Frontend CSS */

#pst-app {
  --pst-accent:      #7c6aff;
  --pst-accent-dim:  rgba(124, 106, 255, 0.12);
  --pst-green:       #4ade80;
  --pst-green-dim:   rgba(74, 222, 128, 0.12);
  --pst-red:         #ff6b6b;
  --pst-gold:        #f0b429;
  --pst-muted:       #888;
  --pst-text:        #e0d8f8;
  --pst-card-bg:     rgba(255, 255, 255, .06);
  --pst-card-border: rgba(255, 255, 255, .10);
  --pst-bg-sidebar:  rgba(0, 0, 0, .25);
  --pst-border:      rgba(255, 255, 255, .10);

  font-family: inherit;
  color: inherit;
  min-height: 300px;
  padding: 20px;
  box-sizing: border-box;
}

/* ── Header ── */

#pst-app .pst-header {
  margin-bottom: 16px;
}

#pst-app .pst-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

#pst-app .pst-filter-tab {
  background: var(--pst-card-bg);
  border: 1px solid var(--pst-card-border);
  border-bottom: 2px solid transparent;
  color: var(--pst-muted);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}

#pst-app .pst-filter-tab:hover {
  color: var(--pst-text);
  border-color: var(--pst-accent);
}

#pst-app .pst-filter-tab.active {
  color: #fff;
  background: var(--pst-accent-dim);
  border-color: var(--pst-accent);
  border-bottom-color: var(--pst-accent);
}

/* ── Toolbar ── */

#pst-app .pst-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#pst-app .pst-search {
  flex: 1;
  min-width: 160px;
  background: var(--pst-card-bg);
  border: 1px solid var(--pst-card-border);
  color: var(--pst-text);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
}

#pst-app .pst-search:focus {
  outline: none;
  border-color: var(--pst-accent);
}

#pst-app .pst-search::placeholder {
  color: var(--pst-muted);
}

/* ── Buttons ── */

#pst-app .pst-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 7px 14px;
  transition: opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}

#pst-app .pst-btn:hover {
  opacity: .85;
}

#pst-app .pst-btn-sync {
  background: var(--pst-accent);
  color: #fff;
}

#pst-app .pst-btn-reset {
  background: var(--pst-card-bg);
  color: var(--pst-muted);
  border: 1px solid var(--pst-card-border);
}

#pst-app .pst-btn-back {
  background: var(--pst-card-bg);
  color: var(--pst-text);
  border: 1px solid var(--pst-card-border);
}

#pst-app .pst-btn-nav {
  background: var(--pst-card-bg);
  color: var(--pst-accent);
  border: 1px solid var(--pst-accent);
  font-size: 13px;
}

#pst-app .pst-sync-status {
  font-size: 12px;
  color: var(--pst-green);
}

/* ── Check label (toolbar) ── */

#pst-app .pst-toolbar .pst-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--pst-muted);
  cursor: pointer;
}

#pst-app .pst-toolbar .pst-check-label input {
  accent-color: var(--pst-accent);
}

/* ── Progress Bar ── */

#pst-app .pst-progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

#pst-app .pst-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--pst-card-border);
  border-radius: 3px;
  overflow: hidden;
}

#pst-app .pst-progress-bar-fill {
  height: 100%;
  background: var(--pst-accent);
  border-radius: 3px;
  transition: width .4s ease;
  width: 0%;
}

#pst-app .pst-progress-label {
  font-size: 13px;
  color: var(--pst-muted);
  white-space: nowrap;
}

/* ── Card Grid ── */

#pst-app .pst-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

#pst-app .pst-empty {
  color: var(--pst-muted);
  text-align: center;
  padding: 40px 0;
  grid-column: 1 / -1;
}

/* ── Card ── */

#pst-app .pst-card {
  background: var(--pst-card-bg);
  border: 1px solid var(--pst-card-border);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  transition: border-color .2s, transform .15s, opacity .2s;
  display: flex;
  flex-direction: column;
}

#pst-app .pst-card:hover {
  border-color: var(--pst-accent);
  transform: translateY(-2px);
}

#pst-app .pst-card.pst-checked {
  opacity: 0.6;
  border-color: var(--pst-green);
}

#pst-app .pst-card-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 16px;
  line-height: 1;
  color: var(--pst-green);
  font-weight: 700;
}

#pst-app .pst-card-star {
  position: absolute;
  top: 6px;
  right: 7px;
  z-index: 2;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--pst-muted);
  line-height: 1;
  padding: 0;
  transition: color .15s;
}

#pst-app .pst-card-star:hover,
#pst-app .pst-card-star.active {
  color: var(--pst-gold);
}

#pst-app .pst-card-clickable {
  cursor: pointer;
  flex: 1;
}

/* ── Card Image ── */

#pst-app .pst-card-img-wrap {
  aspect-ratio: 1 / 1;
  background: rgba(0, 0, 0, .3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

#pst-app .pst-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  top: 0;
  left: 0;
}

#pst-app .pst-card-icon {
  font-size: 36px;
  opacity: .25;
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Card Body ── */

#pst-app .pst-card-body {
  padding: 8px 10px 6px;
}

#pst-app .pst-card-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 3px;
  color: var(--pst-text);
}

#pst-app .pst-card-badge {
  font-size: 11px;
  color: var(--pst-muted);
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  margin-top: 2px;
}

/* ── Card Footer ── */

#pst-app .pst-card-footer {
  background: rgba(0, 0, 0, .3);
  padding: 6px 10px;
  display: flex;
  align-items: center;
}

#pst-app .pst-card-footer .pst-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--pst-muted);
  cursor: pointer;
}

#pst-app .pst-card-footer .pst-check-label input {
  accent-color: var(--pst-accent);
}

/* ── Detail Back ── */

#pst-app .pst-detail-back {
  margin-bottom: 12px;
}

#pst-app .pst-detail-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--pst-border);
  line-height: 1.2;
}

/* ── Detail Layout ── */

#pst-app .pst-detail-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

#pst-app .pst-detail-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--pst-bg-sidebar);
  border: 1px solid var(--pst-border);
  border-radius: 10px;
  overflow: hidden;
}

#pst-app .pst-detail-main {
  flex: 1;
  min-width: 0;
}

/* ── Sidebar Image ── */

#pst-app .pst-sidebar-img-wrap {
  aspect-ratio: 1 / 1;
  background: rgba(0, 0, 0, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

#pst-app .pst-sidebar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  top: 0;
  left: 0;
}

#pst-app .pst-sidebar-icon {
  font-size: 52px;
  opacity: .15;
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Sidebar Title & Table ── */

#pst-app .pst-sidebar-title {
  font-size: 15px;
  font-weight: 700;
  padding: 12px 14px 8px;
  color: #fff;
  border-bottom: 1px solid var(--pst-border);
}

#pst-app .pst-sidebar-table {
  width: 100%;
  border-collapse: collapse;
}

#pst-app .pst-sidebar-table td {
  padding: 7px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--pst-border);
  vertical-align: top;
  color: var(--pst-text);
}

#pst-app .pst-sidebar-label {
  color: var(--pst-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  width: 42%;
  background: rgba(0, 0, 0, .15);
}

/* ── Sidebar Check & Star ── */

#pst-app .pst-detail-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 12px 4px;
  padding: 10px 14px;
  background: var(--pst-green-dim);
  border: 1px solid rgba(74, 222, 128, .2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--pst-muted);
  box-sizing: border-box;
}

#pst-app .pst-detail-check-label input {
  accent-color: var(--pst-green);
}

#pst-app .pst-detail-check-label.active {
  color: var(--pst-green);
  border-color: var(--pst-green);
  background: rgba(74, 222, 128, .15);
}

#pst-app .pst-detail-star {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 12px 12px;
  padding: 8px 14px;
  background: var(--pst-card-bg);
  border: 1px solid var(--pst-card-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--pst-muted);
  width: calc(100% - 24px);
  box-sizing: border-box;
  font-family: inherit;
  transition: color .15s, border-color .15s;
}

#pst-app .pst-detail-star.active {
  color: var(--pst-gold);
  border-color: var(--pst-gold);
}

/* ── Content Text ── */

#pst-app .pst-content-text {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--pst-border);
  border-radius: 8px;
  padding: 16px;
  color: var(--pst-text);
  margin: 0;
}

#pst-app .pst-detail-empty {
  color: var(--pst-muted);
  font-style: italic;
  padding: 20px 0;
}

/* ── Detail Nav ── */

#pst-app .pst-detail-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--pst-border);
  gap: 12px;
}

/* ── Mobile ── */

@media (max-width: 640px) {
  #pst-app .pst-detail-layout {
    flex-direction: column;
  }

  #pst-app .pst-detail-sidebar {
    width: 100%;
  }

  #pst-app .pst-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  #pst-app .pst-detail-title {
    font-size: 22px;
  }
}
