/*
  Security Warnings – PROD UI (hlukh.ch)
  - Progressive enhancement: SSR first, JS upgrades search/filters/pagination
  - CSP-safe (external file)
*/

:root{
  --sw-max: 1140px;
  --sw-pad: 16px;
  --sw-gap: 12px;
  --sw-radius: 18px;
  --sw-border: rgba(0,0,0,.08);
  --sw-muted: rgba(0,0,0,.62);
  --sw-surface: rgba(255,255,255,.82);
  --sw-surface-strong: rgba(255,255,255,.92);
  --sw-shadow: 0 12px 28px rgba(0,0,0,.06);
}

/* a11y */
.skip-link{
  position:absolute;
  left:-9999px;
  top:auto;
  width:1px;
  height:1px;
  overflow:hidden;
}
.skip-link:focus{
  left:12px;
  top:12px;
  width:auto;
  height:auto;
  padding:10px 12px;
  border-radius:12px;
  background:#fff;
  border:1px solid var(--sw-border);
  z-index:9999;
}

.sw-wrap{
  max-width: var(--sw-max);
  margin: 0 auto;
  padding: 0 var(--sw-pad);
}

/* Header is a real <header>, but we want a page header that matches hlukh.ch */
.sw-header{
  text-align: left;
  background: transparent;
  border-bottom: 0;
  padding: 28px 0 10px;
}

.sw-topline{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sw-home{
  font-weight: 800;
  text-decoration: none;
  color: inherit;
}

.sw-meta{
  color: var(--sw-muted);
  font-size: 13px;
}

.sw-lang{
  display:flex;
  gap: 8px;
  align-items:center;
}

.sw-lang a{
  text-decoration:none;
  color: var(--sw-muted);
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--sw-border);
  border-radius: 999px;
  background: rgba(255,255,255,.35);
}

.sw-lang a[aria-current="page"]{
  color: #111827;
  font-weight: 700;
  background: rgba(255,255,255,.65);
}

.sw-facet{
  display:inline-flex;
  align-items:center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--sw-border);
  background: rgba(255,255,255,.55);
  font-size: 12px;
}

.sw-lead{
  margin: 6px 0 0;
  color: var(--sw-muted);
  max-width: 70ch;
}

.sw-stats{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sw-gap);
  margin: 16px 0 12px;
}

.sw-stat{
  background: var(--sw-surface);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  padding: 14px 14px;
  box-shadow: var(--sw-shadow);
}

