/* ═══════════════════════════════════════════════════════════════════════════
   Pistachio plugin — Solarpunk Dark Theme (port focused depuis source mobile)
   Palette : pistachio green + deep forest + warm gold accents
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Frame de la fenêtre flottante (créée par Eden.shell.createFloatingWindow) ── */
.pistachio-window {
  position: fixed;
  display: flex;
  flex-direction: column;
  background: rgba(10, 15, 13, 0.97);
  border: 1px solid rgba(147, 196, 125, 0.12);
  border-radius: 14px;
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(147, 196, 125, 0.10);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #e8f0ea;
  animation: pist-win-in 0.18s ease-out;

  --pist-bg: #0a0f0d;
  --pist-bg-card: #111a15;
  --pist-bg-input: #152019;
  --pist-bg-hover: #1a2b21;
  --pist-border: #243a2e;
  --pist-border-light: #3a5a48;
  --pist-text: #e8f0ea;
  --pist-text-muted: #8fa898;
  --pist-text-dim: #5c7a68;
  --pist-accent: #93c47d;
  --pist-accent-dark: #6b9a56;
  --pist-accent-glow: rgba(147, 196, 125, 0.12);
  --pist-red: #e85d4a;
  --pist-gold: #d4a84b;
  --pist-radius: 14px;
  --pist-radius-sm: 10px;
}
@keyframes pist-win-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.pistachio-window.pistachio-window-maximized { border-radius: 0; box-shadow: none; }

.pistachio-window-titlebar {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--pist-border);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.pistachio-window-titlebar:active { cursor: grabbing; }
.pistachio-window-titlebar-left {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; flex: 1;
}
.pistachio-window-title {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-left: 6px;
  color: var(--pist-text);
}

/* Body : flex column qui remplit l'espace restant */
.pistachio-window-body {
  display: flex; flex-direction: column;
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--pist-bg);
  outline: none;
}

/* ── Mon container interne (innerHTML dans body) ─────────────────────────── */
.pistachio-window .pist-body {
  display: flex; flex-direction: column;
  flex: 1;
  width: 100%;
  background: var(--pist-bg);
  color: var(--pist-text);
  font: 14px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
}

/* ═══ Sub-nav (3 tabs : Models / Trainings / Editor) ═══ */
.pistachio-window .pist-sub-nav {
  display: flex; gap: 4px; padding: 12px 16px 8px;
  border-bottom: 1px solid var(--pist-border);
  background: var(--pist-bg-card);
}
.pistachio-window .pist-sub-btn {
  flex: 1; padding: 9px 14px; background: transparent; border: 1px solid var(--pist-border);
  color: var(--pist-text-muted); border-radius: 8px; cursor: pointer; font-size: 13px;
  font-weight: 500; transition: all 0.15s;
}
.pistachio-window .pist-sub-btn:hover { background: var(--pist-bg-hover); color: var(--pist-text); }
.pistachio-window .pist-sub-btn.active {
  background: var(--pist-accent-glow); color: var(--pist-accent);
  border-color: var(--pist-accent-dark);
}

/* ═══ Sub-pages ═══ */
.pistachio-window .pist-page { display: none; flex: 1; overflow-y: auto; padding: 16px 18px; }
.pistachio-window .pist-page.active { display: block; }
.pistachio-window .pist-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.pistachio-window .pist-page-header h3 {
  font-size: 14px; font-weight: 600; color: var(--pist-text);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.pistachio-window .pist-icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--pist-border);
  background: var(--pist-bg-card); color: var(--pist-text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
  transition: all 0.15s;
}
.pistachio-window .pist-icon-btn:hover { color: var(--pist-accent); border-color: var(--pist-accent-dark); }

