/* ============================================================
   REPUBLIC TERMINAL ARCHIVE — Design System CSS
   Terminal militaire républicain Star Wars
   ============================================================ */

/* ──────────────────────────────────────────────────────────
   GOOGLE FONTS
   ────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Rajdhani:wght@400;500;600;700&family=Orbitron:wght@400;500;700;900&display=swap');

/* ──────────────────────────────────────────────────────────
   VARIABLES — DESIGN TOKENS
   ────────────────────────────────────────────────────────── */
:root {
  /* Fonds */
  --bg-main:        #050b12;
  --bg-panel:       rgba(5, 24, 38, 0.88);
  --bg-panel-dark:  rgba(3, 12, 20, 0.95);
  --bg-panel-hover: rgba(8, 32, 50, 0.92);

  /* Couleurs cyan / bleu */
  --cyan:           #2aa8e0;
  --cyan-soft:      #38aeea;
  --cyan-dim:       rgba(42, 168, 224, 0.18);
  --cyan-line:      rgba(56, 174, 234, 0.22);
  --cyan-glow:      rgba(42, 168, 224, 0.35);

  /* Texte */
  --text-main:      #9ccce6;
  --text-muted:     #5f99b8;
  --text-dim:       #3d6a84;
  --text-bright:    #c8e8f8;

  /* Titres */
  --title-color:    #38aeea;

  /* Accents */
  --orange:         #f59b2e;
  --orange-dim:     rgba(245, 155, 46, 0.2);
  --red:            #e34b3f;
  --red-dim:        rgba(227, 75, 63, 0.2);
  --green:          #77c66e;
  --green-dim:      rgba(119, 198, 110, 0.2);
  --yellow:         #f5d020;

  /* Métal du cadre */
  --metal-dark:     #0b0d10;
  --metal-mid:      #15191d;
  --metal-light:    #22272c;
  --metal-edge:     #2e3540;

  /* Lignes */
  --line-soft:      rgba(56, 174, 234, 0.15);
  --line-hard:      rgba(56, 174, 234, 0.4);

  /* Effets */
  --glow-cyan:      0 0 8px rgba(42, 168, 224, 0.6),
                    0 0 20px rgba(42, 168, 224, 0.3);
  --glow-orange:    0 0 8px rgba(245, 155, 46, 0.6);
  --glow-red:       0 0 8px rgba(227, 75, 63, 0.6);

  /* Typographie */
  --font-mono:      'Share Tech Mono', 'Courier New', monospace;
  --font-title:     'Orbitron', 'Rajdhani', 'Arial Narrow', sans-serif;
  --font-ui:        'Rajdhani', 'Orbitron', 'Arial Narrow', sans-serif;

  /* Spacing */
  --gap-xs:   4px;
  --gap-sm:   8px;
  --gap-md:   16px;
  --gap-lg:   24px;
  --gap-xl:   40px;

  /* Borders */
  --border-panel:   1px solid var(--cyan-line);
  --border-active:  1px solid var(--cyan);

  /* Transitions */
  --transition:     all 0.2s ease;
}

/* ──────────────────────────────────────────────────────────
   RESET CSS MINIMAL
   ────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-main);
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(42, 168, 224, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(5, 40, 70, 0.15) 0%, transparent 60%);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--cyan-soft);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover { color: var(--text-bright); }

img { max-width: 100%; }
ul, ol { list-style: none; }

/* ──────────────────────────────────────────────────────────
   DATAPAD SHELL — Cadre physique principal
   ────────────────────────────────────────────────────────── */
.datapad-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 20px 10px;
  position: relative;
}

.datapad-shell {
  position: relative;
  width: min(1500px, 96vw);
  min-height: 86vh;
  background: linear-gradient(165deg, #0d1a22 0%, #050b12 40%, #060e16 100%);
  border: 3px solid var(--metal-edge);
  border-radius: 6px;

  /* Ombre externe */
  box-shadow:
    0 0 0 1px var(--metal-dark),
    0 0 40px rgba(0,0,0,0.8),
    0 0 80px rgba(0,0,0,0.5),
    inset 0 0 60px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.03);

  /* Coins biseautés CSS */
  clip-path: polygon(
    0 10px, 10px 0,
    calc(100% - 10px) 0, 100% 10px,
    100% calc(100% - 10px), calc(100% - 10px) 100%,
    10px 100%, 0 calc(100% - 10px)
  );
}

