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

/* ============================================================
   SUPERNOVA MANAGER — Charte Cockpit Lumineux V11
   ============================================================ */

/* Variables */
:root {
  --sn-encre: #0A1628;
  --sn-violet: #6C5CE7;
  --sn-violet-10: rgba(108,92,231,0.1);
  --sn-violet-20: rgba(108,92,231,0.2);
  --sn-azur: #3B7DD8;
  --sn-neige: #F8F9FC;
  --sn-brume: #E8E9EF;
  --sn-blanc: #FFFFFF;
  --sn-ink80: #2A3446;
  --sn-ink60: #4A5568;
  --sn-ink40: #8E92A4;
  --sn-ink20: #C4C7D4;
  --sn-vert: #27AE60;
  --sn-orange: #E67E22;
  --sn-rouge: #C0392B;
  --sn-ambre: #F5A623;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Helvetica Neue', Helvetica, -apple-system, Arial, sans-serif;
  background: #F4F5FA;
  background-image: radial-gradient(circle, rgba(108,92,231,0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  color: var(--sn-ink80);
  max-width: 375px;
  margin: 0 auto;
  position: relative;
}

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
  display: none;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 60px;
}

.screen.active {
  display: block;
}

/* ============================================================
   SCREEN 0 — LOGIN
   ============================================================ */
#screen-login {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 40px 24px;
}

#screen-login.active {
  display: flex;
}

.login-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(108,92,231,0.4);
  margin-bottom: 48px;
  text-transform: uppercase;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--sn-ink40);
}

.login-field input {
  height: 44px;
  border: 0.5px solid rgba(108,92,231,0.25);
  border-radius: 2px;
  background: rgba(255,255,255,0.7);
  padding: 0 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  color: var(--sn-ink80);
  outline: none;
  transition: border-color 0.2s;
}

.login-field input:focus {
  border-color: rgba(108,92,231,0.5);
  background: rgba(255,255,255,0.9);
}

.login-btn {
  height: 44px;
  background: var(--sn-violet);
  color: white;
  border: none;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.2s;
}

.login-btn:active {
  opacity: 0.85;
}

.login-error {
  font-size: 12px;
  color: var(--sn-rouge);
  text-align: center;
  min-height: 18px;
}

/* ============================================================
   HUD PANELS — crochets de coin
   ============================================================ */
.hud-panel {
  position: relative;
  border: 0.5px solid rgba(108,92,231,0.12);
  border-radius: 2px;
  background: rgba(255,255,255,0.55);
}

.hud-panel::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 6px;
  height: 6px;
  border-width: 1px 0 0 1px;
  border-style: solid;
  border-color: rgba(108,92,231,0.2);
}

.hud-panel::after {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-width: 0 1px 1px 0;
  border-style: solid;
  border-color: rgba(108,92,231,0.2);
}

/* Grand variant (PULSE) */
.hud-panel-lg::before {
  width: 12px;
  height: 12px;
  border-width: 2px 0 0 2px;
  border-color: rgba(108,92,231,0.35);
}

.hud-panel-lg::after {
  width: 12px;
  height: 12px;
  border-width: 0 2px 2px 0;
  border-color: rgba(108,92,231,0.35);
}

/* ============================================================
   SCREEN 1 — DASHBOARD
   ============================================================ */
.dashboard-scroll {
  padding: 12px 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Header */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.dash-header-left .pdv-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--sn-encre);
  line-height: 1.2;
}

.dash-header-left .pdv-date {
  font-size: 10px;
  color: var(--sn-ink40);
  margin-top: 2px;
}

.pdv-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--sn-violet);
  border: 0.5px solid rgba(108,92,231,0.3);
  border-radius: 4px;
  padding: 3px 10px;
}

/* Ticker alertes */
.ticker-wrap {
  position: relative;
  height: 22px;
  border: 0.5px solid rgba(192,57,43,0.15);
  border-radius: 2px;
  background: rgba(252,235,235,0.3);
  overflow: hidden;
}

.ticker-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: #C0392B;
  z-index: 2;
}

.ticker-track {
  display: flex;
  align-items: center;
  height: 100%;
  padding-left: 10px;
  white-space: nowrap;
  animation: ticker-scroll 25s linear infinite;
}

.ticker-wrap:hover .ticker-track {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--sn-ink80);
  padding: 0 12px;
}

.ticker-sep {
  color: var(--sn-ink20);
  font-size: 10px;
}

