/* ─────────────────────────────────────────────────────────────────────────────
   Authelia — Thème REDNECKERIE OS
   Fond noir, accent rouge #e8291a, typo mono, style terminal hacker
   ───────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Share+Tech+Mono&display=swap');

/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --hl-bg:         #000000;
  --hl-surface:    #03030a;
  --hl-surface2:   #07070f;
  --hl-border:     rgba(232, 41, 26, 0.3);
  --hl-red:        #e8291a;
  --hl-red2:       #ff3d2a;
  --hl-red-glow:   rgba(232, 41, 26, 0.5);
  --hl-red-soft:   rgba(232, 41, 26, 0.12);
  --hl-text:       #f2efec;
  --hl-dim:        #4a4858;
  --hl-dim2:       #2e2c38;
}

/* ── Reset / fond global ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden !important;
}

body,
#root,
[class*="MuiCssBaseline"] {
  background: var(--hl-bg) !important;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif !important;
  color: var(--hl-text) !important;
  height: 100% !important;
}

/* Le Box racine d'Authelia : centrage vertical parfait */
#root > [class*="MuiBox"],
[class*="MuiBox-root"]:not(#hl-brand *) {
  min-height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Scan-line overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.04) 2px,
    rgba(0, 0, 0, 0.04) 4px
  );
}

/* Vignette rouge + radial atmosphère */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse 80% 50% at 50%  -5%,  rgba(232,41,26,0.10) 0%, transparent 65%),
    radial-gradient(ellipse 50% 60% at 0%   100%, rgba(232,41,26,0.04) 0%, transparent 55%),
    radial-gradient(ellipse 50% 60% at 100%  50%, rgba(232,41,26,0.04) 0%, transparent 55%);
}

/* ── Particle canvas sits behind everything ─────────────────────────────────── */
#hl-particles {
  position: fixed !important;
  inset: 0 !important;
  z-index: 0 !important;
  pointer-events: none !important;
  opacity: .45 !important;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
/* Outer grid containers stay transparent */
[class*="MuiGrid2-container"],
[class*="MuiBox-root"] {
  background: transparent !important;
}

/* The inner form grid gets padding */
[class*="MuiContainer-maxWidthXs"] > [class*="MuiGrid2-container"],
[class*="MuiContainer-maxWidthSm"] > [class*="MuiGrid2-container"] {
  padding: 24px 24px 20px !important;
}

/* ── AppBar — complètement caché, on ne veut pas de header Authelia ────────── */
[class*="MuiAppBar"],
[class*="MuiToolbar"] {
  display: none !important;
}

/* ── Login card — Authelia 4.38 uses MuiContainer-maxWidthXs ─────────────────── */
[class*="MuiContainer-maxWidthXs"],
[class*="MuiContainer-maxWidthSm"] {
  position: relative !important;
  background: rgba(3, 3, 10, 0.92) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(232, 41, 26, 0.25) !important;
  border-radius: 6px !important;
  box-shadow:
    0 0 0 1px rgba(232, 41, 26, 0.08),
    0 0 60px rgba(232, 41, 26, 0.12),
    0 0 140px rgba(232, 41, 26, 0.06),
    0 24px 80px rgba(0, 0, 0, 0.98) !important;
  overflow: visible !important;
  z-index: 2;
  padding: 0 !important;
}

/* Also style any elevation paper cards inside (totp, etc.) */
[class*="MuiCard"],
[class*="MuiPaper-elevation"] {
  background: rgba(5, 5, 14, 0.95) !important;
  border: 1px solid rgba(232, 41, 26, 0.2) !important;
  border-radius: 4px !important;
}

/* ── Brand header block ──────────────────────────────────────────────────────── */
#hl-brand {
  padding: 28px 24px 18px;
  border-bottom: 1px solid rgba(232, 41, 26, 0.18);
  text-align: center;
  position: relative;
  border-radius: 6px 6px 0 0;
}

.hl-logo-icon {
  display: block;
  margin: 0 auto 12px;
  filter: drop-shadow(0 0 12px rgba(232,41,26,0.7)) drop-shadow(0 0 28px rgba(232,41,26,0.35));
  animation: hl-pulse 3.5s ease-in-out infinite;
  line-height: 0;
}

@keyframes hl-pulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(232,41,26,0.7)) drop-shadow(0 0 25px rgba(232,41,26,0.3)); }
  50%       { filter: drop-shadow(0 0 18px rgba(232,41,26,0.9)) drop-shadow(0 0 45px rgba(232,41,26,0.55)); }
}

.hl-logo-title {
  font-family: 'Share Tech Mono', monospace !important;
  font-size: 22px;
  letter-spacing: 5px;
  color: var(--hl-text);
  text-transform: uppercase;
  margin: 4px 0 2px;
  position: relative;
  display: block;
  text-align: center;
}