/* Grille fine en arrière-plan */
.datapad-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(42, 168, 224, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 168, 224, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* Scanlines */
.datapad-shell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* Bords latéraux métalliques */
.datapad-side-left,
.datapad-side-right {
  position: absolute;
  top: 60px;
  bottom: 60px;
  width: 18px;
  background: linear-gradient(90deg, var(--metal-dark), var(--metal-mid));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  z-index: 10;
}

.datapad-side-left {
  left: -21px;
  border-left: 2px solid var(--metal-dark);
  border-radius: 3px 0 0 3px;
}

.datapad-side-right {
  right: -21px;
  border-right: 2px solid var(--metal-dark);
  border-radius: 0 3px 3px 0;
}

/* Boutons physiques latéraux */
.physical-button {
  width: 10px;
  height: 26px;
  background: linear-gradient(180deg, var(--metal-light), var(--metal-dark));
  border: 1px solid var(--metal-edge);
  border-radius: 2px;
  cursor: pointer;
  transition: var(--transition);
}
.physical-button:hover {
  background: linear-gradient(180deg, var(--metal-edge), var(--metal-mid));
  box-shadow: var(--glow-cyan);
}
.physical-button.large {
  height: 40px;
  width: 12px;
}

/* Voyants lumineux */
.indicator-light {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 4px var(--orange), 0 0 8px rgba(245,155,46,0.4);
  animation: blink-indicator 2.4s ease-in-out infinite;
}
.indicator-light.cyan {
  background: var(--cyan);
  box-shadow: var(--glow-cyan);
  animation-delay: 0.8s;
}
.indicator-light.red {
  background: var(--red);
  box-shadow: var(--glow-red);
  animation: blink-indicator 0.8s ease-in-out infinite;
}
.indicator-light.green {
  background: var(--green);
  box-shadow: 0 0 4px var(--green);
  animation: none;
}
.indicator-light.off {
  background: var(--metal-mid);
  box-shadow: none;
  animation: none;
}

@keyframes blink-indicator {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* Points de fixation coins */
.datapad-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  z-index: 20;
}
.datapad-corner::before,
.datapad-corner::after {
  content: '';
  position: absolute;
  background: var(--metal-light);
  border-radius: 50%;
  width: 6px;
  height: 6px;
}
.datapad-corner.tl { top: 4px; left: 4px; }
.datapad-corner.tr { top: 4px; right: 4px; }
.datapad-corner.bl { bottom: 4px; left: 4px; }
.datapad-corner.br { bottom: 4px; right: 4px; }
.datapad-corner::before { top: 0; left: 0; }
.datapad-corner::after  { top: 4px; left: 4px; width: 3px; height: 3px; background: var(--metal-dark); }

/* ──────────────────────────────────────────────────────────
   DATAPAD SCREEN — Écran interne
   ────────────────────────────────────────────────────────── */
.datapad-screen {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 86vh;
}

/* ──────────────────────────────────────────────────────────
   TERMINAL HEADER — Bandeau supérieur
   ────────────────────────────────────────────────────────── */
.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: linear-gradient(90deg, rgba(0,0,0,0.6) 0%, rgba(5,24,38,0.4) 50%, rgba(0,0,0,0.6) 100%);
  border-bottom: 1px solid var(--cyan-line);
  position: relative;
  flex-shrink: 0;
}

.terminal-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
}

.terminal-logo {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.terminal-logo-main {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--cyan-soft);
  text-transform: uppercase;
}

.terminal-logo-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
}

.terminal-nav {
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
}

.terminal-nav-link {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: var(--transition);
}
.terminal-nav-link:hover,
.terminal-nav-link.active {
  color: var(--cyan-soft);
  border-color: var(--cyan-line);
  background: var(--cyan-dim);
}

