/* ============================================================
   Legacy of Tsuna — Design System
   Palette: ombre profonde + orange chakra + écarlate sang
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Rajdhani:wght@300;400;600;700&display=swap');

:root {
  /* Couleurs principales */
  --obsidian:    #0a0a0f;
  --void:        #111118;
  --shadow:      #1a1a26;
  --dusk:        #252535;
  --mist:        #3a3a50;
  --ash:         #6a6a8a;
  --parchment:   #c8c0a8;
  --light:       #e8e4d8;

  /* Accents */
  --chakra:      #e8640a;      /* orange chakra — signature */
  --chakra-glow: #ff8c2a;
  --blood:       #8b1a1a;
  --crimson:     #c0392b;
  --gold:        #c9a227;
  --jade:        #2ecc71;
  --danger:      #e74c3c;

  /* Typography */
  --font-title:  'Cinzel', serif;
  --font-body:   'Rajdhani', sans-serif;

  /* Spacing */
  --radius:      4px;
  --radius-md:   8px;
  --transition:  0.25s ease;
}

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

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

body {
  background: var(--obsidian);
  color: var(--parchment);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--chakra); border-radius: 3px; }

/* ---- Typographie ---- */
h1, h2, h3 { font-family: var(--font-title); letter-spacing: 0.05em; color: var(--light); }
h1 { font-size: clamp(2rem, 5vw, 4rem); font-weight: 900; }
h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p  { font-size: 1rem; color: var(--parchment); }
a  { color: var(--chakra); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--chakra-glow); }

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.page { display: none; min-height: 100vh; }
.page.active { display: block; }

/* ---- Navbar ---- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(232,100,10,0.25);
  padding: 0.8rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--light);
  display: flex; align-items: center; gap: 0.6rem;
  letter-spacing: 0.08em;
}
.navbar-brand .chakra-dot {
  width: 10px; height: 10px;
  background: var(--chakra);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--chakra);
  animation: pulse 2s infinite;
}
.navbar-nav { display: flex; align-items: center; gap: 0.3rem; }
.nav-link {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ash);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute; bottom: 0; left: 50%; right: 50%;
  height: 2px; background: var(--chakra);
  transition: all var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--light); }
.nav-link:hover::after, .nav-link.active::after { left: 0; right: 0; }
.navbar-user { display: flex; align-items: center; gap: 0.8rem; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--chakra);
  object-fit: cover;
}
.user-name { font-weight: 600; font-size: 0.9rem; color: var(--light); }
.btn-logout {
  background: none; border: 1px solid var(--blood);
  color: var(--crimson); padding: 0.3rem 0.8rem;
  border-radius: var(--radius); font-family: var(--font-body);
  font-weight: 600; font-size: 0.8rem; cursor: pointer;
  transition: all var(--transition);
}
.btn-logout:hover { background: var(--blood); color: var(--light); }

/* ---- Boutons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-body); font-weight: 700;
  font-size: 0.95rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.75rem 1.8rem; border-radius: var(--radius);
  border: none; cursor: pointer;
  transition: all var(--transition); text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--chakra), var(--chakra-glow));
  color: var(--obsidian);
  box-shadow: 0 4px 20px rgba(232,100,10,0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(232,100,10,0.5);
  color: var(--obsidian);
}
.btn-outline {
  background: transparent;
  border: 2px solid var(--chakra);
  color: var(--chakra);
}
.btn-outline:hover { background: var(--chakra); color: var(--obsidian); }
.btn-danger { background: var(--blood); color: var(--light); }
.btn-danger:hover { background: var(--crimson); }
.btn-success { background: #1a5c2a; color: var(--jade); border: 1px solid var(--jade); }
.btn-success:hover { background: #2ecc71; color: var(--obsidian); }
.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; }

/* ---- Cards ---- */
.card {
  background: var(--shadow);
  border: 1px solid var(--mist);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: border-color var(--transition);
}
.card:hover { border-color: rgba(232,100,10,0.4); }
.card-header {
  display: flex; align-items: center; gap: 0.8rem;
  margin-bottom: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--mist);
}

