/* ============================================================
   Impressions 3D QC — Feuille de style commune
   Palette : Plateau #101319 · Acier #171B23 · Filament #FF6B1A
             Ambre #FFB25E · Vert statut #43D9A3
   Typo    : Chakra Petch (titres) · IBM Plex Sans (texte)
             IBM Plex Mono (IDs, badges, étiquettes G-code)
   ============================================================ */

:root {
  --bg: #101319;
  --panel: #171b23;
  --panel-2: #1d2230;
  --line: #2a3040;
  --text: #edeae3;
  --muted: #98a0ad;
  --accent: #ff6b1a;
  --accent-soft: #ffb25e;
  --ok: #43d9a3;
  --danger: #ff5d5d;
  --radius: 8px;
  --font-display: "Chakra Petch", sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 14px;
  letter-spacing: 0.01em;
}
h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
p  { margin: 0 0 14px; }
a  { color: var(--accent-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }

/* --- Texture « lignes de couches » (signature) --------------- */
.layerlines {
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 107, 26, 0.05) 0px,
    rgba(255, 107, 26, 0.05) 1px,
    transparent 1px,
    transparent 7px
  );
}

/* --- Étiquette style commentaire G-code ---------------------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* --- Navigation ---------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(16, 19, 25, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--text);
}
.nav-logo b { color: var(--accent); font-weight: 700; }
.nav-logo:hover { text-decoration: none; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.nav-links > a:not(.btn) {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-links > a:not(.btn):hover { color: var(--text); text-decoration: none; }
.nav-links > a.active { color: var(--text); }

/* --- Boutons -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  padding: 10px 20px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter 0.15s, background 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #131313; }
.btn-ok { background: var(--ok); color: #0d201a; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--accent-soft); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

/* --- Héros ----------------------------------------------------- */
.hero { padding: 84px 0 72px; border-bottom: 1px solid var(--line); }
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}
.hero h1 .hl { color: var(--accent); }
.hero-sub { color: var(--muted); font-size: 1.08rem; max-width: 46ch; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 26px; }

/* --- Carte « impression en cours » (signature du héros) ------- */
.print-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.pc-head, .pc-foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 10px 16px;
}
.pc-head { border-bottom: 1px solid var(--line); }
.pc-foot { border-top: 1px solid var(--line); }
.pc-live { color: var(--ok); }
.pc-body {
  padding: 26px 16px;
  display: flex;
  justify-content: center;
  background:
    repeating-linear-gradient(to bottom,
      rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 8px);
}
.pc-layers {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 4px;
  width: 200px;
}
.pc-layers span {
  display: block;
  height: 9px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  width: calc(38% + var(--w) * 1%);
  opacity: 0.14;
  animation: pc-fill 7s linear infinite;
  animation-delay: calc(var(--i) * 0.45s);
}
@keyframes pc-fill {
  0% { opacity: 0.14; }
  6% { opacity: 1; }
  82% { opacity: 1; }
  95%, 100% { opacity: 0.14; }
}
@media (prefers-reduced-motion: reduce) {
  .pc-layers span { animation: none; opacity: 0.9; }
}

/* --- Étapes ----------------------------------------------------- */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.step-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.step-num {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  display: block;
  margin-bottom: 10px;
}
.step-card p { color: var(--muted); font-size: 0.93rem; margin: 0; }

/* --- Bandeau Québec --------------------------------------------- */
.band {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 34px 0;
}
.band-title {
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.18em;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.band p { color: var(--muted); margin: 0; max-width: 70ch; }

/* --- FAQ ---------------------------------------------------------- */
.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 0 18px;
  margin-bottom: 10px;
}
.faq summary {
  cursor: pointer;
  padding: 15px 0;
  font-family: var(--font-display);
  font-weight: 600;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "+";
  color: var(--accent);
  font-family: var(--font-mono);
  margin-right: 12px;
}
.faq details[open] summary::before { content: "–"; }
.faq details p { color: var(--muted); padding-bottom: 16px; margin: 0; }

/* --- Cartes / formulaires ------------------------------------------ */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}
.card + .card { margin-top: 18px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 13px;
  font-family: var(--font-body);
  font-size: 1rem;
}
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.95rem;
  color: var(--muted);
  margin: 18px 0;
}
.check input { margin-top: 4px; accent-color: var(--accent); }

.alert, .notice, .successbox {
  border-radius: 6px;
  padding: 12px 15px;
  font-size: 0.95rem;
  margin: 14px 0;
}
.alert {
  background: rgba(255, 93, 93, 0.1);
  border: 1px solid rgba(255, 93, 93, 0.45);
  color: #ffb3b3;
}
.notice {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-soft);
  color: var(--muted);
}
.successbox {
  background: rgba(67, 217, 163, 0.1);
  border: 1px solid rgba(67, 217, 163, 0.4);
  color: #a9f0d8;
}

/* --- Badges de statut ----------------------------------------------- */
.badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 4px;
  white-space: nowrap;
}
.b-open   { background: rgba(255, 178, 94, 0.14); color: var(--accent-soft); border: 1px solid rgba(255, 178, 94, 0.4); }
.b-active { background: rgba(255, 107, 26, 0.14); color: var(--accent);      border: 1px solid rgba(255, 107, 26, 0.45); }
.b-done   { background: rgba(67, 217, 163, 0.12); color: var(--ok);          border: 1px solid rgba(67, 217, 163, 0.4); }

/* --- Listes de tickets ------------------------------------------------ */
.ticket-row {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 18px;
  margin-bottom: 10px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color 0.15s, background 0.15s;
}
.ticket-row:hover { border-color: var(--accent); background: var(--panel-2); }
.tr-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.tr-id { font-family: var(--font-mono); color: var(--accent-soft); font-size: 0.9rem; }
.tr-date { margin-left: auto; color: var(--muted); font-size: 0.82rem; }
.tr-preview {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Détail d'un ticket ------------------------------------------------ */
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.detail-head-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 6px 14px;
  font-size: 0.95rem;
}
.kv dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.kv dd { margin: 0; overflow-wrap: anywhere; }

.thread { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.msg {
  max-width: 82%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  align-self: flex-start;
}
.msg.mine {
  align-self: flex-end;
  background: #2b1c0f;
  border-color: #4a2d14;
}
.msg-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.96rem; }

.reply-row { display: flex; gap: 10px; align-items: flex-end; }
.reply-row textarea {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 13px;
  font-family: var(--font-body);
  font-size: 1rem;
  min-height: 52px;
  resize: vertical;
}
.reply-row textarea:focus { outline: none; border-color: var(--accent); }

.payment-note {
  border: 1px dashed var(--accent-soft);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 15px 18px;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 16px 0;
}
.payment-note strong { color: var(--accent-soft); }

/* --- Onglets (admin + commandes) -------------------------------------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 14px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-soft);
  margin-left: 6px;
}

/* --- Divers ------------------------------------------------------------- */
.page-head { padding: 40px 0 8px; }
.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
}
.footer {
  border-top: 1px solid var(--line);
  padding: 30px 0 40px;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer a { color: var(--accent-soft); }

#server-hint {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(8px);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  max-width: 92vw;
  z-index: 100;
}
#server-hint.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spin { animation-duration: 2s; }
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .msg { max-width: 95%; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
}