.terminal-status-bar {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.terminal-id {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.signal-bar {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 12px;
}
.signal-bar span {
  width: 3px;
  background: var(--cyan);
  border-radius: 1px;
  opacity: 0.4;
}
.signal-bar span:nth-child(1) { height: 3px; opacity: 1; }
.signal-bar span:nth-child(2) { height: 5px; opacity: 0.8; }
.signal-bar span:nth-child(3) { height: 8px; opacity: 0.7; }
.signal-bar span:nth-child(4) { height: 11px; opacity: 0.5; }

/* ──────────────────────────────────────────────────────────
   MAIN CONTENT AREA
   ────────────────────────────────────────────────────────── */
.datapad-content {
  flex: 1;
  padding: var(--gap-lg) var(--gap-lg);
  position: relative;
}

/* ──────────────────────────────────────────────────────────
   PANELS
   ────────────────────────────────────────────────────────── */
.datapad-panel {
  background: var(--bg-panel);
  border: var(--border-panel);
  border-radius: 3px;
  position: relative;
  transition: var(--transition);
  overflow: hidden;

  /* Coin coupé en bas à droite */
  clip-path: polygon(
    0 0, 100% 0,
    100% calc(100% - 8px), calc(100% - 8px) 100%,
    0 100%
  );
}

.datapad-panel:hover {
  border-color: rgba(42, 168, 224, 0.35);
  background: var(--bg-panel-hover);
}

/* Ligne de balayage au hover */
.datapad-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 40%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan-glow), transparent);
  transition: left 0.4s ease;
  z-index: 1;
}
.datapad-panel:hover::before {
  left: 130%;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(0,0,0,0.2);
}

.panel-title {
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--title-color);
  text-transform: uppercase;
}

.panel-subtitle {
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-top: 1px;
}

.panel-body {
  padding: 12px 14px;
}

.panel-indicator {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 4px var(--green);
}

/* Séparateur interne */
.panel-separator {
  height: 1px;
  background: var(--line-soft);
  margin: 10px 0;
  position: relative;
}
.panel-separator::after {
  content: '◈';
  position: absolute;
  left: 50%;
  top: -5px;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 8px;
  background: var(--bg-panel-dark);
  padding: 0 4px;
}

/* ──────────────────────────────────────────────────────────
   GRIDS — Disposition en panneaux
   ────────────────────────────────────────────────────────── */
.datapad-grid {
  display: grid;
  gap: var(--gap-md);
}

.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-sidebar { grid-template-columns: 280px 1fr; }
.grid-sidebar-right { grid-template-columns: 1fr 260px; }
.grid-3col { grid-template-columns: 240px 1fr 220px; }

/* ──────────────────────────────────────────────────────────
   TYPOGRAPHY — Titres de page
   ────────────────────────────────────────────────────────── */
.terminal-title {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--title-color);
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(42, 168, 224, 0.5);
}

.terminal-subtitle {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  margin-top: 2px;
}

.section-title {
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--cyan-soft);
  text-transform: uppercase;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: var(--gap-md);
}

/* ──────────────────────────────────────────────────────────
   LABELS ET VALEURS
   ────────────────────────────────────────────────────────── */
.data-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid rgba(56, 174, 234, 0.06);
  gap: var(--gap-sm);
}
.data-row:last-child { border-bottom: none; }

.data-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.data-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-bright);
  text-align: right;
}

/* ──────────────────────────────────────────────────────────
   BADGES & PILLS
   ────────────────────────────────────────────────────────── */
.status-pill {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid currentColor;
}

.badge-green  { color: var(--green);  background: var(--green-dim); }
.badge-cyan   { color: var(--cyan);   background: var(--cyan-dim); }
.badge-orange { color: var(--orange); background: var(--orange-dim); }
.badge-red    { color: var(--red);    background: var(--red-dim); }
.badge-muted  { color: var(--text-muted); background: rgba(95,153,184,0.1); }

.access-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.15em;
  padding: 3px 10px;
  border-radius: 2px;
  border: 1px solid currentColor;
  text-transform: uppercase;
}