/* ---- Formulaires ---- */
.form-group { margin-bottom: 1.2rem; }
.form-label {
  display: block; margin-bottom: 0.4rem;
  font-weight: 600; font-size: 0.85rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ash);
}
.form-control {
  width: 100%; padding: 0.7rem 1rem;
  background: var(--void); border: 1px solid var(--mist);
  border-radius: var(--radius); color: var(--light);
  font-family: var(--font-body); font-size: 1rem;
  transition: border-color var(--transition);
}
.form-control:focus {
  outline: none; border-color: var(--chakra);
  box-shadow: 0 0 0 3px rgba(232,100,10,0.15);
}
.form-control::placeholder { color: var(--ash); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-pending  { background: rgba(201,162,39,0.2); color: var(--gold); border: 1px solid var(--gold); }
.badge-approved { background: rgba(46,204,113,0.15); color: var(--jade); border: 1px solid var(--jade); }
.badge-rejected { background: rgba(192,57,43,0.2); color: var(--danger); border: 1px solid var(--danger); }
.badge-admin    { background: rgba(232,100,10,0.2); color: var(--chakra); border: 1px solid var(--chakra); }

.role-badge {
  display: inline-flex; align-items: center;
  padding: 0.15rem 0.55rem; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
  color: var(--role-color, var(--ash));
  background: color-mix(in srgb, var(--role-color, var(--ash)) 15%, transparent);
  border: 1px solid var(--role-color, var(--mist));
}

/* ---- Hero / Login page ---- */
.hero {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(139,26,26,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 30%, rgba(232,100,10,0.1) 0%, transparent 50%),
    linear-gradient(180deg, var(--obsidian) 0%, var(--void) 100%);
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23e8640a' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
}
.hero-content { position: relative; text-align: center; max-width: 700px; padding: 2rem; }
.hero-eyebrow {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--chakra);
  margin-bottom: 1rem;
}
.hero-title {
  font-family: var(--font-title); font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 900; color: var(--light); line-height: 0.9;
  margin-bottom: 0.5rem;
}
.hero-title .accent { color: var(--chakra); display: block; }
.hero-subtitle {
  font-size: 1.1rem; color: var(--ash); margin: 1.5rem 0 2.5rem;
  line-height: 1.7;
}
.hero-divider {
  width: 60px; height: 3px;
  background: linear-gradient(90deg, transparent, var(--chakra), transparent);
  margin: 1.5rem auto;
}

/* ---- Kunai decoratif ---- */
.kunai-decoration {
  position: absolute; opacity: 0.06;
  font-size: 8rem; pointer-events: none;
  filter: blur(1px);
}

/* ---- Section commune ---- */
.section-header { text-align: center; padding: 3rem 0 2rem; }
.section-header h2 { margin-bottom: 0.5rem; }
.section-header p { color: var(--ash); max-width: 500px; margin: 0 auto; }
.section-line {
  width: 50px; height: 3px;
  background: var(--chakra); margin: 1rem auto 0;
}

/* ---- Home page ---- */
.welcome-banner {
  background: linear-gradient(135deg, var(--shadow) 0%, rgba(26,26,38,0.8) 100%);
  border: 1px solid rgba(232,100,10,0.3);
  border-radius: var(--radius-md);
  padding: 2.5rem 3rem;
  margin: 2rem 0;
  position: relative; overflow: hidden;
}
.welcome-banner::before {
  content: '忍';
  position: absolute; right: 2rem; top: 50%; transform: translateY(-50%);
  font-size: 8rem; color: rgba(232,100,10,0.06);
  font-weight: 900; line-height: 1;
  pointer-events: none;
}
.welcome-banner h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.welcome-banner .username-highlight { color: var(--chakra); }
.welcome-banner p { color: var(--ash); margin-top: 0.5rem; }

.quick-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem; margin: 2rem 0;
}
.quick-card {
  background: var(--shadow);
  border: 1px solid var(--mist);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  cursor: pointer; text-align: center;
  transition: all var(--transition);
  text-decoration: none; color: inherit;
}
.quick-card:hover {
  border-color: var(--chakra);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(232,100,10,0.2);
}
.quick-card .qc-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.quick-card h3 { color: var(--light); margin-bottom: 0.3rem; }
.quick-card p { color: var(--ash); font-size: 0.9rem; }

/* ---- Lore page ---- */
.lore-grid { display: grid; grid-template-columns: 250px 1fr; gap: 2rem; padding: 2rem 0; }
.lore-sidebar { position: sticky; top: 80px; height: fit-content; }
.lore-nav-item {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.8rem 1rem; border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  color: var(--ash); font-weight: 600;
  border-left: 3px solid transparent;
}
.lore-nav-item:hover, .lore-nav-item.active {
  color: var(--light); background: var(--shadow);
  border-left-color: var(--chakra);
}
.lore-content-area { min-height: 400px; }
.lore-section { display: none; }
.lore-section.active { display: block; }
.lore-section .content {
  font-size: 1.05rem; line-height: 1.85; color: var(--parchment);
  white-space: pre-wrap;
}

