/* ============================================================================
   Glyphe — Styles spécifiques
   Version : 1.0.0 (VNCT Design System)
   
   Ce fichier contient UNIQUEMENT les styles propres à Glyphe.
   Les variables, thèmes, FAB, modals, toasts, nav, version badge
   sont gérés par vnct-design-system.css et vnct-common.js.
   
   Glyphe est une app DESKTOP ONLY — le mobile affiche un wall.
   ============================================================================ */

/* ── Custom fonts for code display ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Syne:wght@400;500;600;700;800&display=swap');

:root {
  --font-mono: 'DM Mono', monospace;
}

/* ── LAYOUT (grid 2 colonnes) ── */
body {
  height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

/* ── HEADER ── */
header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--border-default);
}

.logo {
  font-weight: var(--font-bold);
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.logo span { color: var(--accent); }

.header-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

/* ── SIDEBAR ── */
aside {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-default);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  overflow-y: auto;
}

.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ctrl-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

select, input[type="text"] {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  width: 100%;
  transition: border-color 0.2s;
  appearance: none;
  cursor: pointer;
}

select:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

/* Padding slider */
.slider-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.slider-val {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-primary);
  min-width: 2.5rem;
  text-align: right;
}

/* Toggle row */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border-default);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle input:checked + .toggle-track { background: var(--accent); }

.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-track::after { transform: translateX(18px); }

/* Color swatches */
.swatch-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
}

.swatch:hover { transform: scale(1.1); }
.swatch.active { border-color: var(--text-primary); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s;
  letter-spacing: 0.03em;
}

.btn:hover { border-color: var(--text-primary); color: var(--text-primary); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: var(--neon-shadow-sm);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.74rem;
}

/* ── MAIN (preview area) ── */
main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding: 3rem 2rem;
  gap: 1.5rem;
  overflow: auto;
}

/* ── CANVAS WRAPPER ── */
#canvas-wrap {
  display: inline-block;
}

/* ── CODE CARD ── */
#code-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  min-width: 480px;
  width: fit-content;
  transition: all 0.3s;
  position: relative;
}

/* Titlebar */
.titlebar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.2rem;
  position: relative;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }

.titlebar-name {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  opacity: 0.5;
}

/* Code area */
.code-wrap {
  position: relative;
}

#code-display {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  overflow-x: auto;
}

#code-display code {
  font-family: var(--font-mono) !important;
  font-size: 0.9rem;
  line-height: 1.7 !important;
  display: block;
  white-space: pre;
  width: max-content;
}

/* Textarea overlay for editing */
#code-input {
  position: absolute;
  top: 0;
  left: 0;
  background: transparent;
  border: none;
  outline: none;
  color: transparent;
  caret-color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.7;
  resize: none;
  overflow: hidden;
  padding: inherit;
  z-index: 3;
  white-space: pre;
  min-width: 100%;
  /* Garde une zone cliquable quand le textarea est vide — sinon
     syncInputSize() met height:0 et on ne peut plus recoller dedans. */
  min-height: 1.7em;
}

/* Line numbers */
.ln-wrap {
  display: flex;
  overflow-x: auto;
}

.line-numbers {
  padding: 0;
  text-align: right;
  user-select: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.7;
  opacity: 0.3;
  min-width: 2.5em;
  flex-shrink: 0;
}

.ln-line { display: block; }

/* Watermark */
.watermark {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  opacity: 0.25;
  text-align: right;
  padding: 0.8rem 1rem;
  letter-spacing: 0.05em;
}

/* ── STATUS BAR ── */
.status-bar {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ── UI THEME (light) ──
   Les variables de couleur sont gérées par le design system via [data-theme="light"].
   La classe body.light-ui est conservée uniquement pour le switch hljs dark/light.
   ── */

/* ── HIGHLIGHT THEMES ── */
.hljs-light { display: none; }
body.light-ui .hljs-dark { display: none; }
body.light-ui .hljs-light { display: block; }

/* Notification */
.notif {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--accent);
  color: #000;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 100;
}