.sw-stat-link{
  display:block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.sw-stat-link:hover{
  transform: translateY(-1px);
}

.sw-stat-link:focus-visible{
  outline: 3px solid var(--sw-border);
  outline-offset: 3px;
}

.sw-stat-k{
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

.sw-stat-l{
  margin-top: 6px;
  font-size: 12px;
  color: var(--sw-muted);
}

.sw-actions{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-top: 10px;
}

.sw-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--sw-border);
  background: var(--sw-surface-strong);
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.sw-btn:hover{
  background: rgba(255,255,255,.98);
}

.sw-btn:focus{
  outline: none;
  box-shadow: 0 0 0 4px rgba(59,130,246,.25);
}

.sw-btn-ghost{
  background: transparent;
}

/* Main */
.sw-main{
  padding: 10px 0 40px;
}

.sw-controls{
  background: var(--sw-surface);
  border: 1px solid var(--sw-border);
  border-radius: calc(var(--sw-radius) + 2px);
  box-shadow: var(--sw-shadow);
  padding: 14px;
  display:grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
}

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

.sw-field > span{
  font-size: 12px;
  color: var(--sw-muted);
}

.sw-field input,
.sw-field select{
  width:100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  font: inherit;
}

.sw-field input:focus,
.sw-field select:focus{
  outline: none;
  box-shadow: 0 0 0 4px rgba(59,130,246,.25);
}

/* Table card */
.sw-table-wrap{
  margin-top: 14px;
  background: var(--sw-surface);
  border: 1px solid var(--sw-border);
  border-radius: calc(var(--sw-radius) + 2px);
  box-shadow: var(--sw-shadow);
}

.sw-table-head{
  padding: 14px 14px 10px;
  display:flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.sw-table-title{
  font-weight: 800;
}

.sw-table-note{
  color: var(--sw-muted);
  font-size: 12px;
}

.sw-scroll{
  overflow:auto;
  border-radius: 0 0 calc(var(--sw-radius) + 2px) calc(var(--sw-radius) + 2px);
}

.sw-table{
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}

.sw-table th,
.sw-table td{
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.sw-table th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px);
  font-weight: 800;
}

.sw-col-num{
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sw-cvss, .sw-epss{
  color: rgba(0,0,0,.78);
}

.sw-title-main{
  font-weight: 700;
}

.sw-title-sub{
  margin-top: 4px;
  color: var(--sw-muted);
  font-size: 13px;
}

.sw-source-link a{
  font-weight: 700;
  text-decoration: none;
}

/* Severity chips */
.sw-sev span{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.sw-sev-critical span{ background:#ffe3e3; }
.sw-sev-high span{ background:#fff1da; }
.sw-sev-medium span{ background:#fff9d6; }
.sw-sev-low span{ background:#e9ffe9; }
.sw-sev-unknown span{ background:#f3f4f6; }

/* Pager */
.sw-pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 14px;
}

.sw-pg{
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--sw-border);
  background: var(--sw-surface-strong);
  cursor: pointer;
  font-weight: 700;
}

.sw-pg[disabled]{
  opacity: .5;
  cursor: not-allowed;
}

.sw-pg:hover:not([disabled]){
  background: rgba(255,255,255,.98);
}

.sw-pg-info{
  color: var(--sw-muted);
  font-size: 13px;
}

/* Footer note */
.sw-footer-note{
  margin-top: 18px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--sw-radius);
  padding: 14px;
}

.sw-footer-note h2{
  margin: 0 0 6px;
  font-size: 16px;
}

.sw-footer-note p{
  margin: 6px 0 0;
  color: var(--sw-muted);
}

/* Responsive */
@media (max-width: 980px){
  .sw-stats{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sw-controls{ grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px){
  .sw-controls{ grid-template-columns: 1fr; }
  .sw-table-note{ display:none; }
  .sw-pager{ flex-wrap: wrap; justify-content: center; }
}


/* Compact link column (tap-friendly) */
.sw-col-link {
  width: 44px;
  text-align: center;
  white-space: nowrap;
}
.sw-link {
  display: inline-block;
  padding: 10px 8px;
  text-decoration: none;
  font-weight: 700;
}


/* Date column: keep on one line */

.sw-severity{ width: 120px; white-space: nowrap; text-align: right; }
.sw-date{
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  font-variant-numeric: tabular-nums;
}

/* --- v11.5: compact columns + Identifier link (mobile-first) --- */
.sw-table{
  min-width: 0;
}

.sw-col-id{
  width: 220px;
  min-width: 180px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sw-id-wrap{
  display:flex;
  align-items:center;
  gap: 10px;
}

.sw-id-link{
  font-weight: 800;
  text-decoration: none;
}

.sw-id-link:hover{
  text-decoration: underline;
}

.sw-sev-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

/* reuse existing severity colors */
.sw-sev-critical{ background:#ffe3e3; }
.sw-sev-high{ background:#fff1da; }
.sw-sev-medium{ background:#fff9d6; }
.sw-sev-low{ background:#e9ffe9; }
.sw-sev-unknown{ background:#f3f4f6; }

@media (max-width: 640px){
  .sw-table{ min-width: 0; }
  .sw-col-id{ width: auto; min-width: 0; }
  .sw-id-link{
    display:inline-block;
    max-width: 46vw;
    overflow:hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
  }
  .sw-id-wrap{ gap: 8px; }
  .sw-sev-chip{ padding: 3px 7px; font-size: 11px; }
}


/* --- responsive: keep title visible on mobile; show meta line instead of extra columns --- */
.sw-meta-mobile{
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: rgba(0,0,0,.62);
}
.sw-meta-mobile .sw-meta-id .sw-sev-chip{ margin-left: 8px; }

@media (max-width: 640px){
  /* Mobile = card/list view: table header is noisy + breaks alignment */
  .sw-table thead{ display:none; }

  /* Hide columns that cause horizontal scroll; show meta inside title */
  .sw-source, .sw-date, .sw-col-id{ display: none; }
  .sw-meta-mobile{ display: block; }

  .sw-row-click{ cursor: pointer; }
  .sw-row-click:active{ background: rgba(0,0,0,0.03); }

  .sw-table th, .sw-table td{ padding: 12px 12px; }
  .sw-title-main{ font-size: 14px; }
  .sw-table{ min-width: 0; }
}

/* --- v11.5.6: keep date + identifier on ONE compact line on mobile --- */
@media (max-width: 640px){
  .sw-meta-mobile{
    display:flex;
    align-items:center;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .sw-meta-date{ flex: 0 0 auto; }
  .sw-meta-sep{ flex: 0 0 auto; }
  .sw-meta-id{ min-width: 0; }

  /* Override the generic id-link clamp (46vw) so it ellipsizes within the title cell */
  .sw-meta-id .sw-id-link{
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: bottom;
  }
}
