/* Neon Sorcery - Discretion System Reference & Character Builder */
/* Cyberpunk neon aesthetic: dark backgrounds, magenta/cyan accent colors */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #22223a;
  --bg-input: #16162a;
  --border-color: #2a2a4a;
  --text-primary: #e0e0f0;
  --text-secondary: #9090b0;
  --text-muted: #606080;
  --neon-magenta: #ff2d95;
  --neon-cyan: #00f0ff;
  --neon-purple: #b44dff;
  --neon-green: #39ff14;
  --neon-yellow: #ffe600;
  --neon-orange: #ff6a00;
  --glow-magenta: 0 0 10px rgba(255, 45, 149, 0.4);
  --glow-cyan: 0 0 10px rgba(0, 240, 255, 0.4);
  --glow-purple: 0 0 10px rgba(180, 77, 255, 0.4);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== LAYOUT ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: 30px 0;
}

/* ===== HEADER / NAV ===== */
header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
}

.site-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.site-title .neon {
  color: var(--neon-magenta);
  text-shadow: var(--glow-magenta);
}

.site-title .sorcery {
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.site-title .system {
  color: var(--text-muted);
  font-size: 0.65em;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 8px;
}

nav {
  display: flex;
  gap: 8px;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  border: 1px solid transparent;
}

nav a:hover {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.05);
  border-color: rgba(0, 240, 255, 0.2);
}

nav a.active {
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  text-shadow: var(--glow-cyan);
}

/* ===== FOOTER ===== */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer a {
  color: var(--neon-cyan);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ===== HEADINGS ===== */
h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--neon-magenta);
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--neon-purple);
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: all var(--transition);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(0, 240, 255, 0.3);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--neon-cyan);
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-body {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

/* ===== TAGS / BADGES ===== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid;
}

.tag-magenta {
  color: var(--neon-magenta);
  border-color: rgba(255, 45, 149, 0.4);
  background: rgba(255, 45, 149, 0.1);
}

.tag-cyan {
  color: var(--neon-cyan);
  border-color: rgba(0, 240, 255, 0.4);
  background: rgba(0, 240, 255, 0.1);
}

.tag-purple {
  color: var(--neon-purple);
  border-color: rgba(180, 77, 255, 0.4);
  background: rgba(180, 77, 255, 0.1);
}

.tag-green {
  color: var(--neon-green);
  border-color: rgba(57, 255, 20, 0.4);
  background: rgba(57, 255, 20, 0.1);
}

.tag-yellow {
  color: var(--neon-yellow);
  border-color: rgba(255, 230, 0, 0.4);
  background: rgba(255, 230, 0, 0.1);
}

.tag-orange {
  color: var(--neon-orange);
  border-color: rgba(255, 106, 0, 0.4);
  background: rgba(255, 106, 0, 0.1);
}

/* ===== GRID LAYOUTS ===== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ===== FORM ELEMENTS ===== */
label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.15);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239090b0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

input[type="checkbox"] {
  accent-color: var(--neon-cyan);
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: middle;
}

.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== CHECKBOX LIST ===== */
.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.checkbox-item:hover {
  border-color: rgba(0, 240, 255, 0.3);
}

.checkbox-item.selected {
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.05);
}

.checkbox-item label {
  margin: 0;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.checkbox-item .item-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.btn-primary:hover {
  background: rgba(0, 240, 255, 0.2);
  box-shadow: var(--glow-cyan);
}

.btn-magenta {
  background: rgba(255, 45, 149, 0.1);
  border-color: var(--neon-magenta);
  color: var(--neon-magenta);
}

.btn-magenta:hover {
  background: rgba(255, 45, 149, 0.2);
  box-shadow: var(--glow-magenta);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--neon-cyan);
  border-bottom-color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar input[type="text"] {
  max-width: 300px;
}

.filter-bar select {
  max-width: 200px;
}

/* ===== BUILDER SECTIONS ===== */
.builder-section {
  margin-bottom: 30px;
}

.builder-section > h2 {
  margin-bottom: 16px;
}

.section-note {
  background: rgba(255, 45, 149, 0.08);
  border: 1px solid rgba(255, 45, 149, 0.25);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  color: var(--neon-magenta);
}

.section-note::before {
  content: "Note: ";
  font-weight: 600;
}

/* ===== CHARACTER SHEET PREVIEW ===== */
.sheet-preview {
  background: var(--bg-card);
  border: 1px solid var(--neon-cyan);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
}

.sheet-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.sheet-header h2 {
  border: none;
  padding: 0;
}

.sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.sheet-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sheet-field .field-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.sheet-field .field-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  padding: 4px 0;
  border-bottom: 1px solid var(--border-color);
  min-height: 28px;
}

.resource-track {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.resource-box {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-input);
}

.resource-box.filled {
  background: var(--neon-cyan);
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.resource-box.filled-magenta {
  background: var(--neon-magenta);
  border-color: var(--neon-magenta);
  box-shadow: var(--glow-magenta);
}

.resource-box.filled-purple {
  background: var(--neon-purple);
  border-color: var(--neon-purple);
  box-shadow: var(--glow-purple);
}

/* ===== REFERENCE PAGE ===== */
.ref-sidebar {
  position: sticky;
  top: 80px;
}

.ref-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 30px;
}

.ref-nav {
  list-style: none;
}

.ref-nav li {
  margin-bottom: 4px;
}

.ref-nav a {
  display: block;
  padding: 8px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.88rem;
  transition: all var(--transition);
  border-left: 2px solid transparent;
}

.ref-nav a:hover {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.05);
  border-left-color: var(--neon-cyan);
}

.ref-section {
  margin-bottom: 40px;
  scroll-margin-top: 80px;
}

.ref-section p {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.ref-subsection {
  margin-left: 16px;
  margin-top: 12px;
  padding-left: 16px;
  border-left: 2px solid var(--border-color);
}

.external-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--neon-cyan);
  text-decoration: none;
  font-size: 0.85rem;
  margin-top: 8px;
}

.external-link:hover {
  text-decoration: underline;
}

.external-link::after {
  content: " \2197";
}

/* ===== HERO SECTION ===== */
.hero {
  text-align: center;
  padding: 60px 20px;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 8px;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.hero .subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 30px;
}

.hero .tagline {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 30px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== FEATURE CARDS (HOME) ===== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: all var(--transition);
}

.feature-card:hover {
  border-color: rgba(0, 240, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===== EXPORT PANEL ===== */
.export-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 20px;
}

.export-panel pre {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.85rem;
  color: var(--neon-green);
  max-height: 400px;
  overflow-y: auto;
}

/* ===== CUSTOM ITEM NOTICE ===== */
.custom-notice {
  background: rgba(180, 77, 255, 0.08);
  border: 1px dashed rgba(180, 77, 255, 0.4);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 0.9rem;
  color: var(--neon-purple);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
    letter-spacing: 2px;
  }

  .ref-layout {
    grid-template-columns: 1fr;
  }

  .ref-sidebar {
    position: static;
  }

  .sheet-grid {
    grid-template-columns: 1fr;
  }

  header .container {
    flex-direction: column;
    gap: 8px;
  }

  nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== LOADING ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--neon-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== COLLAPSIBLE ===== */
.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 12px 0;
  user-select: none;
}

.collapsible-header::after {
  content: '\25B6';
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.collapsible-header.open::after {
  transform: rotate(90deg);
}

.collapsible-body {
  display: none;
  padding-bottom: 12px;
}

.collapsible-body.open {
  display: block;
}