.notif.show {
  opacity: 1;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════════════════
   TERMINAL PARSER — Coloration du contenu terminal
   Utilisé par les presets Terminal et Hacker
   ══════════════════════════════════════════════════════════════════════ */

/* ── Couleurs Terminal Classic ── */
#code-card.preset-terminal .term-user     { color: #50fa7b; }
#code-card.preset-terminal .term-at       { color: #cccccc; }
#code-card.preset-terminal .term-host     { color: #f1fa8c; }
#code-card.preset-terminal .term-sep      { color: #cccccc; }
#code-card.preset-terminal .term-path     { color: #8be9fd; }
#code-card.preset-terminal .term-prompt   { color: #cccccc; font-weight: 500; }
#code-card.preset-terminal .term-cmd      { color: #f8f8f2; }
#code-card.preset-terminal .term-output   { color: #bbbbbb; }
#code-card.preset-terminal .term-ps-prompt { color: #bd93f9; }
#code-card.preset-terminal .term-env      { color: #ff79c6; }

/* ── Couleurs Hacker (tout en vert) ── */
#code-card.preset-hacker .term-user      { color: #00ff41; text-shadow: 0 0 6px rgba(0,255,65,0.5); }
#code-card.preset-hacker .term-at        { color: #00cc33; text-shadow: 0 0 4px rgba(0,255,65,0.3); }
#code-card.preset-hacker .term-host      { color: #00ee38; text-shadow: 0 0 6px rgba(0,255,65,0.4); }
#code-card.preset-hacker .term-sep       { color: #00aa2d; text-shadow: 0 0 4px rgba(0,255,65,0.3); }
#code-card.preset-hacker .term-path      { color: #00dd35; text-shadow: 0 0 5px rgba(0,255,65,0.4); }
#code-card.preset-hacker .term-prompt    { color: #00ff41; text-shadow: 0 0 6px rgba(0,255,65,0.5); font-weight: 500; }
#code-card.preset-hacker .term-cmd       { color: #00ff41; text-shadow: 0 0 8px rgba(0,255,65,0.5); }
#code-card.preset-hacker .term-output    { color: #00bb30; text-shadow: 0 0 4px rgba(0,255,65,0.2); }
#code-card.preset-hacker .term-ps-prompt { color: #00ff41; text-shadow: 0 0 6px rgba(0,255,65,0.5); }
#code-card.preset-hacker .term-env       { color: #00dd35; text-shadow: 0 0 5px rgba(0,255,65,0.4); }

/* Override hljs colors in hacker mode (au cas où hljs serait encore actif) */
#code-card.preset-hacker #code-highlighted,
#code-card.preset-hacker #code-highlighted *,
#code-card.preset-hacker .line-numbers {
  text-shadow: 0 0 6px rgba(0,255,65,0.3);
}

#code-card.preset-hacker .line-numbers {
  color: #00aa2d !important;
  opacity: 0.5;
}

#code-card.preset-hacker #code-input {
  caret-color: #00ff41;
}

#code-card.preset-terminal #code-input {
  caret-color: #f8f8f2;
}

/* ══════════════════════════════════════════════════════════════════════
   PRESET: TERMINAL — Realistic terminal titlebar
   ══════════════════════════════════════════════════════════════════════ */

#code-card.preset-terminal .titlebar {
  background: #1e1e1e !important;
  border-bottom: 1px solid #333;
  padding: 0 0.8rem;
  height: 30px;
  gap: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#code-card.preset-terminal .dot { display: none; }

/* Titre centré dans la titlebar terminal */
.terminal-title-center {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #999;
  letter-spacing: 0.02em;
  text-align: center;
}

/* Contrôles fenêtre à droite */
.terminal-controls {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
  font-size: 0.65rem;
}

.terminal-controls span {
  cursor: default;
  line-height: 1;
}

.terminal-controls span:hover {
  color: #aaa;
}


/* ══════════════════════════════════════════════════════════════════════
   PRESET: HACKER — CRT effects (titlebar + scanlines + vignette)
   ══════════════════════════════════════════════════════════════════════ */

#code-card.preset-hacker .titlebar {
  background: rgba(0, 255, 65, 0.03) !important;
  border-bottom: 1px solid rgba(0, 255, 65, 0.1);
}

#code-card.preset-hacker .dot { display: none; }

#code-card.preset-hacker .titlebar-name {
  position: static;
  transform: none;
  font-size: 0.8rem;
  color: #00ff41;
  opacity: 0.8;
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.5);
}

.hacker-cursor {
  display: inline-block;
  animation: hackerBlink 1s step-end infinite;
  color: #00ff41;
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.6);
}

@keyframes hackerBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* CRT Scanlines */
#code-card.preset-hacker::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  pointer-events: none;
  z-index: 4;
  border-radius: inherit;
}

/* CRT Vignette */
#code-card.preset-hacker::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.35) 100%
  );
  pointer-events: none;
  z-index: 4;
  border-radius: inherit;
}

/* Hacker watermark */
#code-card.preset-hacker .watermark {
  color: #00ff41;
  opacity: 0.15;
  text-shadow: 0 0 4px rgba(0, 255, 65, 0.3);
}

/* ── MOBILE WALL ── */
.mobile-wall {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem;
  text-align: center;
}

@media (max-width: 768px) {
  .mobile-wall { display: flex; }
}

.mobile-wall-icon {
  font-size: 3rem;
  opacity: 0.6;
}

.mobile-wall-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.mobile-wall-title span { color: var(--accent); }

.mobile-wall-text {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 280px;
}
