:root {
  --bg: #08080b;
  --bg-soft: #0f0f14;
  --card: #121218;
  --card-2: #17171f;
  --line: #26262f;
  --line-soft: #1c1c24;
  --text: #f4f4f7;
  --muted: #9a9aae;
  --muted-2: #727284;
  --accent: #ff2d45;
  --accent-soft: rgba(255, 45, 69, 0.14);
  --accent-line: rgba(255, 45, 69, 0.4);
  --green: #35d07f;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
}

* { box-sizing: border-box; }

/* Les attributs hidden doivent gagner contre les display: flex/grid. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(45% 55% at 50% 0%, rgba(255, 45, 69, 0.16), transparent 70%),
    radial-gradient(30% 40% at 80% 10%, rgba(120, 90, 255, 0.08), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.container {
  width: min(1080px, 92vw);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* ---------------- Topbar ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(8, 8, 11, 0.72);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.15rem;
}

.brand-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 8px;
}

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

.nav {
  display: flex;
  gap: 26px;
  font-size: 0.94rem;
  color: var(--muted);
}

.nav a { transition: color 0.18s; position: relative; }
.nav a:hover { color: var(--text); }

body[data-page='convert'] .nav a[data-nav='convert'],
body[data-page='pdf'] .nav a[data-nav='pdf'],
body[data-page='images'] .nav a[data-nav='images'],
body[data-page='autres'] .nav a[data-nav='autres'] {
  color: var(--text);
}

body[data-page='convert'] .nav a[data-nav='convert']::after,
body[data-page='pdf'] .nav a[data-nav='pdf']::after,
body[data-page='images'] .nav a[data-nav='images']::after,
body[data-page='autres'] .nav a[data-nav='autres']::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -21px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* ---------------- Hero ---------------- */

.hero {
  text-align: center;
  padding: 68px 0 38px;
}

.hero h1 {
  font-size: clamp(2rem, 5.2vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin: 0 0 18px;
  font-weight: 900;
}

.hero h1 span {
  color: var(--accent);
  text-shadow: 0 0 40px rgba(255, 45, 69, 0.45);
}

.hero-sub {
  max-width: 640px;
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: 1.03rem;
}

.hero-badges {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.hero-badges li {
  font-size: 0.82rem;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 6px 13px;
  border-radius: 999px;
}

/* Variante compacte pour les pages dédiées */
.hero-sm { padding: 46px 0 26px; }

.hero-sm h1 {
  font-size: clamp(1.8rem, 4.4vw, 2.7rem);
  margin-bottom: 12px;
}

.hero-sm .hero-sub { margin-bottom: 0; font-size: 0.99rem; }

/* ---------------- Card & converter ---------------- */

.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.converter { padding: 26px; }

.dropzone {
  border: 1.6px dashed #32323c;
  border-radius: var(--radius-sm);
  padding: 46px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  background: rgba(255, 255, 255, 0.012);
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  outline: none;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.008);
}

.dropzone-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  color: var(--accent);
}

.dropzone-icon svg { width: 100%; height: 100%; }

.dropzone-title {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 1.06rem;
}

.dropzone-sub {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.9rem;
}

.link { color: var(--accent); font-weight: 600; }

/* Fichier sélectionné */

.file-selected { margin-top: 20px; }

.file-chip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.file-ext {
  flex: 0 0 auto;
  min-width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0 6px;
}

.file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.file-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size { color: var(--muted-2); font-size: 0.83rem; }

.icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 1rem;
  padding: 6px 8px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.convert-controls {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }

.field-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

select, input[type='text'], input[type='number'], input[type='password'] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 0.95rem;
  transition: border-color 0.15s;
  appearance: none;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent-line);
}

select:disabled { color: var(--muted-2); cursor: not-allowed; }

select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a9aae' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

/* Boutons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  border-radius: 10px;
  padding: 11px 20px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.15s, background 0.15s, opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 24px -8px rgba(255, 45, 69, 0.7);
}

.btn-primary:hover:not(:disabled) { background: #ff455a; transform: translateY(-1px); }

.btn-primary:disabled { opacity: 0.42; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.btn-ghost:hover { color: var(--text); border-color: #3a3a46; }

.btn-block { width: 100%; margin-top: 16px; }

.hint {
  margin: 12px 0 0;
  font-size: 0.86rem;
  color: var(--muted-2);
}

.hint.error { color: var(--accent); }

/* ---------------- Panneau de tâche ---------------- */

.job-panel { margin-top: 22px; }