/* ──────────────────────────────────────────────────────────
   BUTTONS
   ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 7px 16px;
  border: 1px solid var(--cyan-line);
  border-radius: 2px;
  background: transparent;
  color: var(--cyan-soft);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  white-space: nowrap;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--cyan-dim);
  opacity: 0;
  transition: opacity 0.2s;
}

.btn:hover::before { opacity: 1; }
.btn:hover {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
  color: var(--text-bright);
}

.btn-primary {
  background: var(--cyan-dim);
  border-color: var(--cyan);
  color: var(--text-bright);
}
.btn-primary:hover {
  background: rgba(42, 168, 224, 0.25);
  box-shadow: var(--glow-cyan);
}

.btn-danger {
  border-color: rgba(227,75,63,0.4);
  color: var(--red);
}
.btn-danger:hover {
  border-color: var(--red);
  box-shadow: var(--glow-red);
  background: var(--red-dim);
}

.btn-warning {
  border-color: rgba(245,155,46,0.4);
  color: var(--orange);
}
.btn-warning:hover {
  border-color: var(--orange);
  box-shadow: var(--glow-orange);
  background: var(--orange-dim);
}

.btn-sm { padding: 4px 10px; font-size: 8px; }
.btn-lg { padding: 10px 22px; font-size: 12px; }

.btn-group {
  display: flex;
  gap: var(--gap-sm);
  flex-wrap: wrap;
}

/* ──────────────────────────────────────────────────────────
   FORMS — Champs de saisie terminal
   ────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--gap-md);
}

.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--cyan-line);
  border-radius: 2px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.form-control:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--cyan-dim), var(--glow-cyan);
  background: rgba(5, 24, 38, 0.6);
}
.form-control::placeholder { color: var(--text-dim); }

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%232aa8e0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
select.form-control option {
  background: #070f18;
  color: var(--text-main);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
  line-height: 1.8;
}

.form-help {
  font-size: 8px;
  color: var(--text-dim);
  margin-top: 3px;
  letter-spacing: 0.1em;
}

.form-error {
  font-size: 9px;
  color: var(--red);
  margin-top: 3px;
  letter-spacing: 0.1em;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-md);
}
.form-row.col3 { grid-template-columns: 1fr 1fr 1fr; }

/* ──────────────────────────────────────────────────────────
   TABLES — Tableaux tactiques
   ────────────────────────────────────────────────────────── */
.terminal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.terminal-table thead tr {
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid var(--cyan-line);
}

.terminal-table th {
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.terminal-table td {
  padding: 7px 10px;
  color: var(--text-main);
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  vertical-align: middle;
}

.terminal-table tbody tr {
  transition: background 0.15s;
}
.terminal-table tbody tr:hover {
  background: rgba(42, 168, 224, 0.04);
}
.terminal-table tbody tr:last-child td {
  border-bottom: none;
}

.terminal-table .col-id { color: var(--text-dim); font-size: 9px; }
.terminal-table .col-name { color: var(--text-bright); }
.terminal-table .col-date { color: var(--text-muted); font-size: 10px; }
.terminal-table .col-actions { white-space: nowrap; text-align: right; }

/* ──────────────────────────────────────────────────────────
   FLASH MESSAGES
   ────────────────────────────────────────────────────────── */
.flash-message {
  padding: 8px 14px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  margin-bottom: var(--gap-md);
  border-left: 3px solid;
}
.flash-success { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.flash-error   { background: var(--red-dim);   border-color: var(--red);   color: var(--red); }
.flash-warning { background: var(--orange-dim); border-color: var(--orange); color: var(--orange); }
.flash-info    { background: var(--cyan-dim);  border-color: var(--cyan);  color: var(--cyan); }

/* ──────────────────────────────────────────────────────────
   CLASSIFIED BLOCKS — Blocs chiffrés
   ────────────────────────────────────────────────────────── */
.classified-block {
  position: relative;
  border: 1px solid;
  border-radius: 3px;
  padding: 16px;
  margin: 16px 0;
  overflow: hidden;
}

/* État : Accès refusé */
.classified-block.denied {
  border-color: rgba(227, 75, 63, 0.5);
  background: rgba(227, 75, 63, 0.05);
}

.classified-block.denied::before {
  content: '⛔';
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 14px;
  opacity: 0.6;
}

.classified-block.denied .block-label {
  color: var(--red);
  border-color: rgba(227,75,63,0.3);
}

.classified-denied-noise {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(227, 75, 63, 0.35);
  line-height: 1.4;
  letter-spacing: 0.05em;
  margin: 8px 0;
  user-select: none;
  overflow: hidden;
  max-height: 60px;
}

.classified-denied-msg {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--red);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  margin-top: 8px;
  animation: flicker-denied 3s ease-in-out infinite;
}

@keyframes flicker-denied {
  0%, 90%, 100% { opacity: 1; }
  92%           { opacity: 0.4; }
  94%           { opacity: 1; }
  96%           { opacity: 0.2; }
  98%           { opacity: 1; }
}

/* État : Décryptage en cours */
.classified-block.decrypting {
  border-color: rgba(245, 155, 46, 0.5);
  background: rgba(245, 155, 46, 0.04);
}

.classified-block.decrypting .block-label {
  color: var(--orange);
}

.decrypt-progress {
  height: 2px;
  background: rgba(245,155,46,0.2);
  border-radius: 1px;
  margin: 10px 0;
  overflow: hidden;
}
.decrypt-progress-bar {
  height: 100%;
  background: var(--orange);
  width: 0%;
  box-shadow: 0 0 6px var(--orange);
  transition: width 0.05s linear;
}

.decrypt-text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--orange);
  letter-spacing: 0.15em;
  min-height: 60px;
  white-space: pre-wrap;
}

