/* ==========================================================================
   QORSEC — /outils/ioc.html : styles propres à l'extracteur d'IOC
   S'appuie sur les jetons de /assets/css/site.css (aucune couleur orange sur un bouton).
   ========================================================================== */

/* ---------- saisie */
.ioc-form textarea#ioc-input {
  font-family: var(--mono); font-size: .9rem; line-height: 1.55;
  min-height: 260px; tab-size: 4; white-space: pre-wrap; overflow-wrap: anywhere;
}
.ioc-form__bar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }
.ioc-file { position: relative; cursor: pointer; }
.ioc-file svg { width: 18px; height: 18px; }
.ioc-file__input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.ioc-file:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.ioc-status { min-height: 1.4em; margin: 10px 0 0; font-size: .9rem; color: var(--fg-muted); }
.ioc-status:empty { min-height: 0; margin: 0; }

.ioc-options { margin: 18px 0 0; padding: 14px 16px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--paper-50); min-width: 0; }
.ioc-options legend { padding: 0 6px; font-weight: 800; font-size: .88rem; color: var(--fg); }
.ioc-options__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
.ioc-options .check { font-size: .93rem; }
.ioc-hint { display: block; font-size: .8rem; color: var(--fg-subtle); font-weight: 500; }
.ioc-excl { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.ioc-excl summary { cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--link); width: fit-content; }
@media (pointer: coarse), (max-width: 760px) { .ioc-excl summary { padding-block: 10px; } }
.ioc-excl summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.ioc-excl .field { margin-top: 12px; }
.ioc-excl textarea { font-family: var(--mono); font-size: .86rem; min-height: 140px; }
.ioc-excl__bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.ioc-excl .field__help { margin: 8px 0 0; }

/* ---------- résultats */
.ioc-head { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.ioc-head h2 { font-size: 1.35rem; margin: 0 0 6px; letter-spacing: -.02em; }
.ioc-summary { margin: 0; color: var(--fg-muted); }
.ioc-refang { margin: 8px 0 0; font-size: .9rem; color: var(--cyan-700); font-weight: 600; }

.ioc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.ioc-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-pill); background: var(--white);
  font: inherit; font-size: .86rem; font-weight: 700; color: var(--fg); cursor: pointer;
}
.ioc-chip:hover { border-color: var(--blue-600); }
.ioc-chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ioc-chip[aria-pressed="true"] { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.ioc-chip__n { font-variant-numeric: tabular-nums; font-size: .78rem; padding: 1px 7px; border-radius: var(--r-pill); background: var(--line-100); color: var(--ink-700); }
.ioc-chip[aria-pressed="true"] .ioc-chip__n { background: rgba(255, 255, 255, .16); color: #fff; }

.ioc-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 12px; margin-bottom: 14px; }

/* Le tableau tient dans la colonne principale (à côté de l'encadré) : chaque ligne est
   une grille — type, indicateur et actions, puis les notes en dessous s'il y en a.
   Les rôles ARIA (table/row/cell/columnheader) conservent la sémantique de tableau. */
.ioc-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ioc-table thead tr, .ioc-table thead th { display: block; width: 1px; height: 1px; overflow: hidden; padding: 0; border: 0; }
.ioc-table, .ioc-table tbody { display: block; width: 100%; }
.ioc-table tbody tr {
  display: grid; grid-template-columns: 116px minmax(0, 1fr) auto;
  grid-template-areas: "type val act" ". notes notes";
  column-gap: 14px; row-gap: 6px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.ioc-table tbody tr:last-child { border-bottom: 0; }
.ioc-table tbody tr:hover { background: rgba(29, 78, 216, .025); }
.ioc-table tbody tr:hover td { background: none; }
.ioc-table td { display: block; padding: 0; border: 0; min-width: 0; }
.ioc-table td:nth-child(1) { grid-area: type; }
.ioc-table td.ioc-val { grid-area: val; }
.ioc-table td.ioc-notes { grid-area: notes; }
.ioc-table td.ioc-notes:empty { display: none; }
.ioc-table td.ioc-actions { grid-area: act; }
.ioc-val code { font-size: .88rem; color: var(--ink-900); word-break: break-all; overflow-wrap: anywhere; background: none; padding: 0; line-height: 1.5; }
.ioc-type {
  display: inline-block; white-space: nowrap; font-size: .74rem; font-weight: 800; letter-spacing: .02em;
  padding: 3px 8px; border-radius: var(--r-xs); background: var(--line-100); color: var(--ink-700);
}
.ioc-type--ipv4, .ioc-type--ipv6, .ioc-type--domain, .ioc-type--url, .ioc-type--email { background: rgba(14, 165, 233, .1); color: var(--cyan-700); }
.ioc-type--md5, .ioc-type--sha1, .ioc-type--sha256, .ioc-type--sha512 { background: rgba(16, 33, 75, .08); color: var(--navy-800); }
.ioc-type--cve, .ioc-type--attack { background: rgba(29, 78, 216, .08); color: var(--blue-700); }
.ioc-notes { min-height: 0; }
.ioc-tag { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: var(--r-pill); font-size: .76rem; font-weight: 700; border: 1px solid var(--border); color: var(--fg-muted); white-space: nowrap; }
.ioc-tag--warn { color: var(--orange-700); border-color: rgba(220, 94, 9, .3); background: rgba(220, 94, 9, .06); }
.ioc-tag--data { color: var(--cyan-700); border-color: rgba(14, 165, 233, .3); background: rgba(14, 165, 233, .06); }
.ioc-table td.ioc-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.ioc-icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--white); color: var(--ink-700); cursor: pointer;
}
.ioc-icon-btn svg { width: 16px; height: 16px; }
.ioc-icon-btn:hover { border-color: var(--blue-600); color: var(--blue-600); }
.ioc-icon-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ioc-icon-btn.is-ok { border-color: var(--green-700); color: var(--green-700); background: #ecf9f0; }
.ioc-icon-btn.is-ko { border-color: var(--red-700); color: var(--red-700); }
.ioc-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; min-height: 34px; white-space: nowrap;
  border-radius: var(--r-sm); border: 1px solid var(--border); font-size: .8rem; font-weight: 700; color: var(--link); text-decoration: none;
}
.ioc-link svg { width: 13px; height: 13px; }
.ioc-link:hover { border-color: var(--blue-600); background: rgba(29, 78, 216, .04); }
.ioc-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ioc-nolink { font-size: .78rem; color: var(--fg-subtle); }
.ioc-none { margin: 8px 0; padding: 24px 16px; text-align: center; color: var(--fg-muted); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); }
.ioc-more-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 10px; }
.ioc-more-bar .ioc-hint { display: inline; }