.job-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.job-status-text { color: var(--muted); font-weight: 600; }
.job-percent { color: var(--text); font-variant-numeric: tabular-nums; }

.progress {
  height: 8px;
  border-radius: 999px;
  background: #1c1c24;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #ff6b7d);
  transition: width 0.4s ease;
}

.job-error {
  margin: 12px 0 0;
  padding: 11px 14px;
  background: rgba(255, 45, 69, 0.1);
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  color: #ffb3bd;
  font-size: 0.9rem;
  white-space: pre-line;
}

.job-result {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
  background: rgba(53, 208, 127, 0.07);
  border: 1px solid rgba(53, 208, 127, 0.28);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.result-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(53, 208, 127, 0.16);
  color: var(--green);
}

.result-icon svg { width: 20px; height: 20px; }

.result-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 140px;
}

.result-meta strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}

.result-meta span { color: var(--muted-2); font-size: 0.84rem; }

/* ---------------- Sections ---------------- */

#tools, #faq { padding-top: 72px; }

.section-head { text-align: center; margin-bottom: 30px; }

.section-head h2, .faq h2 {
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  letter-spacing: -0.025em;
  margin: 0 0 8px;
}

.section-head p { color: var(--muted); margin: 0; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.tool-card {
  text-align: left;
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
  cursor: pointer;
  color: inherit;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
  background: linear-gradient(180deg, #16161d, var(--bg-soft));
}

.tool-card:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }

.tool-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 4px;
}

.tool-icon svg { width: 19px; height: 19px; }

.tool-card h3 { margin: 0; font-size: 0.98rem; font-weight: 700; }
.tool-card p { margin: 0; color: var(--muted-2); font-size: 0.85rem; }

/* Grandes cartes de catégorie (accueil) */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.cat-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
}

.cat-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
  background: linear-gradient(180deg, #16161d, var(--bg-soft));
}

.cat-card .tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.cat-card .tool-icon svg { width: 22px; height: 22px; }

.cat-card h3 { margin: 0; font-size: 1.12rem; font-weight: 750; letter-spacing: -0.01em; }

.cat-card p { margin: 0; color: var(--muted); font-size: 0.9rem; flex: 1; }

.cat-more {
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 700;
  margin-top: 4px;
}

.cat-card-static { cursor: default; }
.cat-card-static:hover { transform: none; border-color: var(--line); }

/* ---------------- FAQ ---------------- */

.faq h2 { text-align: center; margin-bottom: 26px; }

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.faq details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}

.faq summary {
  cursor: pointer;
  font-weight: 650;
  list-style: none;
  position: relative;
  padding-right: 22px;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: '+';
  position: absolute;
  right: 0;
  top: -2px;
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 600;
}

.faq details[open] summary::after { content: '−'; }

.faq details p { color: var(--muted); font-size: 0.9rem; margin: 10px 0 0; }

/* ---------------- Footer ---------------- */

.footer {
  margin-top: 84px;
  border-top: 1px solid var(--line-soft);
  padding: 26px 0 34px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.86rem;
  color: var(--muted-2);
}

.footer-credit { color: var(--muted-2); }

.footer-credit a {
  color: var(--muted);
  font-weight: 600;
  transition: color 0.15s;
}

.footer-credit a:hover { color: var(--accent); }

/* ---------------- Modal ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 6, 0.72);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: pop 0.18s ease;
}

@keyframes pop {
  from { transform: translateY(10px) scale(0.985); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 1;
}

.modal-head h3 { margin: 0; font-size: 1.08rem; }

.modal-body { padding: 18px 20px 22px; }

.modal-desc { margin: 0 0 16px; color: var(--muted); font-size: 0.9rem; }

.dropzone-sm { padding: 26px 16px; }

.tool-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.tool-file {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.88rem;
}

.tool-file .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-file .size { color: var(--muted-2); font-size: 0.8rem; }

.tool-fields {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.tool-fields:empty { display: none; }

.tool-fields .field { min-width: 0; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}

.checkbox input { width: auto; accent-color: var(--accent); }

.job-panel-sm { margin-top: 18px; }

/* ---------------- Responsive ---------------- */

@media (max-width: 640px) {
  .hero { padding-top: 44px; }
  .converter { padding: 18px; }
  .dropzone { padding: 34px 14px; }
  .convert-controls { flex-direction: column; align-items: stretch; }
  .convert-controls .btn { width: 100%; }
  .nav { gap: 16px; font-size: 0.88rem; }
  .result-meta strong { max-width: 100%; }
  .job-result .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