/* État : Accès accordé */
.classified-block.granted {
  border-color: rgba(42, 168, 224, 0.5);
  background: rgba(5, 24, 38, 0.7);
}

.classified-block.granted .block-label {
  color: var(--cyan-soft);
  border-color: var(--cyan-line);
}

.classified-block.granted .decrypt-text {
  color: var(--text-main);
  letter-spacing: normal;
  font-size: 11px;
}

.classified-content {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.8;
  white-space: pre-wrap;
}

/* Header commun des blocs */
.block-label {
  font-family: var(--font-title);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.block-level-badge {
  font-family: var(--font-mono);
  font-size: 7px;
  padding: 2px 6px;
  border: 1px solid currentColor;
  border-radius: 1px;
  opacity: 0.8;
}

/* ──────────────────────────────────────────────────────────
   MENTIONS DYNAMIQUES
   ────────────────────────────────────────────────────────── */
.mention-link {
  display: inline-block;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: inherit;
  border-bottom: 1px dashed rgba(42,168,224,0.4);
  padding: 0 2px;
  position: relative;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.mention-link:hover {
  color: var(--text-bright);
  border-color: var(--cyan);
  background: var(--cyan-dim);
}

.mention-unknown {
  color: var(--orange);
  border-color: rgba(245,155,46,0.4);
  cursor: help;
}

.mention-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  max-width: 280px;
  background: var(--bg-panel-dark);
  border: 1px solid var(--cyan-line);
  border-radius: 2px;
  padding: 8px 10px;
  font-size: 9px;
  color: var(--text-main);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: normal;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
.mention-link:hover .mention-tooltip { opacity: 1; }

/* ──────────────────────────────────────────────────────────
   DOCUMENT VIEWER — Lecture de document
   ────────────────────────────────────────────────────────── */
.document-viewer {
  max-width: 900px;
  margin: 0 auto;
}

.document-header {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--cyan-line);
  border-radius: 3px;
  padding: 20px 24px;
  margin-bottom: var(--gap-lg);
}

.doc-header-seal {
  text-align: center;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.doc-seal-title {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--cyan-soft);
  text-transform: uppercase;
  text-shadow: var(--glow-cyan);
}

.doc-seal-subtitle {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  margin-top: 4px;
}

.doc-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 16px;
}

.doc-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-meta-label {
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.doc-meta-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-bright);
}

.doc-checksum-line {
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-align: center;
}

