/* ════════════════════════════════════════════════════════════════════════
 *  EdenALOS — style.css
 *  Theme liminal : dark base, accent cyan CRT, fonts mono, glassmorphism.
 * ════════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* Palette */
  --bg:           #060914;
  --bg-2:         #0b1226;
  --bg-3:         #111a36;
  --fg:           #d6e4ff;
  --fg-dim:       #8a9bbf;
  --fg-muted:     #5a6d8c;
  --accent:       #58c8ff;
  --accent-hot:   #8be9fd;
  --accent-cool:  #5dade2;
  --danger:       #ff5d6c;
  --warning:      #ffb454;
  --success:      #5ddc9a;

  --grid-line:    rgba(88, 200, 255, 0.06);
  --grid-strong:  rgba(88, 200, 255, 0.10);
  --border:       rgba(88, 200, 255, 0.18);
  --border-soft:  rgba(255, 255, 255, 0.06);
  --glass-bg:     rgba(8, 14, 28, 0.55);
  --glass-bg-hi:  rgba(12, 22, 44, 0.75);

  /* Typo */
  --font-mono:   ui-monospace, "JetBrains Mono", "Fira Code", SFMono-Regular, Menlo, Consolas, monospace;
  --font-ui:     -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-xl: 22px;

  /* Shadows */
  --glow-cyan:  0 0 24px rgba(88, 200, 255, 0.30);
  --glow-soft:  0 8px 32px rgba(0, 0, 0, 0.45);

  /* Spacing */
  --gap-xs: 6px;
  --gap-sm: 10px;
  --gap-md: 16px;
  --gap-lg: 24px;
  --gap-xl: 36px;
}

/* ════════════════════════════════════════════════════════════════════════
 *  Theme : LIGHT
 *  Override des variables du :root pour les éléments qui utilisent les
 *  vars CSS (login, shell-bar, body, écrans natifs). La plupart des
 *  plugins (explorer, edencode, sheet, emd, settings, edenupdo, …)
 *  hardcodent leurs couleurs (#0a0c12, #11151c, …) et restent en dark
 *  même quand data-theme=light → migration progressive plugin par plugin.
 *  Pattern type VS Code : chrome light, éditeur/fenêtres dark.
 * ════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  color-scheme: light;
  --bg:           #f5f7fa;
  --bg-2:         #ffffff;
  --bg-3:         #e7ecf3;
  --fg:           #0d1320;
  --fg-dim:       #4d5b78;
  --fg-muted:     #8a96a8;
  --accent:       #0070d4;
  --accent-hot:   #00a3ff;
  --accent-cool:  #0e6cb8;
  --grid-line:    rgba(0, 90, 200, 0.05);
  --grid-strong:  rgba(0, 90, 200, 0.10);
  --border:       rgba(0, 90, 200, 0.20);
  --border-soft:  rgba(0, 0, 0, 0.07);
  --glass-bg:     rgba(255, 255, 255, 0.65);
  --glass-bg-hi:  rgba(255, 255, 255, 0.85);
  --glow-cyan:    0 0 24px rgba(0, 112, 212, 0.20);
  --glow-soft:    0 8px 32px rgba(0, 30, 80, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* Le [hidden] du UA stylesheet (display: none) est battu par tout
   display: flex/grid plus spécifique. On force la priorité. */
[hidden] { display: none !important; }
body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
  position: relative;
}

/* ── Décor liminal ─────────────────────────────────────────────────────── */
.liminal-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  overflow: hidden;
}
.liminal-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}
.liminal-glow {
  position: absolute;
  width: 75vmin; height: 75vmin;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(88,200,255,0.18) 0%, transparent 60%);
  filter: blur(50px);
  animation: liminal-pulse 8s ease-in-out infinite;
}
.liminal-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%);
}
@keyframes liminal-pulse {
  0%,100% { opacity: 0.55; transform: translate(-50%,-50%) scale(1);    }
  50%     { opacity: 1.00; transform: translate(-50%,-50%) scale(1.06); }
}

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toasts {
  position: fixed; top: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: var(--glass-bg-hi);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: var(--glow-soft);
}
.toast.show    { opacity: 1; transform: none; }
.toast.error   { border-color: rgba(255,93,108,0.45); }
.toast.success { border-color: rgba(93,220,154,0.45); }
.toast.warning { border-color: rgba(255,180,84,0.45);  }

/* ════════════════════════════════════════════════════════════════════════
 *  Screen — Login
 * ════════════════════════════════════════════════════════════════════════ */