/* Glitch on title */
.hl-glitch {
  position: relative;
  display: inline-block;
}
.hl-logo-title {
  position: relative;
}
.hl-glitch::before,
.hl-glitch::after,
.hl-logo-title::before,
.hl-logo-title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  color: var(--hl-red);
  text-shadow: none;
  overflow: hidden;
  pointer-events: none;
}
.hl-glitch::before,
.hl-logo-title::before {
  animation: hl-glitch-1 4.5s infinite steps(1);
  clip-path: polygon(0 20%, 100% 20%, 100% 35%, 0 35%);
  left: 1px;
}
.hl-glitch::after,
.hl-logo-title::after {
  animation: hl-glitch-2 4.5s infinite steps(1);
  clip-path: polygon(0 65%, 100% 65%, 100% 75%, 0 75%);
  left: -1px;
  color: #00d4ff;
}

@keyframes hl-glitch-1 {
  0%,89%,95%,100% { transform: translateX(0);   opacity: 0; }
  90%             { transform: translateX(-3px); opacity: .8; }
  92%             { transform: translateX(2px);  opacity: .5; }
  94%             { transform: translateX(0);    opacity: 0; }
}
@keyframes hl-glitch-2 {
  0%,86%,93%,100% { transform: translateX(0);  opacity: 0; }
  87%             { transform: translateX(3px); opacity: .7; }
  90%             { transform: translateX(-2px);opacity: .4; }
  92%             { transform: translateX(0);   opacity: 0; }
}

.hl-logo-sub {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 4px;
  color: var(--hl-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Status bar */
.hl-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--hl-dim);
  text-transform: uppercase;
}

.hl-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hl-red);
  box-shadow: 0 0 6px var(--hl-red);
  animation: hl-blink 1.8s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes hl-blink {
  0%,100% { opacity: 1; box-shadow: 0 0 6px var(--hl-red); }
  50%     { opacity: .3; box-shadow: 0 0 2px var(--hl-red); }
}

.hl-sep { color: var(--hl-dim2); }

/* Horizontal rule */
.hl-hline {
  height: 1px;
  margin-top: 14px;
  background: linear-gradient(90deg, transparent, rgba(232,41,26,0.5) 40%, rgba(232,41,26,0.5) 60%, transparent);
}

/* ── Corner brackets ─────────────────────────────────────────────────────────── */
.hl-corners { pointer-events: none; }

.hl-c {
  position: absolute;
  width: 14px;
  height: 14px;
  display: block;
}
.hl-c.tl { top: -1px;  left: -1px;  border-top: 2px solid var(--hl-red); border-left: 2px solid var(--hl-red); }
.hl-c.tr { top: -1px;  right: -1px; border-top: 2px solid var(--hl-red); border-right: 2px solid var(--hl-red); }
.hl-c.bl { bottom: -1px; left: -1px;  border-bottom: 2px solid var(--hl-red); border-left: 2px solid var(--hl-red); }
.hl-c.br { bottom: -1px; right: -1px; border-bottom: 2px solid var(--hl-red); border-right: 2px solid var(--hl-red); }

/* ── Titres MUI ─────────────────────────────────────────────────────────────── */
[class*="MuiTypography-h5"],
[class*="MuiTypography-h4"],
[class*="MuiTypography-h6"] {
  font-family: 'Share Tech Mono', monospace !important;
  letter-spacing: 3px !important;
  text-transform: uppercase !important;
  color: var(--hl-text) !important;
  text-shadow: 0 0 20px rgba(232, 41, 26, 0.35) !important;
}

[class*="MuiTypography-subtitle"],
[class*="MuiTypography-body2"] {
  font-family: 'Share Tech Mono', monospace !important;
  font-size: 10px !important;
  letter-spacing: 2px !important;
  text-transform: uppercase !important;
  color: var(--hl-dim) !important;
}

[class*="MuiTypography-body1"],
[class*="MuiTypography-root"] {
  color: var(--hl-text) !important;
  font-family: 'Inter', system-ui, sans-serif !important;
}

/* ── Form labels ─────────────────────────────────────────────────────────────── */
[class*="MuiFormLabel"],
[class*="MuiInputLabel"],
label {
  font-family: 'Share Tech Mono', monospace !important;
  font-size: 11px !important;
  letter-spacing: 2px !important;
  text-transform: uppercase !important;
  color: var(--hl-dim) !important;
}
[class*="MuiInputLabel-shrink"],
[class*="MuiFormLabel-root"][class*="Mui-focused"] {
  color: var(--hl-red) !important;
}

/* ── Inputs ──────────────────────────────────────────────────────────────────── */
[class*="MuiOutlinedInput-root"] {
  background: rgba(7, 7, 15, 0.8) !important;
  border-radius: 4px !important;
}
[class*="MuiOutlinedInput-root"] [class*="MuiOutlinedInput-notchedOutline"] {
  border-color: rgba(232, 41, 26, 0.2) !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}
