/* ============================================
   style.css — RPManager — Styles globaux
   Direction « Grimoire » : encre violette, or ciselé
   ============================================ */

@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/cinzel-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/alegreya-sans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/alegreya-sans-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Alegreya Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/alegreya-sans-700.woff2') format('woff2');
}

:root {
  --bg: #0d0c15;
  --surface: #151322;
  --card: #1d1a2e;
  --card-hover: #262239;
  --border: #2e2947;
  --accent: #8f79e0;
  --accent-light: #b3a3ec;
  --gold: #d9b45b;
  --gold-light: #f0ce7e;
  --text: #edeaf4;
  --text-muted: #9a92b5;
  --danger: #e0654e;
  --success: #63bd8c;
  --warning: #e0a458;
  --info: #7fa8e0;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 6px 28px rgba(0,0,0,0.45);
  --shadow-lg: 0 14px 44px rgba(0,0,0,0.65);
  --transition: 0.2s ease;
  --font-display: 'Cinzel', 'Georgia', serif;
  --font-body: 'Alegreya Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
}

::selection { background: rgba(217, 180, 91, 0.28); }

input[type="range"],
input[type="checkbox"],
input[type="radio"],
progress {
  accent-color: var(--gold);
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Typography ─────────────────────────────── */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

/* ─── Layout ─────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--accent-light), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Monogramme de marque (rail du dashboard, éditeurs, pages d'auth) */
.brand-mono {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--bg);
  background: linear-gradient(150deg, var(--gold-light), #8a6d2b);
  box-shadow: 0 2px 12px rgba(217, 180, 91, 0.35);
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--accent-light), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.main-content {
  padding: 40px 0;
}

/* ─── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #17102e;
  box-shadow: 0 2px 12px rgba(143, 121, 224, 0.35);
}
.btn-primary:hover { box-shadow: 0 4px 20px rgba(143, 121, 224, 0.55); }

.btn-gold {
  background: linear-gradient(160deg, var(--gold-light), var(--gold));
  color: #2a2108;
  box-shadow: 0 2px 12px rgba(217, 180, 91, 0.3);
}
.btn-gold:hover { box-shadow: 0 4px 20px rgba(217, 180, 91, 0.5); }

.btn-success {
  background: linear-gradient(135deg, #3e8e63, var(--success));
  color: #0d1f16;
}

.btn-danger {
  background: linear-gradient(135deg, #b14a38, var(--danger));
  color: #fff;
}

.btn-secondary {
  background: var(--card);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--text); border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); background: var(--card); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ─── Cards ──────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

/* ─── Roleplay Grid ──────────────────────────── */
.roleplay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.roleplay-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.roleplay-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.roleplay-card-accent {
  height: 4px;
}

.roleplay-card-body {
  padding: 24px;
  flex: 1;
}

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

.roleplay-card-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  color: var(--text);
}

.roleplay-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.roleplay-card-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.roleplay-card-actions {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.roleplay-card-actions .btn { flex: 1; justify-content: center; }

/* ─── Section Header ─────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Forms ──────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

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

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  padding: 10px 14px;
  transition: border-color var(--transition);
  font-family: inherit;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(143, 121, 224, 0.15);
}

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

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

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ─── Tabs ───────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--gold-light); border-bottom-color: var(--gold); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.screen { display: none; }
.screen.active { display: block; }

/* ─── Modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(-20px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 10;
}

.modal-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; letter-spacing: 0.02em; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition);
}
.modal-close:hover { color: var(--text); background: var(--surface); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ─── Alerts & Toasts ────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  pointer-events: all;
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  max-width: 320px;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(100%); }
}

/* ─── Empty State ────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 4rem; margin-bottom: 16px; }
.empty-state-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; letter-spacing: 0.02em; color: var(--text); margin-bottom: 8px; }
.empty-state-desc { margin-bottom: 24px; }

/* ─── Badge ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-accent { background: rgba(143, 121, 224, 0.18); color: var(--accent-light); }
.badge-gold { background: rgba(217, 180, 91, 0.18); color: var(--gold-light); }
.badge-success { background: rgba(99, 189, 140, 0.18); color: #8fd4ae; }
.badge-danger { background: rgba(224, 101, 78, 0.18); color: #f0a08f; }

.mp-badge { margin-right: 8px; vertical-align: middle; }

/* ─── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── Utils ──────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-center { text-align: center; }
.w-full { width: 100%; }

/* ─── Skill Item ─────────────────────────────── */
.skill-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}

.skill-item-inputs { flex: 1; display: flex; flex-direction: column; gap: 8px; }

.skill-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: all var(--transition);
  flex-shrink: 0;
}
.skill-remove:hover { color: var(--danger); background: rgba(224, 101, 78, 0.1); }

/* ─── Stats Grid ─────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-input-group { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.stat-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  padding: 8px;
  text-align: center;
  width: 100%;
  transition: border-color var(--transition);
}
.stat-input:focus { outline: none; border-color: var(--accent); }

.stat-input-row { display: flex; align-items: center; gap: 6px; }
.stat-input-row .stat-input { flex: 1; min-width: 0; }
.stat-modifier-input {
  width: 52px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--gold-light);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 4px;
  text-align: center;
  transition: border-color var(--transition);
}
.stat-modifier-input:focus { outline: none; border-color: var(--accent); }

/* ─── Character List (editor) ────────────────── */
.character-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.character-item:hover { border-color: var(--accent); }
.character-item-icon { font-size: 1.8rem; width: 40px; text-align: center; }
.character-item-info { flex: 1; }
.character-item-name { font-weight: 700; font-size: 0.95rem; }
.character-item-title { font-size: 0.8rem; color: var(--text-muted); }
.character-item-actions { display: flex; gap: 8px; }

/* ─── Step List (editor) ─────────────────────── */
.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step-item .form-input { margin: 0; }
.step-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  transition: color var(--transition);
}
.step-remove:hover { color: var(--danger); }

/* ─── Color swatch ───────────────────────────── */
.color-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-input-group input[type="color"] {
  width: 48px;
  height: 38px;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.color-preview {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .roleplay-grid { grid-template-columns: 1fr; }
}