.checksum {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.document-body {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.9;
  color: var(--text-main);
}

.document-body p {
  margin-bottom: 12px;
}

.document-body strong {
  color: var(--text-bright);
}

/* ──────────────────────────────────────────────────────────
   CHARACTER FILE — Fiche personnage
   ────────────────────────────────────────────────────────── */
.character-file {
  display: grid;
  grid-template-columns: 220px 1fr 200px;
  gap: var(--gap-md);
}

.char-portrait {
  width: 100%;
  aspect-ratio: 3/4;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--cyan-line);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.char-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-portrait-placeholder {
  font-size: 60px;
  opacity: 0.15;
  user-select: none;
}

.char-portrait::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(5,11,18,0.8) 100%);
  pointer-events: none;
}

.char-rank-badge {
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--orange);
  text-align: center;
  padding: 6px;
  border-top: 1px solid var(--orange-dim);
  text-transform: uppercase;
}

.char-unit-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 6px;
  letter-spacing: 0.1em;
}

/* ──────────────────────────────────────────────────────────
   DOCUMENT EDITOR
   ────────────────────────────────────────────────────────── */
.document-editor {
  display: grid;
  grid-template-columns: 220px 1fr 240px;
  gap: var(--gap-md);
  align-items: start;
}

.editor-meta { /* Colonne gauche */ }
.editor-main { /* Colonne centrale */ }
.editor-tools { /* Colonne droite */ }

.editor-textarea {
  width: 100%;
  min-height: 400px;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--cyan-line);
  border-radius: 2px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.9;
  padding: 14px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.editor-textarea:focus {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
  background: rgba(5, 24, 38, 0.6);
}
.editor-textarea::placeholder { color: var(--text-dim); }

.editor-preview {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 14px;
  min-height: 200px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.9;
  color: var(--text-main);
}

.mention-suggestion {
  background: var(--bg-panel-dark);
  border: 1px solid var(--orange);
  border-radius: 2px;
  padding: 10px 14px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--orange);
  letter-spacing: 0.1em;
  display: none;
}
.mention-suggestion.visible { display: block; }

/* ──────────────────────────────────────────────────────────
   PROGRESS LINE — Barres de progression
   ────────────────────────────────────────────────────────── */
.progress-line {
  height: 3px;
  background: rgba(56, 174, 234, 0.1);
  border-radius: 1px;
  overflow: hidden;
  margin: 4px 0;
}
.progress-line-fill {
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  border-radius: 1px;
  transition: width 0.6s ease;
}
.progress-line.orange .progress-line-fill { background: var(--orange); box-shadow: var(--glow-orange); }
.progress-line.green  .progress-line-fill { background: var(--green); }
.progress-line.red    .progress-line-fill { background: var(--red); box-shadow: var(--glow-red); }

/* ──────────────────────────────────────────────────────────
   ADMIN CONSOLE
   ────────────────────────────────────────────────────────── */
.admin-console .panel-header {
  background: rgba(245, 155, 46, 0.05);
  border-bottom-color: rgba(245,155,46,0.2);
}
.admin-console .panel-title { color: var(--orange); }

.admin-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--orange);
  border: 1px solid rgba(245,155,46,0.4);
  padding: 1px 6px;
  border-radius: 1px;
  letter-spacing: 0.15em;
}

/* ──────────────────────────────────────────────────────────
   LOGIN PAGE
   ────────────────────────────────────────────────────────── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-panel {
  width: 100%;
  max-width: 440px;
}

.login-header {
  text-align: center;
  padding: 30px 24px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.login-emblem {
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 900;
  color: var(--cyan-soft);
  letter-spacing: 0.1em;
  text-shadow: var(--glow-cyan);
  line-height: 1;
  margin-bottom: 8px;
}

.login-subtitle {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-muted);
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.login-body { padding: 24px; }
.login-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

/* ──────────────────────────────────────────────────────────
   BOOT ANIMATION OVERLAY
   ────────────────────────────────────────────────────────── */
#boot-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-main);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.5s ease;
}
#boot-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.boot-logo {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 900;
  color: var(--cyan-soft);
  letter-spacing: 0.3em;
  text-shadow: var(--glow-cyan);
  text-transform: uppercase;
}

