/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:       #0f0f0f;
  --surface:  #181818;
  --border:   #2a2a2a;
  --border2:  #333;
  --text:     #e8e8e8;
  --muted:    #555;
  --accent:   #d4ff00;   /* vert-jaune vif */
  --bd-color: #4fc3f7;
  --zine-color: #ff8a65;
  --livre-color: #a5d6a7;
  --error:    #ff5252;
  --success:  #69f0ae;
  --radius:   2px;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'IBM Plex Sans', sans-serif;
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── Header ────────────────────────────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 52px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  width: 100%;
}
.logo {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--text);
}
.logo em {
  font-style: normal;
  color: var(--accent);
}
nav a {
  font-family: var(--mono);
  font-size: .8rem;
  letter-spacing: .08em;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  transition: color .15s;
}
nav a.active, nav a:hover { color: var(--accent); }

/* ─── Flash messages ────────────────────────────────────────────────────── */
.flash {
  font-family: var(--mono);
  font-size: .8rem;
  padding: .6rem 2rem;
  border-bottom: 1px solid var(--border);
}
.flash--success { background: #0a1f0f; color: var(--success); }
.flash--error   { background: #1f0a0a; color: var(--error); }

/* ─── Layout ────────────────────────────────────────────────────────────── */
main { padding: 2rem; }
.page-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 800px) {
  .page-grid { grid-template-columns: 1fr; }
}

/* ─── Panel headers ─────────────────────────────────────────────────────── */
.panel-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.panel-header h2 {
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.badge {
  font-family: var(--mono);
  font-size: .7rem;
  background: var(--accent);
  color: #000;
  padding: .1em .4em;
  border-radius: var(--radius);
}

/* ─── File list ─────────────────────────────────────────────────────────── */
.file-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }

.file-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: border-color .15s;
}
.file-item:hover { border-color: var(--border2); }

.file-name {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-icon { font-size: 1rem; flex-shrink: 0; }

/* ─── Type tabs ─────────────────────────────────────────────────────────── */
.type-tabs {
  display: flex;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
}
.tab-btn {
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  padding: .3em .9em;
  background: var(--surface);
  color: var(--muted);
  border: none;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.tab-btn:hover { background: var(--border2); color: var(--text); }
.tab-btn.active[data-type="bd"]    { background: var(--bd-color);    color: #000; }
.tab-btn.active[data-type="zine"]  { background: var(--zine-color);  color: #000; }
.tab-btn.active[data-type="livre"] { background: var(--livre-color);  color: #000; }

/* ─── Form fields ───────────────────────────────────────────────────────── */
.form-fields {
  display: flex;
  align-items: flex-end;
  gap: .75rem;
  flex-wrap: wrap;
}
.fields { display: none; align-items: flex-end; gap: .75rem; flex-wrap: wrap; }
.fields.active { display: flex; }

.field-group {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  position: relative;
  flex: 1;
  min-width: 120px;
}
.field-group.field-small { flex: 0 0 80px; min-width: 60px; }

label {
  font-family: var(--mono);
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: .8rem;
  padding: .4em .6em;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}
input[type="text"]:focus { border-color: var(--accent); }
input[type="text"]::placeholder { color: var(--muted); }

/* ─── Autocomplete ──────────────────────────────────────────────────────── */
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: #1e1e1e;
  border: 1px solid var(--border2);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  list-style: none;
  z-index: 50;
  max-height: 160px;
  overflow-y: auto;
  display: none;
}
.autocomplete-list.open { display: block; }
.autocomplete-list li {
  font-family: var(--mono);
  font-size: .78rem;
  padding: .35em .6em;
  cursor: pointer;
  color: var(--text);
  transition: background .1s;
}
.autocomplete-list li:hover { background: var(--border2); }

/* ─── Submit button ─────────────────────────────────────────────────────── */
.btn-classify {
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  padding: .42em 1.1em;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
  align-self: flex-end;
}
.btn-classify:hover { opacity: .85; }

/* ─── Empty state ───────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
}
.empty-state code {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--accent);
  opacity: .7;
}

/* ─── History panel ─────────────────────────────────────────────────────── */
.history-panel { position: sticky; top: 72px; align-self: start; }
.history-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.history-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.history-type {
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .08em;
  padding: .15em .4em;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.history-type--bd    { background: var(--bd-color);    color: #000; }
.history-type--zine  { background: var(--zine-color);  color: #000; }
.history-type--livre { background: var(--livre-color); color: #000; }

.history-path {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.muted { color: var(--muted); font-size: .8rem; padding: .5rem 0; }
