/* =============================================================
   Log Simplifier — style.css
   ============================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Courier New", monospace;
  background: #0a0e1a;
  color: #c9d1e0;
  min-height: 100vh;
  padding: 1.5rem;
}

/* -- titres globaux */
h1 {
  font-family: system-ui, sans-serif;
  font-size: 20px;
  font-weight: 500;
  color: #e2e8f0;
  margin-bottom: 4px;
}

.sub {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 1.5rem;
  font-family: system-ui, sans-serif;
}

/* =============================================================
   Drop zone
   ============================================================= */

.drop-zone {
  border: 1.5px dashed #2d3748;
  border-radius: 10px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #111827;
  margin-bottom: 1.25rem;
}

.drop-zone:hover,
.drop-zone.drag { border-color: #019ee0; background: #0c1726; }

.drop-zone svg { display: block; margin: 0 auto 12px; opacity: .5; }

.drop-label { font-size: 14px; color: #94a3b8; font-family: system-ui, sans-serif; }
.drop-label span { color: #019ee0; }

/* =============================================================
   Stats
   ============================================================= */

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 1rem; }

.stat-card { background: #111827; border-radius: 8px; padding: 10px 16px; min-width: 90px; }
.stat-val  { font-size: 22px; font-weight: 500; color: #e2e8f0; }
.stat-label { font-size: 12px; color: #64748b; margin-top: 2px; font-family: system-ui, sans-serif; }

/* =============================================================
   Toolbar
   ============================================================= */

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 1rem;
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; }

.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  user-select: none;
}

.badge.active { border-color: currentColor; }

.badge-fatal      { background: #2d0a0a; color: #f87171; }
.badge-fatal.active { background: #3d0f0f; }
.badge-warning    { background: #1a1a2e; color: #a78bfa; }
.badge-warning.active { background: #22204a; }
.badge-notice     { background: #0d2137; color: #38bdf8; }
.badge-notice.active { background: #0f2d47; }
.badge-other      { background: #1a1f2e; color: #94a3b8; }
.badge-other.active { background: #212638; }
.badge-deprecated { background: #2d1f0a; color: #f59e0b; }
.badge-deprecated.active { background: #3d2a0e; }

.search-row { display: flex; gap: 8px; align-items: center; }

.search-input {
  flex: 1;
  background: #111827;
  border: 1px solid #2d3748;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 13px;
  color: #c9d1e0;
  font-family: "Courier New", monospace;
  transition: border-color .2s;
}

.search-input::placeholder { color: #475569; }
.search-input:focus { outline: none; border-color: #019ee0; }

.search-count {
  font-size: 12px;
  color: #475569;
  font-family: system-ui, sans-serif;
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

.btn-ia {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid #019ee0;
  background: transparent;
  color: #019ee0;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, opacity .15s;
}

.btn-ia:hover { background: #0c1726; }
.btn-ia:disabled { opacity: .4; cursor: not-allowed; }
.btn-ia.already-done { border-color: #475569; color: #475569; cursor: not-allowed; }

/* =============================================================
   Liste de logs
   ============================================================= */

#log-container { display: flex; flex-direction: column; gap: 6px; }

.log-entry {
  background: #111827;
  border-radius: 7px;
  border-left: 3px solid #2d3748;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.6;
}

.log-entry.fatal      { border-color: #f87171; }
.log-entry.warning    { border-color: #a78bfa; }
.log-entry.notice     { border-color: #38bdf8; }
.log-entry.other      { border-color: #475569; }
.log-entry.deprecated { border-color: #f59e0b; }
.log-entry.highlight  { outline: 1px solid #019ee030; background: #0d1e30; }

.log-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }

.log-type-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.log-count {
  font-size: 11px;
  background: #1e293b;
  color: #64748b;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}

.log-date { font-size: 11px; color: #475569; }

.log-msg { color: #cbd5e1; word-break: break-word; }

.log-msg mark {
  background: #019ee030;
  color: #38bdf8;
  border-radius: 3px;
  padding: 0 2px;
}

.log-file { font-size: 11px; color: #475569; margin-top: 4px; }
.log-file span { color: #38bdf8; }

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #475569;
  font-family: system-ui, sans-serif;
  font-size: 14px;
}

/* =============================================================
   Bulle flottante (bas droite)
   ============================================================= */

#analyses-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
}

#analyses-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #019ee0;
  border: none;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px #019ee040;
  transition: transform .15s, background .15s;
  position: relative;
}

#analyses-toggle:hover { transform: scale(1.06); background: #0180b8; }

#analyses-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e2017a;
  color: #fff;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* =============================================================
   Panneau latéral droit
   ============================================================= */

#side-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #00000060;
  z-index: 110;
  transition: opacity .2s;
}

#side-overlay.visible { display: block; }

#side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 650px;
  max-width: 100vw;
  height: 100vh;
  background: #0d1526;
  border-left: 1px solid #1e293b;
  z-index: 120;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
}

#side-panel.open { transform: translateX(0); }

#side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}

#side-panel-title {
  font-family: system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #e2e8f0;
}

#side-panel-close {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color .15s;
  display: flex;
}

#side-panel-close:hover { color: #e2e8f0; }

/* -- liste des analyses dans le panneau */
#side-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analysis-card {
  background: #111827;
  border-radius: 8px;
  border: 1px solid #1e293b;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-family: system-ui, sans-serif;
}

.analysis-card:hover { border-color: #019ee0; background: #0d1e30; }

.analysis-card-context {
  font-size: 12px;
  color: #019ee0;
  font-family: "Courier New", monospace;
  margin-bottom: 4px;
  word-break: break-word;
}

.analysis-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.analysis-card-label {
  font-size: 12px;
  color: #64748b;
}

.analysis-card-time {
  font-size: 11px;
  color: #475569;
  white-space: nowrap;
}

/* -- contenu d'une analyse sélectionnée */
#side-panel-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#side-panel-back {
  background: transparent;
  border: none;
  color: #019ee0;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  cursor: pointer;
  padding: 14px 20px 10px;
  text-align: left;
  transition: color .15s;
  flex-shrink: 0;
}

#side-panel-back:hover { color: #38bdf8; }

#side-panel-content-inner {
  padding: 0 20px 20px;
  flex: 1;
}

/* -- onglets technique / simple dans le panneau */
.analysis-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.analysis-tab {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #2d3748;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all .15s;
}

.analysis-tab.active { border-color: #019ee0; color: #019ee0; background: #0c1726; }
.analysis-tab.simple.active { border-color: #e2017a; color: #e2017a; background: #1a0010; }

.analysis-tab-panel { display: none; }
.analysis-tab-panel.active { display: block; }

.btn-copy-panel {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid #2d3748;
  background: transparent;
  color: #64748b;
  transition: all .15s;
  margin-bottom: 10px;
}

.btn-copy-panel:hover { border-color: #019ee0; color: #019ee0; }
.btn-copy-panel.copied { border-color: #22c55e; color: #22c55e; }

.btn-gen-simple {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid #e2017a40;
  background: transparent;
  color: #e2017a;
  cursor: pointer;
  transition: background .15s;
  margin-bottom: 12px;
}

.btn-gen-simple:hover { background: #1a0010; }
.btn-gen-simple:disabled { opacity: .4; cursor: not-allowed; }

.btn-deepen {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid #019ee040;
  background: transparent;
  color: #019ee0;
  transition: all .15s;
  white-space: nowrap;
}

.btn-deepen:hover { background: #0c1726; }
.btn-deepen:disabled { opacity: .4; cursor: not-allowed; }

/* =============================================================
   Animation d'attente
   ============================================================= */

.loader-wrap { padding: 16px 0 8px; }

.loader-bar {
  width: 100%;
  height: 2px;
  background: #1e293b;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

.loader-bar-inner {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, transparent, #019ee0, transparent);
  animation: loader-slide 1.4s ease-in-out infinite;
}

.loader-bar-inner.pink {
  background: linear-gradient(90deg, transparent, #e2017a, transparent);
}

@keyframes loader-slide {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(500%); }
}

.loader-text {
  font-family: "Courier New", monospace;
  color: #019ee050;
  font-size: 11px;
  letter-spacing: .04em;
  min-height: 16px;
}

.loader-text.pink { color: #e2017a50; }

/* =============================================================
   Contenu Markdown (dans le panneau)
   ============================================================= */

.md-content {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.8;
  color: #94a3b8;
}

.md-content h1,
.md-content h2,
.md-content h3,
.md-content h4 {
  font-family: system-ui, sans-serif;
  color: #e2e8f0;
  margin: 1.1em 0 .4em;
  font-weight: 500;
  line-height: 1.3;
}

.md-content h1 { font-size: 16px; }
.md-content h2 { font-size: 15px; color: #cbd5e1; }
.md-content h3 { font-size: 14px; color: #94a3b8; }
.md-content h4 { font-size: 13px; color: #64748b; }

.md-content strong { color: #cbd5e1; font-weight: 600; }
.md-content em     { font-style: italic; }

.md-content code {
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 11px;
  color: #38bdf8;
}

.md-content pre {
  background: #0a111e;
  border: 1px solid #1e293b;
  border-radius: 7px;
  padding: 12px 14px;
  margin: .8em 0;
  overflow-x: auto;
}

.md-content pre code {
  background: none;
  padding: 0;
  font-size: 12px;
  color: #a5f3fc;
  white-space: pre;
}

.md-content ul,
.md-content ol { padding-left: 1.4em; margin: .5em 0; }
.md-content li  { margin: .25em 0; }

.md-content hr {
  border: none;
  border-top: 1px solid #1e293b;
  margin: 1em 0;
}

.md-content p { margin: .5em 0; }

/* =============================================================
   Responsive
   ============================================================= */

@media (min-width: 1000px) {
  body { padding: 2rem 3rem; }
  .toolbar { flex-direction: row; align-items: flex-start; }
  .filters { flex: 1; }
  .search-row { flex: 1; }
}

@media (max-width: 480px) {
  #side-panel { width: 100vw; }
}
