/* Derin Denetim (14 Katman) — tüm kurallar #derin-denetim altında kapsüllenir.
   Şiddet renkleri tokens.css'teki --sev-* değişkenlerinden gelir; yedek değerler burada. */

.deep-audit {
    --d-critical: var(--sev-critical, #b91c1c);
    --d-critical-bg: var(--sev-critical-bg, rgba(220, 38, 38, 0.12));
    --d-high: var(--sev-high, #c2410c);
    --d-high-bg: var(--sev-high-bg, rgba(234, 88, 12, 0.12));
    --d-medium: var(--sev-medium, #92400e);
    --d-medium-bg: var(--sev-medium-bg, rgba(245, 158, 11, 0.16));
    --d-low: var(--sev-low, #1d4ed8);
    --d-low-bg: var(--sev-low-bg, rgba(37, 99, 235, 0.11));
    --d-info: var(--sev-info, #475569);
    --d-info-bg: var(--sev-info-bg, rgba(100, 116, 139, 0.13));
    --d-pass: var(--sev-pass, #15803d);
    --d-pass-bg: var(--sev-pass-bg, rgba(22, 163, 74, 0.13));
    --d-code-bg: #0f172a;
    --d-code-fg: #e2e8f0;
    --d-surface: var(--bg-card, rgba(255, 255, 255, 0.9));
    --d-line: var(--border, rgba(10, 10, 10, 0.09));
    --d-muted: var(--text-muted, #454545);
    --d-ink: var(--text-main, #0a0a0a);
    --d-accent: var(--primary, #f9ca23);

    margin-top: 40px;
    scroll-margin-top: 88px;
    color: var(--d-ink);
}

[data-theme="dark"] .deep-audit {
    --d-critical: var(--sev-critical, #f87171);
    --d-critical-bg: var(--sev-critical-bg, rgba(248, 113, 113, 0.16));
    --d-high: var(--sev-high, #fb923c);
    --d-high-bg: var(--sev-high-bg, rgba(251, 146, 60, 0.16));
    --d-medium: var(--sev-medium, #fbbf24);
    --d-medium-bg: var(--sev-medium-bg, rgba(251, 191, 36, 0.15));
    --d-low: var(--sev-low, #60a5fa);
    --d-low-bg: var(--sev-low-bg, rgba(96, 165, 250, 0.16));
    --d-info: var(--sev-info, #94a3b8);
    --d-info-bg: var(--sev-info-bg, rgba(148, 163, 184, 0.16));
    --d-pass: var(--sev-pass, #4ade80);
    --d-pass-bg: var(--sev-pass-bg, rgba(74, 222, 128, 0.14));
    --d-code-bg: #020617;
}

.deep-audit [hidden] { display: none !important; }
.deep-audit *, .deep-audit *::before, .deep-audit *::after { box-sizing: border-box; }

.deep-card {
    background: var(--d-surface);
    border: 1px solid var(--d-line);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--card-shadow, 0 10px 30px rgba(10, 10, 10, 0.07));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.deep-head h2 {
    margin: 0 0 8px;
    font-size: 1.5rem;
    line-height: 1.25;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.deep-head__badge {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--d-accent);
    color: var(--on-primary, #0a0a0a);
}
.deep-lead { margin: 0 0 20px; color: var(--d-muted); line-height: 1.6; max-width: 70ch; }

/* ---- form ---- */
.deep-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.deep-input {
    flex: 1 1 280px;
    min-width: 0;
    min-height: 48px;
    padding: 0 16px;
    font: inherit;
    color: var(--d-ink);
    background: var(--glass-bg, rgba(255, 255, 255, 0.6));
    border: 1px solid rgba(128, 128, 128, 0.45);
    border-radius: 12px;
    text-align: left;
    box-shadow: none;
}
.deep-input:focus { border-color: var(--d-accent); }
.deep-input:disabled { opacity: 0.6; }
.deep-btn {
    min-height: 48px;
    min-width: 48px;
    padding: 0 20px;
    font: inherit;
    font-weight: 700;
    border-radius: 12px;
    border: 1px solid var(--d-line);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.deep-btn--primary {
    background: var(--d-accent);
    color: var(--on-primary, #0a0a0a);
    border-color: transparent;
}
.deep-btn--primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(249, 202, 35, 0.35); }
.deep-btn--ghost { background: var(--glass-bg, rgba(255, 255, 255, 0.6)); color: var(--d-ink); }
.deep-btn--ghost:hover:not(:disabled) { border-color: var(--d-accent); }
.deep-btn--danger { background: var(--d-critical-bg); color: var(--d-critical); border-color: var(--d-critical); }
.deep-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.deep-btn.is-busy::after {
    content: "";
    width: 16px; height: 16px;
    border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
    animation: deep-spin 0.8s linear infinite;
}
.deep-audit :focus-visible { outline: 3px solid var(--d-accent); outline-offset: 2px; }

.deep-status { min-height: 1.4em; margin: 12px 0 0; font-weight: 600; font-size: 0.92rem; color: var(--d-muted); }
.deep-status[data-kind="error"] { color: var(--d-critical); }
.deep-status[data-kind="warn"] { color: var(--d-medium); }
.deep-status[data-kind="ok"] { color: var(--d-pass); }

/* ---- ilerleme ---- */
.deep-progress { margin-top: 20px; padding: 18px; border: 1px solid var(--d-line); border-radius: 16px; background: var(--glass-bg, rgba(255, 255, 255, 0.4)); }
.deep-progress__head { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; margin-bottom: 10px; }
.deep-progress__bar { height: 12px; border-radius: 999px; background: var(--d-line); overflow: hidden; }
.deep-progress__fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--d-accent), #fcd34d); transition: width 0.4s ease; }
.deep-steps { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.deep-step { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--d-line); border-radius: 12px; min-height: 48px; }
.deep-step__dot { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.78rem; font-weight: 800; background: var(--d-info-bg); color: var(--d-info); }
.deep-step__body { display: flex; flex-direction: column; min-width: 0; }
.deep-step__name { font-weight: 700; font-size: 0.9rem; }
.deep-step__sum { font-size: 0.78rem; color: var(--d-muted); overflow-wrap: anywhere; }
.deep-step[data-state="run"] { border-color: var(--d-accent); }
.deep-step[data-state="run"] .deep-step__dot { background: var(--d-accent); color: var(--on-primary, #0a0a0a); animation: deep-pulse 1.2s ease-in-out infinite; }
.deep-step[data-state="done"] .deep-step__dot { background: var(--d-pass-bg); color: var(--d-pass); }
.deep-step[data-state="done"] .deep-step__dot::before { content: "\2713"; }
.deep-step[data-state="done"] .deep-step__dot { font-size: 0; }
.deep-step[data-state="done"] .deep-step__dot::before { font-size: 0.85rem; }
.deep-step[data-state="fail"] { border-color: var(--d-critical); }
.deep-step[data-state="fail"] .deep-step__dot { background: var(--d-critical-bg); color: var(--d-critical); }

/* ---- sonuç özeti ---- */
.deep-result { margin-top: 28px; }
.deep-summary { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; padding-bottom: 22px; border-bottom: 1px solid var(--d-line); }
.deep-summary__ring { text-align: center; flex: none; }
.deep-summary__word { font-weight: 800; margin-top: 4px; }
.deep-summary__body { flex: 1 1 320px; min-width: 0; }
.deep-result__title { margin: 0 0 4px; font-size: 1.25rem; overflow-wrap: anywhere; }
.deep-result__title:focus { outline: none; }
.deep-summary__lead { margin: 0 0 14px; color: var(--d-muted); }
.deep-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.deep-ring { display: block; max-width: 100%; height: auto; }
.deep-ring__bg { stroke: var(--d-line); }
.deep-ring__fg { transition: stroke-dasharray 0.9s ease; stroke: var(--d-info); }
.deep-ring__txt { font-size: 32px; font-weight: 800; fill: var(--d-ink); }
.deep-band--pass { stroke: var(--d-pass); }
.deep-band--low { stroke: var(--d-low); }
.deep-band--medium { stroke: var(--d-medium); }
.deep-band--high { stroke: var(--d-high); }
.deep-band--critical { stroke: var(--d-critical); }
.deep-band--info { stroke: var(--d-info); }
.deep-band-text--pass { color: var(--d-pass); }
.deep-band-text--low { color: var(--d-low); }
.deep-band-text--medium { color: var(--d-medium); }
.deep-band-text--high { color: var(--d-high); }
.deep-band-text--critical { color: var(--d-critical); }
.deep-band-text--info { color: var(--d-info); }

/* ---- şiddet çipleri ---- */
.deep-sevbar { display: flex; flex-wrap: wrap; gap: 8px; }
.deep-chip {
    min-height: 48px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px;
    font: inherit; font-weight: 700; cursor: pointer; border-radius: 12px;
    border: 2px solid var(--c); background: transparent; color: var(--c); opacity: 0.55;
}
.deep-chip[aria-pressed="true"] { background: var(--cb); opacity: 1; }
.deep-chip__n { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.deep-chip__l { font-size: 0.82rem; }
.deep-chip--critical { --c: var(--d-critical); --cb: var(--d-critical-bg); }
.deep-chip--high { --c: var(--d-high); --cb: var(--d-high-bg); }
.deep-chip--medium { --c: var(--d-medium); --cb: var(--d-medium-bg); }
.deep-chip--low { --c: var(--d-low); --cb: var(--d-low-bg); }
.deep-chip--info { --c: var(--d-info); --cb: var(--d-info-bg); }
.deep-chip--pass { --c: var(--d-pass); --cb: var(--d-pass-bg); }

/* ---- rozet ---- */
.deep-sev {
    display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 800;
    letter-spacing: 0.02em; white-space: nowrap; border: 1px solid currentColor;
}
.deep-sev--critical { color: var(--d-critical); background: var(--d-critical-bg); }
.deep-sev--high { color: var(--d-high); background: var(--d-high-bg); }
.deep-sev--medium { color: var(--d-medium); background: var(--d-medium-bg); }
.deep-sev--low { color: var(--d-low); background: var(--d-low-bg); }
.deep-sev--info { color: var(--d-info); background: var(--d-info-bg); }
.deep-sev--pass { color: var(--d-pass); background: var(--d-pass-bg); }

/* ---- 14 katman kartları ---- */
.deep-layers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; margin: 24px 0; padding: 0; list-style: none; }
.deep-layers__item { display: flex; }
.deep-layer {
    flex: 1; display: flex; flex-direction: column; gap: 8px; text-align: left; min-height: 48px; padding: 14px;
    font: inherit; color: var(--d-ink); cursor: pointer; background: var(--glass-bg, rgba(255, 255, 255, 0.5));
    border: 1px solid var(--d-line); border-left: 5px solid var(--d-info); border-radius: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.deep-layer:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1); }
.deep-layer[aria-pressed="true"] { outline: 3px solid var(--d-accent); outline-offset: 1px; }
.deep-layer--pass { border-left-color: var(--d-pass); }
.deep-layer--low { border-left-color: var(--d-low); }
.deep-layer--medium { border-left-color: var(--d-medium); }
.deep-layer--high { border-left-color: var(--d-high); }
.deep-layer--critical { border-left-color: var(--d-critical); }
.deep-layer__top { display: flex; justify-content: space-between; align-items: baseline; }
.deep-layer__no { font-size: 0.78rem; font-weight: 800; color: var(--d-muted); }
.deep-layer__score { font-size: 1.7rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.deep-layer__name { font-weight: 700; font-size: 0.92rem; line-height: 1.3; }
.deep-layer__bar { display: block; height: 6px; border-radius: 999px; background: var(--d-line); overflow: hidden; }
.deep-layer__fill { display: block; height: 100%; border-radius: inherit; background: var(--d-info); }
.deep-fillband--pass { background: var(--d-pass); }
.deep-fillband--low { background: var(--d-low); }
.deep-fillband--medium { background: var(--d-medium); }
.deep-fillband--high { background: var(--d-high); }
.deep-fillband--critical { background: var(--d-critical); }
.deep-layer__counts { display: flex; flex-wrap: wrap; gap: 6px; }
.deep-layer__none { font-size: 0.78rem; color: var(--d-muted); }
.deep-cnt { font-size: 0.78rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.deep-cnt--critical { color: var(--d-critical); background: var(--d-critical-bg); }
.deep-cnt--high { color: var(--d-high); background: var(--d-high-bg); }
.deep-cnt--medium { color: var(--d-medium); background: var(--d-medium-bg); }
.deep-cnt--low { color: var(--d-low); background: var(--d-low-bg); }
.deep-cnt--info { color: var(--d-info); background: var(--d-info-bg); }
.deep-cnt--pass { color: var(--d-pass); background: var(--d-pass-bg); }

/* ---- sekmeler ---- */
.deep-tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--d-line); -webkit-overflow-scrolling: touch; }
.deep-tab {
    flex: none; min-height: 48px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px;
    font: inherit; font-weight: 700; color: var(--d-muted); background: transparent; cursor: pointer;
    border: 0; border-bottom: 3px solid transparent; border-radius: 10px 10px 0 0;
}
.deep-tab[aria-selected="true"] { color: var(--d-ink); border-bottom-color: var(--d-accent); background: var(--glass-bg, rgba(255, 255, 255, 0.4)); }
.deep-tab__n { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--d-info-bg); color: var(--d-info); }
.deep-panel { padding-top: 18px; }
.deep-panel:focus { outline: none; }

.deep-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.deep-tools .deep-input { flex: 1 1 260px; }
.deep-count { margin: 6px 0 14px; font-size: 0.85rem; color: var(--d-muted); }
.deep-empty { padding: 28px; text-align: center; color: var(--d-muted); border: 1px dashed var(--d-line); border-radius: 14px; }
.deep-more { margin: 16px auto 0; display: flex; }
.deep-muted { color: var(--d-muted); }
.deep-yes { color: var(--d-pass); font-weight: 700; }
.deep-no { color: var(--d-critical); font-weight: 700; }

/* ---- bulgu listesi ---- */
.deep-findings { display: flex; flex-direction: column; gap: 10px; }
.deep-f { border: 1px solid var(--d-line); border-left: 5px solid var(--d-info); border-radius: 14px; background: var(--glass-bg, rgba(255, 255, 255, 0.5)); }
.deep-f--critical { border-left-color: var(--d-critical); }
.deep-f--high { border-left-color: var(--d-high); }
.deep-f--medium { border-left-color: var(--d-medium); }
.deep-f--low { border-left-color: var(--d-low); }
.deep-f--info { border-left-color: var(--d-info); }
.deep-f--pass { border-left-color: var(--d-pass); }
.deep-f__sum { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; cursor: pointer; list-style: none; }
.deep-f__sum::-webkit-details-marker { display: none; }
.deep-f__sum::before { content: "\25B8"; color: var(--d-muted); transition: transform 0.15s ease; }
.deep-f[open] > .deep-f__sum::before { transform: rotate(90deg); }
.deep-f__title { flex: 1 1 220px; font-weight: 700; overflow-wrap: anywhere; }
.deep-f__layer, .deep-f__effort { font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: var(--d-info-bg); color: var(--d-info); }
.deep-f__body { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.deep-f__detail { margin: 0; line-height: 1.6; }
.deep-f__url { margin: 0; font-size: 0.88rem; overflow-wrap: anywhere; }
.deep-f__k { font-weight: 700; color: var(--d-muted); }
.deep-audit a { color: var(--d-low); text-underline-offset: 2px; }

/* ---- kod blokları ---- */
.deep-block { border: 1px solid var(--d-line); border-radius: 12px; overflow: hidden; }
.deep-block__sum { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; cursor: pointer; font-weight: 800; font-size: 0.86rem; }
.deep-block--before > .deep-block__sum { background: var(--d-critical-bg); color: var(--d-critical); }
.deep-block--after > .deep-block__sum { background: var(--d-pass-bg); color: var(--d-pass); }
.deep-lang { margin-left: auto; font-size: 0.72rem; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.12); }
.deep-block__body { position: relative; background: var(--d-code-bg); }
.deep-copy {
    position: absolute; top: 8px; right: 8px; z-index: 1; min-height: 48px; min-width: 48px; padding: 0 14px;
    font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; color: #0a0a0a;
    background: var(--d-accent); border: 0; border-radius: 10px;
}
.deep-code {
    margin: 0; padding: 14px 16px; padding-right: 120px; max-height: 360px; overflow: auto; color: var(--d-code-fg);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; line-height: 1.55;
    white-space: pre; tab-size: 2;
}
.deep-code code { font: inherit; }

/* ---- tablolar ---- */
.deep-tablewrap { overflow: auto; max-height: 70vh; border: 1px solid var(--d-line); border-radius: 14px; -webkit-overflow-scrolling: touch; background: var(--d-surface); }
.deep-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; font-size: 0.88rem; }
.deep-table th, .deep-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--d-line); max-width: 360px; overflow-wrap: anywhere; }
.deep-table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-light, #faf9f6); padding: 0; white-space: nowrap; border-bottom: 2px solid var(--d-line); }
.deep-table tbody th { font-weight: 600; }
.deep-table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deep-table .is-first { min-width: 230px; position: sticky; left: 0; z-index: 1; background: var(--bg-light, #faf9f6); }
.deep-table thead th.is-first { z-index: 3; }
.deep-table tbody tr:hover > * { background: var(--d-info-bg); }
.deep-sort { width: 100%; min-height: 48px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font: inherit; font-weight: 800; font-size: 0.8rem; color: var(--d-ink); background: transparent; border: 0; cursor: pointer; text-align: inherit; }
.deep-th.is-num .deep-sort { flex-direction: row-reverse; }
.deep-sort__ic::before { content: "\2195"; opacity: 0.4; }
.deep-th[aria-sort="ascending"] .deep-sort__ic::before { content: "\25B2"; opacity: 1; color: var(--d-accent); }
.deep-th[aria-sort="descending"] .deep-sort__ic::before { content: "\25BC"; opacity: 1; color: var(--d-accent); }

@keyframes deep-spin { to { transform: rotate(360deg); } }
@keyframes deep-pulse { 50% { box-shadow: 0 0 0 6px rgba(249, 202, 35, 0.25); } }

@media (max-width: 640px) {
    .deep-card { padding: 18px 14px; border-radius: 16px; }
    .deep-form > * { flex: 1 1 100%; }
    .deep-summary { gap: 14px; justify-content: center; }
    .deep-layers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .deep-layer { padding: 12px 10px; }
    .deep-layer__score { font-size: 1.4rem; }
    .deep-code { padding-right: 14px; padding-top: 58px; font-size: 0.78rem; }
    .deep-chip { flex: 1 1 calc(50% - 8px); justify-content: center; }
    .deep-tools > * { flex: 1 1 100%; }
    .deep-actions > * { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .deep-audit *, .deep-audit *::before, .deep-audit *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    .deep-form, .deep-actions, .deep-tools, .deep-copy, .deep-sevbar { display: none !important; }
    .deep-f, .deep-block { break-inside: avoid; }
    .deep-f > .deep-f__body, .deep-block { display: block; }
    .deep-code { max-height: none; white-space: pre-wrap; }
}
