/* ============================================
   DESIGN SYSTEM - GLOBAL CSS
   ============================================ */

:root {
  --bg-main: #0f1115;
  --bg-card: #161a22;
  --bg-card-alt: #1c2230;

  --text-main: #e6e8ee;
  --text-muted: #9aa4b2;

  --accent-main: #c9a24d;
  --accent-hover: #e0b85c;

  --border-soft: #2a3142;
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2 {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-main);
}

/* Exception : les liens dans les h1 gardent leur couleur de lien */
h1 a {
  color: inherit;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

a {
  color: var(--accent-main);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-alt {
  background-color: var(--bg-card-alt);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--accent-main);
  color: var(--bg-main);
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: inherit;
}

.btn:hover {
  background-color: var(--accent-hover);
}

.btn:active {
  transform: scale(0.98);
}

/* Liens dans les boutons : garder la couleur du bouton */
.btn,
.btn:hover,
.btn:active,
.btn:visited {
  color: var(--bg-main);
  text-decoration: none;
}

.btn a,
.btn a:hover,
.btn a:active,
.btn a:visited {
  color: var(--bg-main);
  text-decoration: none;
}

.btn-secondary {
  background-color: var(--bg-card-alt);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}

.btn-secondary:hover {
  background-color: var(--bg-card);
}

.btn-primary {
  background-color: var(--accent-main);
  color: var(--bg-main);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  font-weight: 500;
}

.form-group select,
.form-group input[type="number"],
.form-group input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--accent-main);
}

.form-group input[type="radio"] {
  width: auto;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent-main);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

/* ============================================
   RESULTS
   ============================================ */

.result {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  display: none;
}

.result.show {
  display: block;
}

.result-content {
  color: var(--text-main);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.8;
  font-size: 1.05rem;
}

.result-meta {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-soft);
}

/* Styles pour le générateur de quêtes */
.quest-section {
  margin-bottom: 1.5rem;
}

.quest-section:last-child {
  margin-bottom: 0;
}

.quest-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-main);
  margin-bottom: 0.5rem;
}

.quest-text {
  color: var(--text-main);
  line-height: 1.6;
}

/* Styles pour le générateur de PNJ */
.npc-name {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-main);
  margin-bottom: 0.5rem;
}

.npc-identity {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-style: italic;
}

.npc-section {
  margin-bottom: 1.5rem;
}

.npc-section:last-child {
  margin-bottom: 0;
}

.npc-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-main);
  margin-bottom: 0.5rem;
}

.npc-text {
  color: var(--text-main);
  line-height: 1.6;
}

.npc-secret {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-soft);
}

.npc-secret .npc-label {
  color: var(--text-muted);
}

.result-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--accent-main);
}

/* Structure améliorée du résultat */
.result-main {
  margin-bottom: 1.5rem;
}

.result-notation {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-family: 'Courier New', monospace;
}

.result-total {
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent-main);
  line-height: 1;
  margin: 1rem 0;
  text-align: center;
}

.result-details {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 1rem;
}

.result-history {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-soft);
}

.result-history-title {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.result-history-item {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-history-item:last-child {
  border-bottom: none;
}

.result-history-notation {
  font-family: 'Courier New', monospace;
  color: var(--text-main);
}

.result-history-total {
  font-weight: 600;
  color: var(--accent-main);
}

/* ============================================
   SECTIONS
   ============================================ */

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.intro-text {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* ============================================
   TOOLS GRID
   ============================================ */

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tool-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-main);
  margin-bottom: 0.75rem;
}

.tool-card p {
  flex-grow: 1;
  margin-bottom: 1.5rem;
}

.tool-card .btn {
  margin-top: auto;
  width: 100%;
  text-align: center;
}

/* ============================================
   HEADER & FOOTER
   ============================================ */

header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-soft);
  padding: 1.5rem 0;
  margin-bottom: 2rem;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.site-title a {
  color: var(--accent-main) !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-title a:hover {
  color: var(--accent-hover) !important;
}

footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-soft);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  color: var(--text-muted);
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  * {
    background: white !important;
    color: black !important;
  }

  .btn {
    display: none;
  }

  .card {
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }

  .result {
    display: block !important;
  }

  .result-total {
    color: black !important;
    font-size: 3rem;
  }

  .result-history {
    display: none;
  }
}

/* ============================================
   QUICK ACCESS
   ============================================ */