[class*="MuiOutlinedInput-root"]:hover [class*="MuiOutlinedInput-notchedOutline"] {
  border-color: rgba(232, 41, 26, 0.45) !important;
}
[class*="MuiOutlinedInput-root"][class*="Mui-focused"] [class*="MuiOutlinedInput-notchedOutline"] {
  border-color: var(--hl-red) !important;
  box-shadow: 0 0 14px rgba(232, 41, 26, 0.25) inset !important;
}

[class*="MuiInputBase-input"] {
  font-family: 'Share Tech Mono', monospace !important;
  letter-spacing: 2px !important;
  color: var(--hl-text) !important;
  caret-color: var(--hl-red) !important;
}
[class*="MuiInputBase-input"]:autofill,
[class*="MuiInputBase-input"]:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px var(--hl-surface2) inset !important;
  -webkit-text-fill-color: var(--hl-text) !important;
}

[class*="MuiInputAdornment"] svg,
[class*="MuiIconButton-root"] {
  color: var(--hl-dim) !important;
}
[class*="MuiIconButton-root"]:hover {
  color: var(--hl-red) !important;
  background: var(--hl-red-soft) !important;
}

/* ── Button ──────────────────────────────────────────────────────────────────── */
[class*="MuiButton-containedPrimary"],
[class*="MuiButton-contained"] {
  background: linear-gradient(135deg, #c72213, var(--hl-red), var(--hl-red2)) !important;
  border: none !important;
  border-radius: 4px !important;
  font-family: 'Share Tech Mono', monospace !important;
  font-size: 12px !important;
  letter-spacing: 4px !important;
  text-transform: uppercase !important;
  color: #ffffff !important;
  box-shadow: 0 0 24px rgba(232,41,26,0.45), 0 4px 16px rgba(0,0,0,0.6) !important;
  transition: all 0.2s !important;
  position: relative !important;
  overflow: hidden !important;
}
[class*="MuiButton-containedPrimary"]::after,
[class*="MuiButton-contained"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 60%);
  pointer-events: none;
}
[class*="MuiButton-containedPrimary"]:hover,
[class*="MuiButton-contained"]:hover {
  box-shadow: 0 0 40px rgba(232,41,26,0.75), 0 6px 20px rgba(0,0,0,0.7) !important;
  transform: translateY(-1px) !important;
}
[class*="MuiButton-containedPrimary"]:active,
[class*="MuiButton-contained"]:active {
  transform: translateY(0) !important;
}

/* ── Checkbox ─────────────────────────────────────────────────────────────────  */
[class*="MuiCheckbox-root"] {
  color: var(--hl-dim) !important;
}
[class*="MuiCheckbox-root"][class*="Mui-checked"] {
  color: var(--hl-red) !important;
}

/* ── Links ───────────────────────────────────────────────────────────────────── */
a, [class*="MuiLink-root"] {
  color: var(--hl-red2) !important;
  text-decoration: none !important;
  transition: color 0.15s;
}
a:hover, [class*="MuiLink-root"]:hover {
  color: var(--hl-text) !important;
}

/* ── Alerts ──────────────────────────────────────────────────────────────────── */
[class*="MuiAlert-root"] {
  background: rgba(7, 7, 15, 0.9) !important;
  border: 1px solid var(--hl-border) !important;
  color: var(--hl-text) !important;
  font-family: 'Share Tech Mono', monospace !important;
  font-size: 11px !important;
  letter-spacing: 1px;
}
[class*="MuiAlert-standardError"]  { border-color: rgba(255, 70, 70, 0.45) !important; }
[class*="MuiAlert-standardSuccess"]{ border-color: rgba(0, 210, 100, 0.35) !important; }
[class*="MuiAlert-icon"] svg { color: var(--hl-red) !important; }

/* ── Divider ──────────────────────────────────────────────────────────────────── */
[class*="MuiDivider-root"] {
  background: linear-gradient(90deg, transparent, rgba(232,41,26,0.4), transparent) !important;
  border: none !important;
  height: 1px !important;
}

/* ── Select / Menu ────────────────────────────────────────────────────────────── */
[class*="MuiMenu-paper"],
[class*="MuiPopover-paper"] {
  background: #07070f !important;
  border: 1px solid var(--hl-border) !important;
}
[class*="MuiMenuItem-root"] {
  color: var(--hl-text) !important;
  font-family: 'Share Tech Mono', monospace !important;
  font-size: 11px !important;
  letter-spacing: 1px;
}
[class*="MuiMenuItem-root"]:hover {
  background: var(--hl-red-soft) !important;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: var(--hl-bg); }
::-webkit-scrollbar-thumb { background: rgba(232,41,26,0.5); border-radius: 4px; }

/* ── Selection ────────────────────────────────────────────────────────────────── */
::selection { background: rgba(232,41,26,0.35); color: #fff; }