.screen-login {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 440px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 32px 28px;
  box-shadow: var(--glow-soft), var(--glow-cyan);
  animation: card-in 0.6s ease-out;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.login-head {
  text-align: center;
  margin-bottom: 28px;
}
.login-mark {
  font-family: var(--font-mono);
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hot) 50%, var(--fg) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(88,200,255,0.25);
  line-height: 1;
}
.login-sub {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-muted);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.login-form {
  display: flex; flex-direction: column;
  gap: var(--gap-md);
}
.field {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
}
.field-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.field input {
  background: rgba(6, 9, 20, 0.6);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 11px 14px;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.field input:focus {
  border-color: var(--accent);
  background: rgba(6, 9, 20, 0.85);
  box-shadow: 0 0 0 3px rgba(88,200,255,0.10), inset 0 0 0 1px rgba(88,200,255,0.10);
}
/* Champs avec révélateur (oeil) : padding-right pour accueillir le bouton */
.field-secret input { padding-right: 44px; }
.field-eye {
  position: absolute;
  right: 6px;
  bottom: 4px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: color .15s ease, background .15s ease;
}
.field-eye:hover { color: var(--accent); background: rgba(88,200,255,0.06); }
.field-eye:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.field-eye svg { display: block; }
.login-error {
  background: rgba(255,93,108,0.10);
  border: 1px solid rgba(255,93,108,0.40);
  color: #ffb3bb;
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-family: var(--font-mono);
}
.btn-primary {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: linear-gradient(180deg, rgba(88,200,255,0.15), rgba(88,200,255,0.05));
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 13px 16px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all .2s ease;
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary.ready,
.btn-primary:not(:disabled):hover {
  background: linear-gradient(180deg, rgba(88,200,255,0.30), rgba(88,200,255,0.12));
  border-color: var(--accent);
  box-shadow: var(--glow-cyan);
  color: #fff;
}
.btn-primary:not(:disabled):active {
  transform: translateY(1px);
}
.login-foot {
  margin-top: 22px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.dim { color: var(--fg-muted); }

/* ════════════════════════════════════════════════════════════════════════
 *  Screen — Shell (placeholder Phase 2)
 * ════════════════════════════════════════════════════════════════════════ */
.screen-shell {
  /* Pas de z-index ici : sinon crée un stacking context qui clamp tous les
     z-index des enfants (.shell-bar, etc.) à l'intérieur du contexte du
     parent → la shell-bar ne pouvait pas passer au-dessus de .gui-desktop
     (z=50 global). Ordre de paint suffit pour rester au-dessus de
     .liminal-bg (qui a pointer-events:none de toute façon). */
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.shell-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  /* Doit rester au-dessus de .gui-desktop (z=50, position:fixed inset:0) qui
     sinon couvre toute la viewport et intercepte les clics — Déconnexion,
     Settings, clock incluses. < 200 (z des fenêtres flottantes Eden.shell). */
  position: relative;
  z-index: 100;
}
.shell-bar-left {
  display: flex; align-items: baseline; gap: 10px;
}
.shell-mark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.shell-version {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
}
.btn-ghost {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--fg-dim);
  padding: 7px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .2s ease;
}
.btn-ghost:hover {
  color: var(--fg);
  border-color: var(--border);
}
.shell-content {
  flex: 1;
  padding: 18px;
  display: flex;
  min-height: 0; /* permet au scroll interne du shell de fonctionner dans flex */
}
.shell-bar-right { display: flex; align-items: center; gap: 14px; }
.shell-user { font-family: var(--font-mono); font-size: 11px; }

/* Top bar OS : clock vivant + settings icon (style menubar macOS-like) */
.shell-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-variant-numeric: tabular-nums;
  cursor: default;
  user-select: none;
}
.shell-clock-time {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg, #d6e4ff);
  letter-spacing: 0.02em;
}
.shell-clock-date {
  font-size: 10px;
  color: var(--fg-dim, #8a9bbf);
  text-transform: capitalize;
  letter-spacing: 0.04em;
}
.shell-bar-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-dim, #8a9bbf);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
  padding: 0;
}
.shell-bar-icon-btn:hover {
  background: rgba(88, 200, 255, 0.10);
  border-color: rgba(88, 200, 255, 0.25);
  color: #58c8ff;
}
.shell-bar-icon-btn:focus-visible {
  outline: none;
  border-color: rgba(88, 200, 255, 0.55);
}