.quick-access {
  margin: 1rem 0 1.5rem;
  text-align: center;
}

@media (min-width: 768px) {
  .quick-access {
    display: none;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

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

  .result-total {
    font-size: 3rem;
  }

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

/* ============================================
   GÉNÉRATEUR DE PNJ
   ============================================ */

.pnj-container {
  max-width: 960px;
  margin: 2rem auto;
}

.pnj-header {
  margin-bottom: 1.5rem;
  text-align: left;
}

.pnj-header h1 {
  margin-bottom: 0.5rem;
}

.pnj-header p {
  margin: 0;
  color: var(--text-muted);
}

.pnj-filters {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background-color: var(--bg-card);
}

.pnj-filters h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.filter-group {
  margin-bottom: 1rem;
}

.filter-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background-color: var(--bg-card-alt);
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  white-space: nowrap;
  font-family: inherit;
}

.filter-btn:hover {
  border-color: var(--accent-main);
  transform: translateY(-1px);
}

.filter-btn.active {
  background-color: var(--accent-main);
  color: var(--bg-main);
  border-color: var(--accent-main);
}

.pnj-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.pnj-actions .btn-main {
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.pnj-actions .btn-main span {
  margin-right: 0.35rem;
}

.pnj-actions .hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pnj-card {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background-color: var(--bg-card);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.pnj-name {
  margin-bottom: 0.5rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-main);
  word-break: break-word;
}

.pnj-subtitle {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.badge {
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge-race {
  background-color: rgba(31, 95, 139, 0.2);
  color: #6ba3d1;
  border: 1px solid rgba(31, 95, 139, 0.4);
}

.badge-gender {
  background-color: rgba(94, 53, 177, 0.2);
  color: #b39ddb;
  border: 1px solid rgba(94, 53, 177, 0.4);
}

.badge-occupation {
  background-color: rgba(201, 162, 77, 0.2);
  color: var(--accent-main);
  border: 1px solid rgba(201, 162, 77, 0.4);
}

.pnj-section {
  margin-top: 1.2rem;
}

.pnj-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.pnj-section p {
  margin: 0;
  line-height: 1.5;
  color: var(--text-main);
}

.pnj-section ul {
  margin: 0.2rem 0 0 1.2rem;
  padding: 0;
  color: var(--text-main);
}

.pnj-section ul li {
  margin-bottom: 0.2rem;
}

@media (max-width: 768px) {
  .pnj-container {
    padding: 0 1rem;
  }

  .pnj-filters {
    padding: 1rem;
  }

  .pnj-card {
    padding: 1.1rem;
  }

  .pnj-name {
    font-size: 1.4rem;
  }
}

/* ============================================
   KO-FI SUPPORT
   ============================================ */

/* Bloc de soutien dans le footer */
.kofi-support {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-soft);
}

.kofi-support-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  margin-top: 0.5rem;
  line-height: 1.6;
}

/* Bouton Ko-fi discret (alternative plus sobre) */
.kofi-button.kofi-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 14px;
  border: 1px solid #29ABE0;
  border-radius: 4px;
  text-decoration: none;
  color: #29ABE0;
  background-color: transparent;
  box-shadow: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.kofi-button.kofi-btn:hover {
  background-color: #29ABE0;
  border-color: #29ABE0;
  color: #ffffff;
  opacity: 1;
  transform: none;
  box-shadow: none;
}

.kofi-button.kofi-btn:focus {
  outline: 2px solid #29ABE0;
  outline-offset: 2px;
}

/* Bouton Ko-fi avec couleur #29ABE0 */
.kofi-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: #29ABE0;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s ease, transform 0.1s ease;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.kofi-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
  color: #ffffff;
}

.kofi-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.kofi-button:focus {
  outline: 2px solid #29ABE0;
  outline-offset: 2px;
}

/* Petit rappel Ko-fi sur les pages d'outils */
.kofi-reminder {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-soft);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.kofi-reminder a {
  color: #29ABE0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.2s ease;
}

.kofi-reminder a:hover {
  opacity: 0.8;
}

.kofi-reminder a:focus {
  outline: 2px solid #29ABE0;
  outline-offset: 2px;
  border-radius: 2px;
}

@media (max-width: 768px) {
  .kofi-support {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
  }

  .kofi-button {
    width: 100%;
    text-align: center;
    display: block;
  }

  .kofi-reminder {
    font-size: 0.85rem;
  }
}