/* Base */
:root {
  --bg: #0f1218;
  --panel: #151922;
  --border: #2b3340;
  --text: #e5e7eb;
  --muted: #a1a8b3;
  --accent: #60a5fa;
  --hover: #1b2130;
  --selected: rgba(96, 165, 250, 0.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app {
  display: grid;
  grid-template-rows: 56px 1fr 36px;
  height: 100vh;
}

/* Boot screen */
.boot-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.boot-card {
  width: 420px;
  max-width: calc(100% - 24px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  text-align: center;
}
.boot-icon { font-size: 28px; }
.boot-desc { color: var(--muted); margin: 8px 0 16px; }
.primary {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}
.primary:disabled { opacity: .7; cursor: not-allowed; }
.boot-progress { margin-top: 16px; }
.hidden { display: none !important; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-bar { flex: 1; height: 10px; background: var(--hover); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: #60a5fa; width: 0%; transition: width .2s ease; }
.progress-text { color: var(--muted); min-width: 36px; text-align: right; }
.progress-note { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.brand-icon { font-size: 18px; }
.brand-name { letter-spacing: 0.2px; }
.search { flex: 1; display: flex; justify-content: flex-end; }
.search input {
  max-width: 380px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 2px solid rgba(37, 99, 235, 0.25); border-color: var(--accent); }

/* Layout */
.main {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100%;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  padding: 12px 12px 8px 12px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.tree {
  padding: 4px 8px 12px 8px;
  overflow: auto;
}

.tree ul { list-style: none; padding-left: 12px; margin: 0; }
.tree li { margin: 4px 0; }
.tree .node {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.tree .node:hover { background: var(--hover); }
.tree .chevron { font-size: 12px; color: var(--muted); width: 14px; text-align: center; }
.tree .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree .icon { width: 18px; }
.tree .selected { background: var(--selected); }

.content { display: flex; flex-direction: column; }
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.breadcrumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumb { color: var(--muted); }
.crumb a { color: var(--text); text-decoration: none; padding: 4px 8px; border-radius: 6px; }
.crumb a:hover { background: var(--hover); }
.crumb .sep { color: var(--muted); margin: 0 2px; }

.view-toggle { display: flex; gap: 6px; }
.toggle { padding: 6px 10px; border: 1px solid var(--border); background: var(--panel); border-radius: 6px; cursor: pointer; color: var(--text); }
.toggle.active { border-color: var(--accent); color: var(--accent); }

.file-list { flex: 1; padding: 8px; overflow: auto; }
.file-row {
  display: grid;
  grid-template-columns: 1fr 120px 160px;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.file-row:hover { background: var(--hover); }
.file-row .col { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-row .col-name .icon { width: 22px; }
.file-row .col-name .icon { display: inline-flex; align-items: center; justify-content: center; }
.icon-svg { width: 1em; height: 1em; display: inline-block; vertical-align: middle; }
.file-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .col-size, .file-row .col-modified { color: var(--muted); font-size: 13px; }
.file-row.folder .name { font-weight: 600; }

/* (Mode grille retiré) */

/* Statusbar */
.statusbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 12px; background: var(--panel);
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}
.disk-usage { display: flex; align-items: center; gap: 8px; }
.usage-bar { width: 160px; height: 8px; background: var(--hover); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.usage-fill { height: 100%; background: #60a5fa; }
.usage-label { display: none; }

/* Responsive */
@media (max-width: 920px) {
  .main { grid-template-columns: 220px 1fr; }
  .file-row { grid-template-columns: 1fr 100px 140px; }
}
@media (max-width: 720px) {
  .main { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 8px 12px; }
  .search input { max-width: none; }
}
/* Buttons */
.btn { padding: 8px 12px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 8px; cursor: pointer; }
.btn:hover { background: var(--hover); }
.btn-primary { border-color: var(--accent); background: var(--accent); color: #0b1220; }
.btn-ghost { background: transparent; }

/* Anti-DevTools overlay */
.anti-devtools {
  position: fixed;
  inset: 0;
  background: rgba(11,15,24,0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.anti-devtools .card {
  width: 420px;
  max-width: calc(100% - 24px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.anti-devtools h2 { margin: 0 0 8px; }
.anti-devtools p { color: var(--muted); }

/* Editor Panel */
.editor-panel {
  position: fixed;
  top: 56px; /* below topbar */
  right: 0;
  bottom: 36px; /* above statusbar */
  width: 480px;
  max-width: 100%;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  z-index: 40;
}
.editor-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.editor-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.editor-actions { display: flex; gap: 8px; }
.editor-body { flex: 1; display: flex; }
.editor-body textarea {
  flex: 1; width: 100%; resize: none; border: none; outline: none; padding: 12px;
  background: var(--panel); color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.editor-footer { padding: 8px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

/* Responsive Editor */
@media (max-width: 720px) {
  .editor-panel { width: 100%; }
}

/* Image Panel */
.image-panel {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 36px;
  width: 520px;
  max-width: 100%;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  z-index: 39; /* juste sous l’éditeur */
}
.image-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.image-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.image-actions { display: flex; gap: 8px; }
.image-body { flex: 1; display: flex; padding: 8px; }
.image-container { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--hover); border: 1px solid var(--border); border-radius: 8px; }
.image-container img, .image-container svg { max-width: 100%; max-height: 100%; }
.image-footer { padding: 8px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

@media (max-width: 720px) {
  .image-panel { width: 100%; }
}

/* Video Panel */
.video-panel {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 36px;
  width: 520px;
  max-width: 100%;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  z-index: 39;
}
.video-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.video-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.video-actions { display: flex; gap: 8px; }
.video-body { flex: 1; display: flex; padding: 8px; }
.video-container { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--hover); border: 1px solid var(--border); border-radius: 8px; }
.video-container video { max-width: 100%; max-height: 100%; }
.video-footer { padding: 8px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

@media (max-width: 720px) {
  .video-panel { width: 100%; }
}
/* Login screen */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60; /* au-dessus du boot */
}
.login-card { width: 420px; max-width: calc(100% - 24px); }
.login-logo { display: block; margin: 0 auto 12px; max-width: 120px; max-height: 120px; object-fit: contain; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-desc { color: var(--muted); margin: 8px 0 16px; }
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-row label { font-size: 13px; color: var(--muted); }
.form-row input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0c0f16;
  color: var(--text);
  outline: none;
}
.form-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(96,165,250,0.15); }
.form-actions { display: flex; justify-content: center; margin-top: 8px; }
.form-error { margin-top: 8px; color: #fca5a5; font-size: 13px; }