/* ─────────────────────────────────────────────────────────────────────────
   CySA+ Tools Matrix — styles
   Loaded only on tool_matrix.html and tool_detail.html
   ───────────────────────────────────────────────────────────────────────── */

.tools-hero {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}
.tools-hero h1 {
    color: var(--accent);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.tools-hero p { color: var(--text-muted); margin: 0; }

.tools-rationale {
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}
.tools-rationale > summary {
    cursor: pointer;
    padding: 0.6rem 1rem;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    list-style: none;
    user-select: none;
}
.tools-rationale > summary::-webkit-details-marker { display: none; }
.tools-rationale > summary::before {
    content: "▸ ";
    display: inline-block;
    transition: transform 0.15s ease;
}
.tools-rationale[open] > summary::before { content: "▾ "; }
.tools-rationale > summary:hover { color: var(--text-primary); }
.tools-rationale-body {
    padding: 0.25rem 1rem 0.85rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}
.tools-rationale-body p { margin: 0 0 0.6rem; }
.tools-rationale-body p:last-child { margin-bottom: 0; }
.tools-rationale-body strong { color: var(--text-primary); }

.tools-progress {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}
.tools-progress-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-card-hover);
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.tools-progress-item .dot {
    width: 10px; height: 10px; border-radius: 50%;
    display: inline-block;
}
.dot-todo      { background: #6b7280; }
.dot-learning  { background: #3b82f6; }
.dot-practiced { background: #14b8a6; }
.dot-applied   { background: #22c55e; }
.dot-proficient{ background: #f59e0b; }
.dot-mastered  { background: #a855f7; }

/* ── Unified toolbar (search + filters + kill-chain) ─────────────────── */
/* Page-level sticky search bar — sibling of .tools-toolbar so it stays
   pinned to the viewport even after the toolbar card scrolls past. */
.tools-search-sticky {
    position: sticky;
    top: 70px;
    z-index: 60;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.tools-search-sticky input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.45rem 0.7rem;
    font-size: 0.85rem;
}
.tools-search-sticky .count {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    margin-left: auto;
}

.tools-toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.tools-filter-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.tools-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}
.tools-toolbar-row .count {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}
.tools-toolbar input,
.tools-toolbar select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.45rem 0.7rem;
    font-size: 0.85rem;
}
.tools-toolbar select { min-width: 140px; flex: 1 1 auto; }
.tools-toolbar .reset-btn {
    margin-left: auto;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.tools-toolbar .reset-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Kill-chain rows inside toolbar */
.killchain-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--border);
}
.killchain-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}
.killchain-row-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    margin-right: 0.3rem;
    flex: 0 0 auto;
}
.killchain-row-label--attacker {
    background: rgba(239, 68, 68, .12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, .35);
}
.killchain-row-label--defender {
    background: rgba(59, 130, 246, .12);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, .35);
}
.killchain-pill {
    color: var(--text-muted);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    text-decoration: none;
    transition: all 0.15s ease;
}
.killchain-pill:hover { color: var(--accent); border-color: var(--accent); }
.killchain-pill.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
    font-weight: 600;
}
.killchain-pill-lifecycle {
    border-style: dashed;
    font-style: italic;
}
.killchain-pill-lifecycle.active {
    font-style: normal;
    border-style: solid;
}

/* ── Combined kill-chain + defender lifecycle (detail page) ───────── */
.killchain-combined {
    display: grid;
    grid-template-columns: 7fr auto 3fr;
    align-items: stretch;
    gap: 0;
    padding: 0;
    overflow: visible;
}
.kc-group {
    display: flex;
    flex-direction: column;
    padding: 0.6rem 0.75rem;
}
.kc-group-attacker {
    background: linear-gradient(135deg, rgba(229, 57, 53, 0.06), transparent 60%);
    border-radius: 11px 0 0 11px;
}
.kc-group-defender {
    background: linear-gradient(225deg, rgba(0, 255, 157, 0.06), transparent 60%);
    border-radius: 0 11px 11px 0;
}
.kc-group-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.kc-group-attacker .kc-group-label i { color: #e57373; }
.kc-group-defender .kc-group-label i { color: var(--accent); }
.kc-row {
    display: flex;
    flex: 1;
    gap: 0;
}
.kc-row .kc-stage { flex: 1; min-width: 0; }
.kc-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0 0.5rem;
    border-left: 1px dashed var(--border);
    border-right: 1px dashed var(--border);
}
.kc-stage .kc-name {
    display: block;
    line-height: 1.2;
}
@media (max-width: 768px) {
    .killchain-combined {
        grid-template-columns: 1fr;
    }
    .kc-group-attacker { border-radius: 11px 11px 0 0; }
    .kc-group-defender { border-radius: 0 0 11px 11px; }
    .kc-divider {
        border-left: none;
        border-right: none;
        border-top: 1px dashed var(--border);
        border-bottom: 1px dashed var(--border);
        padding: 0.3rem 0;
    }
    .kc-divider i { transform: rotate(90deg); }
}

/* ── The matrix grid ─────────────────────────────────────────────────── */
.tools-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
/* When only a few categories are visible, cap the column width so cards
   don't stretch edge-to-edge on a 100vw breakout. Uses auto-fit so columns
   collapse to a single stack on narrow viewports instead of overflowing. */