.boot-log {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-align: left;
  width: 400px;
  max-width: 90vw;
}
.boot-log-line {
  margin-bottom: 3px;
  opacity: 0;
  animation: boot-fade-in 0.1s ease forwards;
}
@keyframes boot-fade-in {
  to { opacity: 1; }
}

.boot-progress {
  width: 400px;
  max-width: 90vw;
  height: 2px;
  background: rgba(42,168,224,0.15);
  border-radius: 1px;
  overflow: hidden;
}
.boot-progress-fill {
  height: 100%;
  background: var(--cyan);
  box-shadow: var(--glow-cyan);
  width: 0%;
  transition: width 0.1s linear;
}

/* ──────────────────────────────────────────────────────────
   DASHBOARD — Grille spécifique
   ────────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 280px 1fr 240px;
  grid-template-rows: auto;
  gap: var(--gap-md);
}

.dashboard-char-block  { grid-column: 1; grid-row: 1 / 3; }
.dashboard-main        { grid-column: 2; }
.dashboard-alerts      { grid-column: 3; grid-row: 1; }
.dashboard-activity    { grid-column: 3; grid-row: 2; }
.dashboard-actions     { grid-column: 2; grid-row: 2; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap-sm);
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--cyan-line);
  border-radius: 3px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text-muted);
  text-align: center;
}
.action-card:hover {
  background: var(--bg-panel-hover);
  border-color: var(--cyan);
  color: var(--text-bright);
  box-shadow: var(--glow-cyan);
}
.action-icon {
  font-size: 20px;
  opacity: 0.7;
}
.action-label {
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ──────────────────────────────────────────────────────────
   ACTIVITY LOG
   ────────────────────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 4px; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 9px;
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  margin-top: 4px;
  flex-shrink: 0;
}

.activity-text { color: var(--text-muted); flex: 1; }
.activity-time { color: var(--text-dim); white-space: nowrap; }

/* ──────────────────────────────────────────────────────────
   MISC UTILITIES
   ────────────────────────────────────────────────────────── */
.text-cyan    { color: var(--cyan-soft); }
.text-orange  { color: var(--orange); }
.text-red     { color: var(--red); }
.text-green   { color: var(--green); }
.text-muted   { color: var(--text-muted); }
.text-dim     { color: var(--text-dim); }
.text-bright  { color: var(--text-bright); }

.text-upper   { text-transform: uppercase; }
.text-mono    { font-family: var(--font-mono); }
.text-title   { font-family: var(--font-title); }
.text-sm      { font-size: 9px; }
.text-xs      { font-size: 8px; }

.mt-1 { margin-top: var(--gap-xs); }
.mt-2 { margin-top: var(--gap-sm); }
.mt-3 { margin-top: var(--gap-md); }
.mt-4 { margin-top: var(--gap-lg); }

.mb-1 { margin-bottom: var(--gap-xs); }
.mb-2 { margin-bottom: var(--gap-sm); }
.mb-3 { margin-bottom: var(--gap-md); }
.mb-4 { margin-bottom: var(--gap-lg); }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--gap-sm); }
.gap-md { gap: var(--gap-md); }

.w-100 { width: 100%; }
.hidden { display: none !important; }

/* Typing cursor */
.typing-cursor::after {
  content: '|';
  animation: blink-cursor 0.8s step-end infinite;
  color: var(--cyan);
  margin-left: 1px;
}
@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Page de type terminal simple (login, erreurs) */
.page-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* Séparateurs décoratifs */
.terminal-divider {
  height: 1px;
  background: var(--line-soft);
  position: relative;
  margin: var(--gap-lg) 0;
}
.terminal-divider::before {
  content: attr(data-label);
  position: absolute;
  left: 20px;
  top: -7px;
  background: var(--bg-main);
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Indicateur de statut document */
.status-active    { color: var(--green); }
.status-draft     { color: var(--orange); }
.status-published { color: var(--cyan); }
.status-archived  { color: var(--text-muted); }
.status-classified{ color: var(--red); }

/* Pagination terminal */
.terminal-pagination {
  display: flex;
  gap: var(--gap-sm);
  justify-content: center;
  margin-top: var(--gap-lg);
  align-items: center;
  font-size: 9px;
  color: var(--text-muted);
}
.terminal-pagination a {
  padding: 3px 8px;
  border: 1px solid var(--cyan-line);
  border-radius: 2px;
  color: var(--text-muted);
}
.terminal-pagination a:hover,
.terminal-pagination a.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-dim);
}