/* ---- Chat community ---- */
.chat-layout {
  display: grid; grid-template-columns: 1fr 260px;
  gap: 1.5rem; padding: 1.5rem 0;
  height: calc(100vh - 120px);
}
.chat-main { display: flex; flex-direction: column; background: var(--shadow); border: 1px solid var(--mist); border-radius: var(--radius-md); overflow: hidden; }
.chat-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--mist); display: flex; align-items: center; gap: 0.8rem; }
.chat-online-dot { width: 8px; height: 8px; background: var(--jade); border-radius: 50%; box-shadow: 0 0 6px var(--jade); }
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex; flex-direction: column; gap: 0.8rem;
}
.chat-message { display: flex; gap: 0.8rem; align-items: flex-start; }
.chat-message .msg-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; border: 2px solid var(--mist); }
.chat-message .msg-body {}
.chat-message .msg-header { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.2rem; }
.chat-message .msg-username { font-weight: 700; color: var(--chakra); font-size: 0.9rem; }
.chat-message .msg-time { font-size: 0.75rem; color: var(--ash); }
.chat-message .msg-content { color: var(--parchment); font-size: 0.98rem; word-break: break-word; }
.chat-system { text-align: center; color: var(--ash); font-size: 0.8rem; font-style: italic; padding: 0.3rem 0; }
.chat-input-area { padding: 1rem 1.5rem; border-top: 1px solid var(--mist); display: flex; gap: 0.8rem; }
.chat-input-area input { flex: 1; }
.chat-sidebar { display: flex; flex-direction: column; gap: 1rem; }
.online-list { background: var(--shadow); border: 1px solid var(--mist); border-radius: var(--radius-md); padding: 1rem; }
.online-list h4 { font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ash); margin-bottom: 0.8rem; }
.online-member { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0; }
.online-member img { width: 28px; height: 28px; border-radius: 50%; }
.online-member span { font-size: 0.9rem; color: var(--parchment); }

/* ---- Whitelist ---- */
.whitelist-form { max-width: 700px; margin: 0 auto; padding: 2rem 0; }
.whitelist-status { max-width: 700px; margin: 0 auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ---- Admin panel ---- */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; padding: 2rem 0; }
.admin-sidebar { position: sticky; top: 80px; height: fit-content; }
.admin-nav-item {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.8rem 1rem; border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  color: var(--ash); font-weight: 600;
  border-left: 3px solid transparent; margin-bottom: 0.2rem;
}
.admin-nav-item:hover, .admin-nav-item.active { color: var(--light); background: var(--shadow); border-left-color: var(--chakra); }
.admin-content { }
.admin-section { display: none; }
.admin-section.active { display: block; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--shadow); border: 1px solid var(--mist); border-radius: var(--radius-md); padding: 1.5rem; text-align: center; }
.stat-card .stat-value { font-size: 2.5rem; font-weight: 900; font-family: var(--font-title); color: var(--chakra); }
.stat-card .stat-label { color: var(--ash); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.3rem; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; padding: 0.8rem 1rem; color: var(--ash); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 1px solid var(--mist); font-weight: 700; }
td { padding: 0.8rem 1rem; border-bottom: 1px solid rgba(58,58,80,0.5); color: var(--parchment); }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ---- Modal ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
  z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--shadow); border: 1px solid var(--mist);
  border-radius: var(--radius-md); padding: 2rem;
  max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-close { background: none; border: none; color: var(--ash); font-size: 1.5rem; cursor: pointer; transition: color var(--transition); }
.modal-close:hover { color: var(--light); }

/* ---- Notifications ---- */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--dusk); border: 1px solid var(--mist);
  border-radius: var(--radius-md); padding: 0.9rem 1.5rem;
  min-width: 250px; display: flex; align-items: center; gap: 0.7rem;
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 3s forwards;
}
.toast.success { border-color: var(--jade); }
.toast.error { border-color: var(--danger); }
.toast .toast-icon { font-size: 1.1rem; }

/* ---- Animations ---- */
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.7;transform:scale(1.2)} }
@keyframes slideIn { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }
@keyframes fadeOut { from{opacity:1} to{opacity:0;pointer-events:none} }
@keyframes shimmer { 0%{background-position:-200% 0} 100%{background-position:200% 0} }

.loading {
  background: linear-gradient(90deg, var(--shadow) 25%, var(--dusk) 50%, var(--shadow) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
  height: 1rem;
}

/* ---- Login error messages ---- */
.error-banner {
  background: rgba(139,26,26,0.2); border: 1px solid var(--blood);
  border-radius: var(--radius); padding: 0.8rem 1.2rem;
  margin-bottom: 1.5rem; color: #ff9999; font-size: 0.9rem;
  display: none;
}
.error-banner.visible { display: block; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .lore-grid { grid-template-columns: 1fr; }
  .lore-sidebar { position: static; }
  .chat-layout { grid-template-columns: 1fr; grid-template-rows: 1fr auto; height: auto; }
  .chat-sidebar { display: none; }
  .admin-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .navbar { flex-wrap: wrap; gap: 0.5rem; }
  .navbar-nav { flex-wrap: wrap; }
}