.severity-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.severity-dot.crit { background: #C0392B; }
.severity-dot.high { background: #E67E22; }
.severity-dot.med  { background: #F5A623; }

/* Jauges (2 cartes) */
.gauges-row {
  display: flex;
  gap: 8px;
}

.gauge-card {
  flex: 1;
  padding: 8px 6px 6px;
}

.gauge-label {
  font-size: 8px;
  letter-spacing: 1.2px;
  color: var(--sn-ink40);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.gauge-svg-wrap {
  display: flex;
  justify-content: center;
}

.gauge-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--sn-ink80);
  text-align: center;
  margin-top: 2px;
}

.gauge-objectif {
  font-size: 9px;
  color: var(--sn-ink40);
  text-align: center;
}

.gauge-delta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  margin-top: 2px;
}

.gauge-delta.pos { color: var(--sn-vert); }
.gauge-delta.neg { color: var(--sn-rouge); }

.gauge-n1-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  background: rgba(108,92,231,0.04);
  border: 0.5px solid rgba(108,92,231,0.08);
  border-radius: 2px;
  padding: 2px 8px;
  display: inline-block;
  margin: 3px auto 0;
  display: block;
  text-align: center;
  color: var(--sn-ink60);
}

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

.stat-cell {
  border: 0.5px solid rgba(108,92,231,0.1);
  border-radius: 2px;
  padding: 7px 6px;
  background: rgba(255,255,255,0.5);
  text-align: center;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--sn-ink80);
  line-height: 1.2;
}

.stat-value.accent { color: var(--sn-violet); }

.stat-label {
  font-size: 8px;
  color: var(--sn-ink40);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* Zone PULSE */
.pulse-zone {
  position: relative;
  border: 0.5px solid rgba(108,92,231,0.2);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.pulse-zone::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 12px;
  height: 12px;
  border-width: 2px 0 0 2px;
  border-style: solid;
  border-color: rgba(108,92,231,0.35);
  z-index: 3;
}

.pulse-zone::after {
  content: '';
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 12px;
  height: 12px;
  border-width: 0 2px 2px 0;
  border-style: solid;
  border-color: rgba(108,92,231,0.35);
  z-index: 3;
}

#pulse-canvas {
  display: block;
  width: 100%;
  height: 120px;
}

.pulse-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
}

.pulse-info {
  position: absolute;
  top: 50%;
  left: 25%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 6px 20px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 6px;
}

.pulse-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--sn-violet);
  letter-spacing: 1.5px;
  text-align: center;
}

.pulse-subtitle {
  font-size: 10px;
  color: var(--sn-ink60);
  text-align: left;
}

.pulse-status {
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--sn-vert);
}

.pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sn-vert);
  animation: pulse-blink 1.6s ease-in-out infinite;
}

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

/* Brief du jour */
.brief-panel {
  position: relative;
  border: 0.5px solid rgba(108,92,231,0.18);
  border-radius: 2px;
  background: rgba(235,232,253,0.25);
  padding: 10px 12px 10px 16px;
}

.brief-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: var(--sn-violet);
  border-radius: 2px 0 0 2px;
}

.brief-tag {
  font-size: 8px;
  letter-spacing: 1.5px;
  color: var(--sn-violet);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 6px;
}

.brief-text {
  font-size: 11px;
  color: var(--sn-ink80);
  line-height: 1.5;
}

/* Checklist */
.checklist-panel {
  padding: 10px 12px;
}

.checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.checklist-label {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--sn-ink40);
  letter-spacing: 1.2px;
}

.checklist-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--sn-violet);
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 0.5px solid rgba(108,92,231,0.06);
  cursor: pointer;
}

.checklist-item:last-child {
  border-bottom: none;
}

.cb-box {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  border: 1px solid var(--sn-ink20);
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
  transition: all 0.15s;
  background: white;
}

.checklist-item.done .cb-box {
  background: var(--sn-violet);
  border-color: var(--sn-violet);
}

.checklist-item.done .cb-box::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 4px;
  width: 4px;
  height: 7px;
  border: 1.5px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.cb-text {
  font-size: 11px;
  color: var(--sn-ink80);
  line-height: 1.4;
  flex: 1;
  transition: color 0.15s;
}

.checklist-item.done .cb-text {
  text-decoration: line-through;
  color: var(--sn-ink40);
}

.prio-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 7px;
  font-weight: 600;
  border-radius: 2px;
  padding: 1px 5px;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}

.prio-badge.URG {
  color: var(--sn-rouge);
  border: 0.5px solid rgba(192,57,43,0.2);
}

.prio-badge.MOY {
  color: var(--sn-orange);
  border: 0.5px solid rgba(230,126,34,0.2);
}

