/* ===================================================================
   Base — reset, typographie, shell header, boutons.
   Conforme au design system The Black Room.
   =================================================================== */

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: var(--leading-loose);
  color: var(--text-primary);

  /* Grille de fond TBR — overlay 50×50 */
  background-color: var(--bg-color);
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 50px 50px;
  background-position: -1px -1px;

  padding: 0;
  overflow-x: hidden;
}

/* Headings : Funnel Display, UPPERCASE par défaut */
h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

h1 { font-size: var(--fs-h1); letter-spacing: 2px; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p {
  margin: 0;
  color: var(--text-primary);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}

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

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

strong {
  font-weight: 700;
  color: var(--text-primary);
}

em {
  font-style: normal;
  color: var(--primary-color);
}

::selection {
  background: var(--primary-color);
  color: var(--text-primary);
}

/* ===================================================================
   Shell header — sticky, fond noir avec bordure néon en bas
   =================================================================== */

.shell-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-2xl);
  min-height: var(--shell-header-h);
  padding: var(--space-md) var(--space-lg);
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.shell-header::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--primary-color) 40%,
    var(--primary-color) 60%,
    transparent 100%
  );
  opacity: 0.5;
}

/* ── Brand : logo TBR + texte ── */

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.brand__logo {
  width: 44px;
  height: 44px;
  max-width: 44px;
  max-height: 44px;
  min-width: 44px;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand__product {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
}

.brand__byline {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-top: 4px;
}

.brand__byline em {
  color: var(--primary-color);
  font-style: normal;
  font-weight: 600;
}

/* ── Navigation principale ── */

.shell-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
}

.shell-nav__link {
  position: relative;
  padding: 12px 20px;
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all var(--duration-fast) ease;
}

.shell-nav__link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.shell-nav__link.is-active {
  color: var(--primary-color);
  background: rgba(245, 0, 0, 0.08);
  border-bottom-color: var(--primary-color);
}

/* ── Bloc utilisateur ── */

.shell-user {
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
}

.shell-user__role {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.shell-user__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--header-bg);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ===================================================================
   Buttons — primaire rouge avec glow, secondaire ghost
   =================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  height: 44px;
  padding: 0 24px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: var(--fs-base);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--duration-normal) ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-strong);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  box-shadow: var(--glow-primary);
}

.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--glow-primary-strong);
}

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

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-strong);
}

.btn--danger {
  background: var(--danger-color);
  color: #fff;
  border-color: var(--danger-color);
  box-shadow: var(--glow-primary);
}

.btn--sm {
  height: 36px;
  padding: 0 16px;
  font-size: var(--fs-xs);
}

.btn--icon {
  width: 44px;
  padding: 0;
}

/* ===================================================================
   Utilities
   =================================================================== */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--border-strong);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success-color);
  box-shadow: 0 0 0 4px rgba(0, 255, 0, 0.15);
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(0, 255, 0, 0.15); }
  50%      { box-shadow: 0 0 0 7px rgba(0, 255, 0, 0.05); }
}

.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-pad-x);
}

/* ===================================================================
   Animations TBR
   =================================================================== */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===================================================================
   Toast (en bas à droite)
   =================================================================== */

.toast-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: 100;
  pointer-events: none;
}

.toast {
  padding: 14px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--duration-normal) ease,
              transform var(--duration-normal) ease;
  max-width: 380px;
  pointer-events: auto;
  border-left: 3px solid var(--primary-color);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===================================================================
   Responsive
   =================================================================== */

@media (max-width: 880px) {
  .shell-header {
    grid-template-columns: auto auto;
    grid-template-rows: auto auto;
    gap: var(--space-md);
  }
  .shell-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    overflow-x: auto;
    border-left: none;
    border-right: none;
  }
  h1 { font-size: 2.5rem; }
}