/* ──────────────────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .datapad-side-left,
  .datapad-side-right { display: none; }

  .dashboard-grid {
    grid-template-columns: 240px 1fr;
  }
  .dashboard-alerts,
  .dashboard-activity {
    grid-column: 1 / 3;
    grid-row: auto;
  }

  .character-file { grid-template-columns: 180px 1fr; }
  .character-file > :last-child { grid-column: 1 / 3; }

  .document-editor {
    grid-template-columns: 180px 1fr;
  }
  .editor-tools { grid-column: 1 / 3; }
}

@media (max-width: 900px) {
  .datapad-shell {
    clip-path: none;
    border-radius: 4px;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .grid-sidebar,
  .grid-sidebar-right,
  .grid-3col,
  .dashboard-grid,
  .character-file,
  .document-editor {
    grid-template-columns: 1fr;
  }

  .dashboard-char-block,
  .dashboard-main,
  .dashboard-alerts,
  .dashboard-activity,
  .dashboard-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .action-grid { grid-template-columns: repeat(2, 1fr); }

  .terminal-nav { display: none; }

  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  body { font-size: 12px; }

  .datapad-content { padding: var(--gap-sm); }

  .terminal-header { padding: 8px 12px; }

  .doc-meta-grid { grid-template-columns: 1fr 1fr; }

  .action-grid { grid-template-columns: 1fr 1fr; }

  .terminal-table { font-size: 10px; }
  .terminal-table th, .terminal-table td { padding: 5px 6px; }
}

/* ──────────────────────────────────────────────────────────
   REDUCED MOTION
   ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ──────────────────────────────────────────────────────────
   LISTES ET TIMELINES DE DOCUMENTS (SCI-FI AURA)
   ────────────────────────────────────────────────────────── */
.document-body ul {
    list-style: none !important;
    padding-left: 20px !important;
    margin: 10px 0 !important;
}
.document-body li {
    position: relative !important;
    margin-bottom: 6px !important;
    font-family: var(--font-mono) !important;
    font-size: 11px !important;
    color: var(--text-main) !important;
}
.document-body li::before {
    content: '⬟' !important;
    position: absolute !important;
    left: -15px !important;
    color: var(--cyan) !important;
    font-size: 8px !important;
    top: 1px !important;
}

.rta-timeline {
    position: relative !important;
    padding-left: 24px !important;
    margin: 20px 0 !important;
    border-left: 1px dashed var(--line-soft) !important;
}
.timeline-event {
    position: relative !important;
    margin-bottom: 20px !important;
}
.timeline-event:last-child {
    margin-bottom: 0 !important;
}
.timeline-badge {
    position: absolute !important;
    left: -29px !important;
    top: 3px !important;
    width: 9px !important;
    height: 9px !important;
    background: var(--bg-main) !important;
    border: 2px solid var(--orange) !important;
    border-radius: 50% !important;
    box-shadow: 0 0 5px var(--orange) !important;
}
.timeline-date {
    font-family: var(--font-mono) !important;
    font-size: 9px !important;
    color: var(--orange) !important;
    letter-spacing: 0.1em;
    font-weight: bold !important;
    margin-bottom: 4px !important;
    text-transform: uppercase !important;
}
.timeline-content {
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid var(--line-soft) !important;
    padding: 10px 14px !important;
    border-radius: 2px !important;
}
.timeline-title {
    font-family: var(--font-mono) !important;
    font-size: 11px !important;
    color: var(--text-bright) !important;
    font-weight: bold !important;
    margin-bottom: 4px !important;
}
.timeline-desc {
    font-family: var(--font-mono) !important;
    font-size: 11px !important;
    color: var(--text-muted) !important;
    line-height: 1.5 !important;
}