.ioc-exports { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.ioc-exports__title { font-size: 1rem; margin: 0; }
.ioc-exports .tool-results__actions { margin-top: 12px; }
.ioc-exports .ioc-hint { margin: 10px 0 0; }
.ioc-export-status { margin: 6px 0 0; font-size: .88rem; color: var(--cyan-700); font-weight: 600; }
.ioc-export-status:empty { display: none; }
#btn-copy:disabled, [data-export]:disabled { opacity: .5; cursor: not-allowed; }

.ioc-rejected { margin-top: 18px; padding: 12px 16px; border-radius: var(--r-md); background: var(--paper-50); border: 1px solid var(--border); }
.ioc-rejected summary { cursor: pointer; font-weight: 700; font-size: .92rem; }
.ioc-rejected summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.ioc-rejected ul { margin: 8px 0 0; padding-left: 1.1em; font-size: .88rem; color: var(--fg-muted); }
.ioc-rejected code { word-break: break-all; color: var(--ink-900); }
.ioc-rejected .ioc-hint { margin-top: 8px; }

/* ---------- section méthode */
.ioc-method th[scope="row"] { white-space: nowrap; font-weight: 800; color: var(--fg); text-transform: none; letter-spacing: 0; font-size: .93rem; background: none; }
.ioc-method td:last-child { white-space: nowrap; color: var(--fg-muted); }
.ioc-method-cards .card p { font-size: .95rem; }

@media (prefers-reduced-motion: no-preference) {
  .ioc-chip, .ioc-icon-btn, .ioc-link { transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
}

/* ---------- petits écrans : le tableau devient une liste de cartes */
@media (max-width: 720px) {
  .ioc-options__grid { grid-template-columns: minmax(0, 1fr); }
  .ioc-toolbar { grid-template-columns: minmax(0, 1fr); }
  .ioc-table-wrap { border: 0; background: none; overflow: visible; }
  .ioc-table tbody tr {
    grid-template-columns: minmax(0, 1fr); grid-template-areas: "type" "val" "notes" "act";
    margin-bottom: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--white);
  }
  .ioc-table tbody tr:last-child { border-bottom: 1px solid var(--border); }
  .ioc-table td.ioc-notes:empty { display: none; }
  .ioc-table td.ioc-actions { justify-content: flex-start; padding-top: 4px; }
  /* tableau « Méthode » : une carte par type, sans défilement horizontal */
  .ioc-method thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ioc-method thead tr, .ioc-method thead th { display: block; width: 1px; height: 1px; overflow: hidden; padding: 0; border: 0; }
  .ioc-method { display: flex; flex-direction: column; width: 100%; }
  .ioc-method caption { display: block; order: 2; width: auto; border-top: 1px solid var(--border); }
  .ioc-method tbody, .ioc-method tr, .ioc-method th[scope="row"], .ioc-method td { display: block; width: 100%; }
  .ioc-method tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .ioc-method tbody tr:last-child { border-bottom: 0; }
  .ioc-method th[scope="row"], .ioc-method td { padding: 0; border: 0; white-space: normal; }
  .ioc-method th[scope="row"] { margin-bottom: 4px; font-size: 1rem; }
  .ioc-method td:last-child { margin-top: 6px; font-size: .88rem; color: var(--fg-muted); }
  .ioc-method td:last-child::before { content: "Recherche : "; font-weight: 700; color: var(--fg-subtle); }
  html[lang="en"] .ioc-method td:last-child::before { content: "Lookup: "; }
  .ioc-method tbody tr:hover td { background: none; }
  .ioc-form textarea#ioc-input { min-height: 200px; }
}

/* ---------- impression */
@media print {
  .ioc-chips, .ioc-toolbar, .ioc-more-bar, .ioc-exports, .ioc-rejected, .ioc-actions, .ioc-table th:last-child { display: none !important; }
  .ioc-table { display: table; }
  .ioc-table thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; display: table-header-group; }
  .ioc-table thead tr { display: table-row; width: auto; height: auto; overflow: visible; }
  .ioc-table thead th { display: table-cell; width: auto; height: auto; overflow: visible; padding: 5pt 6pt; border-bottom: 1px solid #999; }
  .ioc-table td.ioc-notes:empty { display: table-cell; }
  .ioc-table tbody { display: table-row-group; }
  .ioc-table tbody tr { display: table-row; }
  .ioc-table td, .ioc-table th { display: table-cell; padding: 5pt 6pt; border-bottom: 1px solid #ccc; }
  .ioc-val code { font-size: 8.5pt; }
  .ioc-tag { border-color: #999; color: #333; background: none; }
  .ioc-type { background: none; color: #000; border: 1px solid #999; }
  #methode, .cta-final, .tool-main > .tool-panel, .section--paper.section--tight[aria-labelledby="related-title"] { display: none !important; }
}
