/* ============================================
   SHINOBI ADMIN - STYLES
   ============================================ */

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #1f2937;
  --bg-input: #374151;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-primary: #8b5cf6;
  --accent-secondary: #a78bfa;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --border-color: #374151;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --radius: 8px;
  --sidebar-width: 240px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

#login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-container {
  background: var(--bg-card);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
}

.login-container h1 {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--accent-primary);
  font-size: 1.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.error-message {
  color: var(--accent-danger);
  font-size: 0.875rem;
  margin-top: 1rem;
  text-align: center;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  gap: 0.5rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-secondary);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-color);
}

.btn-success {
  background: var(--accent-success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-danger {
  background: var(--accent-danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-back {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem;
}

.btn-back:hover {
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */

#main-app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  border-right: 1px solid var(--border-color);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
  font-size: 1.25rem;
  color: var(--accent-primary);
}

.nav-menu {
  list-style: none;
  padding: 1rem 0;
  flex: 1;
}

.nav-menu li a {
  display: block;
  padding: 0.875rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
}

.nav-menu li a:hover,
.nav-menu li a.active {
  background: var(--bg-card);
  color: var(--text-primary);
  border-left: 3px solid var(--accent-primary);
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* Content */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  background: var(--bg-primary);
  min-height: 100vh;
}

.page-content {
  max-width: 1400px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  flex: 1;
}

/* ============================================
   STATS CARDS
   ============================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.stat-icon {
  font-size: 2rem;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ============================================
   CHARTS
   ============================================ */

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.chart-card h3 {
  margin-bottom: 1rem;
  font-size: 1rem;
  color: var(--text-secondary);
}

.chart-card canvas {
  max-height: 250px;
}

/* ============================================
   INFO CARDS
   ============================================ */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.info-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.info-card h3 {
  margin-bottom: 1rem;
  font-size: 1rem;
  color: var(--text-secondary);
}

.info-list {
  list-style: none;
}

.info-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.info-list li:last-child {
  border-bottom: none;
}

.info-list .value {
  color: var(--accent-primary);
  font-weight: 500;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 1rem;
  text-align: left;
}

th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  text-transform: uppercase;
}

td {
  border-bottom: 1px solid var(--border-color);
}

tr:hover td {
  background: var(--bg-input);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pagination button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: var(--radius);
  cursor: pointer;
}

.pagination button:hover:not(:disabled) {
  background: var(--bg-input);
}

.pagination button.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Players table specific styles */
#players-table th:nth-child(1),
#players-table td:nth-child(1) {
  min-width: 150px;
  max-width: 200px;
}

#players-table th:nth-child(2),
#players-table td:nth-child(2) {
  min-width: 280px;
  max-width: 350px;
}

#players-table th:nth-child(3),
#players-table td:nth-child(3) {
  width: 80px;
  text-align: center;
}

.device-id-cell {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--text-secondary);
}

.device-name-cell {
  font-weight: 500;
  color: var(--accent-primary);
}

/* ============================================
   DETAIL PAGES
   ============================================ */