/* ═══ Cards (model / training) ═══ */
.pistachio-window .pist-card-list { display: flex; flex-direction: column; gap: 10px; }
.pistachio-window .pist-card {
  background: var(--pist-bg-card); border: 1px solid var(--pist-border);
  border-radius: var(--pist-radius); padding: 14px 16px; cursor: pointer;
  transition: all 0.15s;
}
.pistachio-window .pist-card:hover { border-color: var(--pist-accent-dark); background: var(--pist-bg-hover); }
.pistachio-window .pist-card-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.pistachio-window .pist-card-title h4 { font-size: 14px; font-weight: 600; color: var(--pist-text); }
.pistachio-window .pist-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--pist-accent-glow); color: var(--pist-accent);
  border: 1px solid var(--pist-accent-dark);
}
.pistachio-window .pist-badge.gold { background: rgba(212, 168, 75, 0.1); color: var(--pist-gold); border-color: var(--pist-gold); }
.pistachio-window .pist-badge.red  { background: rgba(232, 93, 74, 0.1); color: var(--pist-red);  border-color: var(--pist-red); }
.pistachio-window .pist-card-meta {
  font-size: 12px; color: var(--pist-text-muted); display: flex; gap: 12px; flex-wrap: wrap;
}
.pistachio-window .pist-card-meta span { display: inline-flex; align-items: center; gap: 4px; }

.pistachio-window .pist-empty {
  padding: 40px 20px; text-align: center; color: var(--pist-text-dim); font-size: 13px;
}

/* ═══ Editor : config grid ═══ */
.pistachio-window .pist-config-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px;
}
.pistachio-window .pist-input-group { display: flex; flex-direction: column; gap: 4px; }
.pistachio-window .pist-input-group label {
  font-size: 11px; color: var(--pist-text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 500;
}
.pistachio-window .pist-input-group input,
.pistachio-window .pist-input-group select {
  padding: 8px 10px; background: var(--pist-bg-input); border: 1px solid var(--pist-border);
  border-radius: 8px; color: var(--pist-text); font-size: 13px; outline: none;
  transition: border-color 0.15s;
}
.pistachio-window .pist-input-group input:focus,
.pistachio-window .pist-input-group select:focus { border-color: var(--pist-accent); }

/* ═══ Mode switch CPU / GPU / Server ═══ */
.pistachio-window .pist-mode-switch { display: flex; gap: 6px; margin-bottom: 14px; }
.pistachio-window .pist-mode-btn {
  flex: 1; padding: 8px; background: var(--pist-bg-input); border: 1px solid var(--pist-border);
  color: var(--pist-text-muted); border-radius: 8px; cursor: pointer; font-size: 12px;
  font-weight: 500; transition: all 0.15s;
}
.pistachio-window .pist-mode-btn:hover { color: var(--pist-text); }
.pistachio-window .pist-mode-btn.active {
  background: var(--pist-accent-glow); color: var(--pist-accent);
  border-color: var(--pist-accent-dark);
}

/* ═══ Action buttons ═══ */
.pistachio-window .pist-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.pistachio-window .pist-btn {
  padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.pistachio-window .pist-btn-primary {
  background: var(--pist-accent); color: var(--pist-bg);
  border-color: var(--pist-accent);
}
.pistachio-window .pist-btn-primary:hover:not(:disabled) { background: var(--pist-accent-dark); }
.pistachio-window .pist-btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.pistachio-window .pist-btn-secondary {
  background: var(--pist-bg-card); color: var(--pist-text);
  border-color: var(--pist-border);
}
.pistachio-window .pist-btn-secondary:hover:not(:disabled) { background: var(--pist-bg-hover); border-color: var(--pist-border-light); }
.pistachio-window .pist-btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.pistachio-window .pist-btn-danger {
  background: rgba(232, 93, 74, 0.1); color: var(--pist-red);
  border-color: var(--pist-red);
}
.pistachio-window .pist-btn-danger:hover:not(:disabled) { background: rgba(232, 93, 74, 0.2); }

/* ═══ Train status ═══ */
.pistachio-window .pist-status {
  padding: 10px 14px; background: var(--pist-bg-card); border-left: 3px solid var(--pist-accent);
  border-radius: 0 8px 8px 0; margin-bottom: 14px; font-size: 13px;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  color: var(--pist-text-muted); white-space: pre-wrap;
}
.pistachio-window .pist-status.error { border-color: var(--pist-red); color: var(--pist-red); }

/* ═══ Editor section header ═══ */
.pistachio-window .pist-editor-section h3 {
  font-size: 14px; font-weight: 600; color: var(--pist-text);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px;
}