/* Console grid */
.console-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.console-btn {
  border: 0.5px solid rgba(108,92,231,0.1);
  border-radius: 2px;
  padding: 9px 2px 7px;
  background: rgba(255,255,255,0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.console-btn:active {
  opacity: 0.75;
}

.console-btn.active {
  border-color: rgba(108,92,231,0.3);
  background: rgba(108,92,231,0.035);
}

.console-btn svg {
  stroke: var(--sn-ink40);
}

.console-btn.active svg {
  stroke: var(--sn-violet);
}

.console-btn-label {
  font-size: 8px;
  color: var(--sn-ink40);
  letter-spacing: 0.5px;
}

.console-btn.active .console-btn-label {
  color: var(--sn-violet);
}

/* Skeleton loading */
.skel {
  background: linear-gradient(90deg, rgba(108,92,231,0.06) 25%, rgba(108,92,231,0.12) 50%, rgba(108,92,231,0.06) 75%);
  background-size: 200% 100%;
  animation: skel-pulse 1.4s ease-in-out infinite;
  border-radius: 2px;
}

@keyframes skel-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   SCREEN 2 — ALERTES
   ============================================================ */
.screen-header {
  padding: 14px 12px 10px;
  border-bottom: 0.5px solid rgba(108,92,231,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.screen-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sn-encre);
}

.screen-body {
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alerte-card {
  position: relative;
  border: 0.5px solid rgba(108,92,231,0.12);
  border-radius: 2px;
  background: rgba(255,255,255,0.6);
  padding: 10px 12px 10px 14px;
  cursor: pointer;
}

.alerte-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  border-radius: 2px 0 0 2px;
}

.alerte-card.crit::before { background: #C0392B; }
.alerte-card.high::before { background: #E67E22; }
.alerte-card.med::before  { background: #F5A623; }
.alerte-card.low::before  { background: var(--sn-azur); }

.alerte-type {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--sn-ink40);
  margin-bottom: 4px;
}

.alerte-message {
  font-size: 12px;
  color: var(--sn-ink80);
  line-height: 1.4;
}

.alerte-date {
  font-size: 9px;
  color: var(--sn-ink40);
  margin-top: 5px;
  font-family: 'JetBrains Mono', monospace;
}

.alerte-expand {
  display: none;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 0.5px solid rgba(108,92,231,0.1);
  font-size: 11px;
  color: var(--sn-ink60);
  line-height: 1.5;
}

.alerte-card.open .alerte-expand {
  display: block;
}

/* ============================================================
   SCREEN 3 — TACHES
   ============================================================ */
.taches-full {
  padding: 10px;
}

/* ============================================================
   SCREEN 4 — FEEDBACK
   ============================================================ */
.feedback-form {
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feedback-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feedback-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--sn-ink40);
}

/* Étoiles */
.stars-row {
  display: flex;
  gap: 8px;
}

.star-btn {
  font-size: 24px;
  cursor: pointer;
  color: var(--sn-ink20);
  transition: color 0.15s, transform 0.1s;
  line-height: 1;
}

.star-btn.active {
  color: var(--sn-ambre);
}

.star-btn:active {
  transform: scale(1.2);
}

/* Radio buttons */
.radio-row {
  display: flex;
  gap: 8px;
}

.radio-opt {
  flex: 1;
  height: 34px;
  border: 0.5px solid rgba(108,92,231,0.2);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--sn-ink60);
  cursor: pointer;
  transition: all 0.15s;
}

.radio-opt.active {
  border-color: var(--sn-violet);
  background: var(--sn-violet-10);
  color: var(--sn-violet);
  font-weight: 600;
}

/* Toggle Oui/Non */
.toggle-row {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  padding: 6px 16px;
  border: 0.5px solid rgba(108,92,231,0.2);
  border-radius: 2px;
  font-size: 11px;
  color: var(--sn-ink60);
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}

.toggle-btn.active {
  border-color: var(--sn-violet);
  background: var(--sn-violet-10);
  color: var(--sn-violet);
}

.feedback-textarea {
  display: none;
}

.feedback-textarea.visible {
  display: block;
}

.feedback-textarea textarea, .feedback-textarea input {
  width: 100%;
  border: 0.5px solid rgba(108,92,231,0.2);
  border-radius: 2px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: inherit;
  color: var(--sn-ink80);
  background: rgba(255,255,255,0.7);
  outline: none;
  resize: vertical;
}

.feedback-textarea textarea {
  min-height: 80px;
}

/* Slider */
.charge-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 3px;
  background: rgba(108,92,231,0.15);
  border-radius: 2px;
  outline: none;
}

.charge-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--sn-violet);
  cursor: pointer;
}

/* Submit btn */
.feedback-submit {
  height: 44px;
  background: var(--sn-violet);
  color: white;
  border: none;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.feedback-submit:active {
  opacity: 0.85;
}

.feedback-confirm {
  display: none;
  text-align: center;
  padding: 16px;
  color: var(--sn-vert);
  font-size: 13px;
  font-weight: 600;
}

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 375px;
  height: 52px;
  border-top: 0.5px solid rgba(108,92,231,0.08);
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 0;
}

.nav-item svg {
  stroke: var(--sn-ink40);
  transition: stroke 0.15s;
}

.nav-item.active svg {
  stroke: var(--sn-violet);
}

.nav-label {
  font-size: 8px;
  color: var(--sn-ink40);
  transition: color 0.15s;
}

.nav-item.active .nav-label {
  color: var(--sn-violet);
  font-weight: 600;
}

/* ============================================================
   SCREEN PULSE PLACEHOLDER
   ============================================================ */
#screen-pulse {
  padding-bottom: 60px;
}

.pulse-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 60px);
  gap: 16px;
}

.pulse-soon-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--sn-violet);
  letter-spacing: 2px;
}

.pulse-soon-sub {
  font-size: 12px;
  color: var(--sn-ink40);
  text-align: center;
  line-height: 1.5;
}