.detail-section {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.detail-section h3 {
  margin-bottom: 1rem;
  color: var(--accent-primary);
  font-size: 1.1rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.detail-item {
  padding: 0.75rem;
  background: var(--bg-input);
  border-radius: var(--radius);
}

.detail-item label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.detail-item .value {
  font-size: 1rem;
  color: var(--text-primary);
}

/* Stats bar */
.stat-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.stat-bar .name {
  width: 100px;
  font-size: 0.875rem;
}

.stat-bar .bar {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar .bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 4px;
}

.stat-bar .value {
  width: 30px;
  text-align: right;
  font-size: 0.875rem;
}

/* ============================================
   LOGS VIEW
   ============================================ */

.logs-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.logs-filters select,
.logs-filters input {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-primary);
}

.log-entry {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-family: monospace;
  font-size: 0.875rem;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry .log-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.log-entry .log-time {
  color: var(--text-muted);
}

.log-entry .log-type {
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.log-type.narration { background: #3b82f6; }
.log-type.choice_selected { background: #10b981; }
.log-type.resolution { background: #f59e0b; }
.log-type.combat { background: #ef4444; }
.log-type.system { background: #6b7280; }
.log-type.character_update { background: #8b5cf6; }
.log-type.npc_interaction { background: #ec4899; }

.log-entry .log-content {
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.log-json-toggle {
  margin-top: 0.5rem;
}

.log-json {
  background: var(--bg-secondary);
  padding: 0.5rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  overflow-x: auto;
  max-height: 200px;
}

/* ============================================
   BUILD APK PAGE
   ============================================ */

.build-info-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.build-info-card h3 {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

#apk-info {
  margin-bottom: 1rem;
}

#apk-info p {
  margin-bottom: 0.5rem;
}

.build-actions {
  display: flex;
  gap: 1rem;
}

.build-console-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.build-console-card h3 {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.console {
  background: #0d1117;
  padding: 1rem;
  border-radius: var(--radius);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.875rem;
  max-height: 400px;
  overflow-y: auto;
  color: #c9d1d9;
}

.console-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.console-line {
  margin-bottom: 0.25rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.console-line.log { color: #c9d1d9; }
.console-line.info { color: #58a6ff; }
.console-line.warn { color: #d29922; }
.console-line.error { color: #f85149; }
.console-line.success { color: #3fb950; }

/* ============================================
   MODAL
   ============================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* ============================================
   UTILITIES
   ============================================ */

.text-muted { color: var(--text-muted); }
.text-success { color: var(--accent-success); }
.text-warning { color: var(--accent-warning); }
.text-danger { color: var(--accent-danger); }

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success { background: var(--accent-success); color: white; }
.badge-warning { background: var(--accent-warning); color: black; }
.badge-danger { background: var(--accent-danger); color: white; }
.badge-info { background: #3b82f6; color: white; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-muted);
}

.loading::after {
  content: '';
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   CONVERSATION VIEW
   ============================================ */

.conversation-container {
  max-width: 900px;
  margin: 0 auto;
}

.conversation-messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 65vh;
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.message {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  max-width: 90%;
}

/* Narration message - left side (AI) */
.message-narration {
  align-self: flex-start;
  background: var(--bg-card);
  border-left: 4px solid var(--accent-primary);
}

.message-narration .message-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
}

.message-type-badge {
  background: var(--accent-primary);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.message-age {
  color: var(--text-muted);
}

.message-content {
  line-height: 1.6;
  white-space: pre-wrap;
}

.choices-in-narration {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.choice-option {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
  align-items: flex-start;
}

.choice-option .choice-letter {
  font-weight: bold;
  color: var(--accent-primary);
  min-width: 1.5rem;
}

.choice-option .choice-text {
  flex: 1;
}

.choice-option .choice-difficulty {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

/* Choice message - right side (Player) */
.message-choice {
  align-self: flex-end;
  background: var(--accent-primary);
  color: white;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.choice-badge {
  background: rgba(255, 255, 255, 0.2);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
}

.choice-content {
  flex: 1;
}

/* Dice message - centered */
.message-dice {
  align-self: center;
  background: var(--bg-input);
  text-align: center;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border: 2px solid transparent;
}

.message-dice.dice-success {
  border-color: var(--accent-success);
  background: rgba(16, 185, 129, 0.1);
}

.message-dice.dice-failure {
  border-color: var(--accent-danger);
  background: rgba(239, 68, 68, 0.1);
}

.dice-icon {
  font-size: 2rem;
}

.dice-info {
  text-align: left;
}

.dice-stat {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-bottom: 0.25rem;
}

.dice-roll {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.dice-result {
  font-weight: 600;
  font-size: 0.9rem;
}

.dice-result.success {
  color: var(--accent-success);
}

.dice-result.failure {
  color: var(--accent-danger);
}

/* System message - centered, muted */
.message-system {
  align-self: center;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.875rem;
  background: transparent;
  padding: 0.5rem;
}

/* Current choices section */
.current-choices {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.current-choices h4 {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.choices-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.choice-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent-primary);
}

.choice-card .choice-letter {
  background: var(--accent-primary);
  color: white;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.choice-card .choice-text {
  flex: 1;
}

.choice-card .choice-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.no-data {
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .content {
    margin-left: 0;
    padding: 1rem;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================
   PNJ SECTION - GROUPED BY CATEGORY
   ============================================ */

.pnj-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.pnj-section-header h3 {
  margin: 0;
  color: var(--accent-primary);
}

.pnj-stats-summary {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.pnj-categories {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pnj-category {
  background: var(--bg-input);
  border-radius: var(--radius);
  overflow: hidden;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.2s;
}

.category-header:hover {
  background: var(--border-color);
}

.category-count {
  background: var(--accent-primary);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 500;
}

.pnj-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
}

/* PNJ Card */
.pnj-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.pnj-card:hover {
  background: var(--bg-secondary);
  border-left-color: var(--accent-primary);
}

/* PNJ Archived - Grayed out */
.pnj-card.pnj-archived {
  opacity: 0.5;
  background: var(--bg-input);
}

.pnj-card.pnj-archived:hover {
  opacity: 0.7;
}

.pnj-card.pnj-archived .pnj-name::after {
  content: " (archivé)";
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
}

.pnj-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.pnj-info {
  flex: 1;
  min-width: 0;
}

.pnj-name {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pnj-role {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pnj-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.pnj-level {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.pnj-level.level-major {
  background: var(--accent-danger);
  color: white;
}

.pnj-level.level-active {
  background: var(--accent-warning);
  color: black;
}

.pnj-level.level-minor {
  background: var(--text-muted);
  color: white;
}

.pnj-grade {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  background: var(--bg-input);
  border-radius: 4px;
}

/* ============================================
   PNJ DETAIL MODAL
   ============================================ */

.pnj-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  padding: 2rem;
}

.pnj-modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.pnj-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.pnj-header-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pnj-avatar-large {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.5rem;
}

.pnj-header-text h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
}

.pnj-header-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pnj-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
}

.pnj-modal-close:hover {
  color: var(--text-primary);
}

.pnj-modal-body {
  padding: 1.5rem;
}

.pnj-detail-section {
  margin-bottom: 1.5rem;
}

.pnj-detail-section h4 {
  margin: 0 0 0.75rem 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pnj-detail-section p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-primary);
}

.pnj-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
}

.pnj-stat-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem;
  background: var(--bg-input);
  border-radius: 4px;
}

.pnj-stat-item .name {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.pnj-stat-item .value {
  color: var(--accent-primary);
  font-weight: 600;
}

.pnj-techniques-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pnj-technique {
  padding: 0.3rem 0.6rem;
  background: var(--bg-input);
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--text-primary);
}

/* ============================================
   PNJ VERSIONS ACCORDION
   ============================================ */

.pnj-versions-section {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.pnj-versions-section h4 {
  margin: 0 0 1rem 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-transform: uppercase;
}

.version-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.version-item {
  background: var(--bg-input);
  border-radius: var(--radius);
  overflow: hidden;
}

.version-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}

.version-header:hover {
  background: var(--bg-secondary);
}

.version-header .version-number {
  font-weight: 600;
}

.version-header .version-date {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.version-header .version-toggle {
  color: var(--text-muted);
  transition: transform 0.2s;
}

.version-item.expanded .version-toggle {
  transform: rotate(180deg);
}

.version-content {
  padding: 0 1rem 1rem 1rem;
  display: none;
}

.version-item.expanded .version-content {
  display: block;
}

.version-content p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.version-content .version-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  display: block;
}

/* Current version indicator */
.version-item.version-current {
  border-left: 3px solid var(--accent-success);
}

.version-item.version-current .version-header::after {
  content: "actuel";
  margin-left: 0.5rem;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  background: var(--accent-success);
  color: white;
  border-radius: 4px;
  font-weight: 500;
}

/* ============================================
   LOGS PAGE - TEMPS RÉEL
   ============================================ */

.logs-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-select,
.filter-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.filter-input {
  width: 200px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
}

.logs-status-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  margin-top: 1rem;
  font-size: 0.875rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.status-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.connected::before {
  background: var(--accent-success);
  box-shadow: 0 0 8px var(--accent-success);
}

.status-indicator.disconnected::before {
  background: var(--accent-danger);
}

.status-indicator.connected {
  color: var(--accent-success);
}

.status-indicator.disconnected {
  color: var(--accent-danger);
}

.logs-container {
  background: var(--bg-card);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.logs-output {
  background: #0d1117;
  padding: 1rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.8rem;
  height: 65vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.logs-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* Log entry styling */
.log-line {
  display: flex;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  line-height: 1.4;
  align-items: flex-start;
}

.log-line:hover {
  background: rgba(255, 255, 255, 0.03);
}

.log-timestamp {
  color: #6e7681;
  flex-shrink: 0;
  font-size: 0.75rem;
  min-width: 85px;
}

.log-level {
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
  min-width: 50px;
  text-align: center;
}

/* Log level colors */
.log-level.error {
  background: var(--accent-danger);
  color: white;
}

.log-level.warn {
  background: var(--accent-warning);
  color: black;
}

.log-level.info {
  background: var(--accent-success);
  color: white;
}

.log-level.http {
  background: #3b82f6;
  color: white;
}

.log-level.debug {
  background: #6b7280;
  color: white;
}

.log-message {
  flex: 1;
  word-break: break-word;
  color: #c9d1d9;
}

/* Message colors by level */
.log-line.level-error .log-message {
  color: #f85149;
}

.log-line.level-warn .log-message {
  color: #d29922;
}

.log-line.level-info .log-message {
  color: #c9d1d9;
}

.log-line.level-debug .log-message {
  color: #8b949e;
}

.log-context {
  color: #8b949e;
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.log-meta {
  color: #6e7681;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   SYSTEM LOGS IN SAVE DETAIL
   ============================================ */

.system-logs-section {
  margin-top: 1.5rem;
}

.system-logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.system-logs-container {
  background: #0d1117;
  border-radius: var(--radius);
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.8rem;
}

.system-logs-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}