.tools-matrix.is-single-column,
.tools-matrix:has(> .matrix-column:only-child) {
    grid-template-columns: minmax(0, 480px);
    justify-content: center;
}
.tools-matrix.is-two-columns {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 420px));
    justify-content: center;
}
.tools-matrix.is-three-columns {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 380px));
    justify-content: center;
}
.matrix-column {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.matrix-column-header {
    background: var(--cat-color, #1e88e5);
    color: #fff;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
}
.matrix-column-header:hover { filter: brightness(1.1); color: #fff; }
.matrix-column-header .count-badge {
    margin-left: auto;
    background: rgba(0,0,0,0.25);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.matrix-column-body {
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

/* ── Tool card ───────────────────────────────────────────────────────── */
.tool-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    transition: all 0.15s ease;
    position: relative;
}
.tool-card:hover {
    border-color: var(--cat-color, var(--accent));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.tool-card .tool-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.tool-symbol {
    background: var(--cat-color, var(--accent));
    color: #fff;
    font-weight: 700;
    font-size: 0.72rem;
    padding: 0.18rem 0.4rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
    min-width: 36px;
    text-align: center;
}
.tool-name {
    font-weight: 600;
    font-size: 0.92rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tool-card .tool-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}
/* Tools matrix: break .tools-matrix out of the 1200px container so the
   8-column grid can span the full viewport, while header/filters keep
   their normal width. */
body.page-tools-matrix .tools-matrix {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 0 24px;
}
@media (max-width: 700px) {
    body.page-tools-matrix .tools-matrix { padding: 0 1rem; }
}

.tool-status-dot {
    width: 9px; height: 9px; border-radius: 50%;
    display: inline-block;
}
.tool-license {
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: var(--bg-card-hover);
}
.tool-os-icons i { margin-right: 0.2rem; }
.killchain-dots {
    display: flex;
    gap: 3px;
    margin-top: 0.2rem;
}
.killchain-dots .kc-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: rgba(255,255,255,0.15);
}
.killchain-dots .kc-dot.on { background: var(--cat-color, var(--accent)); }

/* ── Tool detail page ────────────────────────────────────────────────── */
.tool-detail-header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 6px solid var(--cat-color, var(--accent));
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}
.tool-detail-header .tool-logo {
    width: 80px; height: 80px;
    background: var(--bg-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: var(--cat-color, var(--accent));
    flex-shrink: 0;
    overflow: hidden;
}
.tool-detail-header .tool-logo img {
    width: 100%; height: 100%; object-fit: contain;
}
.tool-detail-header h1 {
    color: var(--text-primary);
    font-size: 1.85rem;
    margin: 0 0 0.3rem 0;
}
.tool-detail-header .tool-vendor { color: var(--text-muted); font-size: 0.9rem; }
.tool-detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.8rem;
}
.tool-badge {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid var(--border);
}
.tool-badge.category { background: var(--cat-color); color: #fff; border-color: transparent; }

/* Status badges — tinted background + colored border matching the dot palette */
.tool-badge.status { font-weight: 600; }
.tool-badge.status-todo       { background: rgba(107,114,128,.18); border-color: #6b7280; color: #d1d5db; }
.tool-badge.status-learning   { background: rgba(59,130,246,.18); border-color: #3b82f6; color: #93c5fd; }
.tool-badge.status-practiced  { background: rgba(20,184,166,.18); border-color: #14b8a6; color: #5eead4; }
.tool-badge.status-applied    { background: rgba(34,197,94,.18);  border-color: #22c55e; color: #86efac; }
.tool-badge.status-proficient { background: rgba(245,158,11,.18); border-color: #f59e0b; color: #fcd34d; }
.tool-badge.status-mastered   { background: rgba(168,85,247,.20); border-color: #a855f7; color: #d8b4fe; }
.tool-detail-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.tool-detail-actions a {
    color: var(--accent);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    text-decoration: none;
}
.tool-detail-actions a:hover { border-color: var(--accent); }

/* Kill chain timeline strip on detail page */
.killchain-title {
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.killchain-timeline {
    display: flex;
    overflow-x: auto;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
}
.kc-stage {
    flex: 1 0 auto;
    text-align: center;
    padding: 0.5rem 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-right: 1px dashed var(--border);
    position: relative;
}
.kc-stage:last-child { border-right: none; }
.kc-stage.on {
    color: #fff;
    background: var(--cat-color, var(--accent));
    border-radius: 6px;
    font-weight: 600;
    border-right-color: transparent;
}
.kc-stage .kc-num {
    display: block;
    font-size: 0.65rem;
    opacity: 0.7;
    margin-bottom: 0.15rem;
}

.tool-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.tool-section h2 {
    color: var(--accent);
    font-size: 1.2rem;
    margin: 0 0 0.75rem 0;
}
.tool-section pre {
    background: #010409;
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border);
}
.tool-staff-note {
    border-left: 4px solid #f9a825;
    background: rgba(249, 168, 37, 0.08);
}

.tool-detail-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.25rem;
}
/* Prevent wide <pre>/code blocks from forcing the main column to grow
   beyond its grid track on narrow viewports. */
.tool-detail-grid > * { min-width: 0; }
.tool-section pre,
.tool-section code { max-width: 100%; }
.tool-sidebar .sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.tool-sidebar h3 {
    color: var(--accent);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.tool-sidebar ul { list-style: none; padding: 0; margin: 0; }
.tool-sidebar ul li { margin-bottom: 0.4rem; }
.tool-sidebar ul li a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
}
.tool-sidebar ul li a:hover { color: var(--accent); }

@media (max-width: 900px) {
    .tool-detail-grid { grid-template-columns: 1fr; }
    .tools-search-sticky { position: static; box-shadow: none; }
}

@media (max-width: 600px) {
    .tools-matrix { grid-template-columns: 1fr; }
    .tool-detail-header { flex-direction: column; }
}

/* Hidden state for client-side filtering */
.tool-card.is-hidden { display: none !important; }
.matrix-column.is-empty { display: none; }

/* Print stylesheet */
@media print {
    .tools-toolbar, header, .breadcrumb { display: none !important; }
    .tools-matrix { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .tool-card { break-inside: avoid; }
}
