/* Soc (SOC dashboard, /soc/dashboard) — migrated from Soc.razor.css; scoped under .page-soc. */
.page-soc { display: flex; flex-direction: column; gap: 34px; }

/* ─── Header action buttons ───────────────────────────────────── */

.page-soc .btn-icon,
.page-soc .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.page-soc .btn-icon svg,
.page-soc .btn-primary svg { width: 15px; height: 15px; }

.page-soc .btn-primary {
    padding: 9px 16px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #04201D;
    font: 600 13px var(--font-body);
    cursor: pointer;
    transition: filter .18s ease, transform .18s ease;
}

.page-soc .btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ─── Welcome row (under the page title) ──────────────────────── */

.page-soc .welcome {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.page-soc .welcome-avatar {
    width: 34px;
    height: 34px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    color: #04201D;
    background: linear-gradient(140deg, #5EEAD9, #14B8A6);
}

.page-soc .welcome-text {
    font-size: 14px;
    color: var(--muted);
    display: inline-block;
    white-space: nowrap;
    /* typewriter: reveal left-to-right in character-sized steps */
    animation: welcome-type .45s steps(16, end) both;
    animation-delay: .15s;
}
.page-soc .welcome-text strong { color: var(--text); font-weight: 600; }

@keyframes welcome-type {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0 0 0); }
}

/* ─── Time-range selector (page header) ───────────────────────── */

.page-soc .range-select {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.page-soc .range-btn {
    padding: 8px 15px;
    border: none;
    background: transparent;
    color: var(--muted);
    font: 600 12.5px var(--font-body);
    cursor: pointer;
    transition: color .15s ease, background .15s ease;
}

.page-soc .range-btn + .range-btn { border-left: 1px solid var(--line); }

.page-soc .range-btn:hover { color: var(--text); background: var(--surface-2); }

.page-soc .range-btn.is-active { color: #04201D; background: var(--accent); }

/* ─── Skeleton loading ────────────────────────────────────────────
   No separate placeholder layout. The real content is rendered (so every
   card/panel already has its true size), then while loading we hide its
   contents and paint a shimmer over each block. On load we drop the flag →
   content shows in the exact same boxes and its data animates in. */

/* the shimmer→content swap is the entrance; no separate slide-in */
.page-soc .loading .head-actions > *,
.page-soc .loading .stat-card > *,
.page-soc .loading .panel > *,
.page-soc .loading .traffic-wrap > * { visibility: hidden; }

.page-soc .loading .head-actions,
.page-soc .loading .stat-card,
.page-soc .loading .panel,
.page-soc .loading .traffic-wrap { position: relative; }

.page-soc .loading .traffic-wrap::after,
.page-soc .loading .head-actions::after { border: 1px solid var(--line); }

.page-soc .loading .head-actions::after,
.page-soc .loading .stat-card::after,
.page-soc .loading .panel::after,
.page-soc .loading .traffic-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 10;
    /* opaque base so nothing behind (incl. the live map) shows through the sweep */
    background-color: var(--surface-2);
    background-image: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.06) 50%, transparent 70%);
    background-size: 200% 100%;
    background-repeat: no-repeat;
    animation: skel-shimmer 1.4s linear infinite;
}

/* hold the fill/draw animations until content is revealed, then let them play */
.page-soc .loading .sev-bar span,
.page-soc .loading .stat-spark,
.page-soc .loading .area-chart,
.page-soc .loading .donut-seg { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
    .page-soc .loading .head-actions::after,
    .page-soc .loading .stat-card::after,
    .page-soc .loading .panel::after,
    .page-soc .loading .traffic-wrap::after { animation: none; }
}

/* ─── Stat cards ──────────────────────────────────────────────────
   Big number, Δ vs previous period, sparkline pinned to the bottom. */

.page-soc .stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.page-soc .stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 18px 0;
    min-height: 150px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.page-soc .stat-card:hover {
    border-color: rgba(255, 255, 255, 0.20);
    background: var(--surface-2);
}

/* ─── Card / panel hover elevation ────────────────────────────── */

.page-soc .panel { position: relative; transition: border-color .2s ease, box-shadow .2s ease; }

/* accent line that fades in along the top edge on hover */
.page-soc .stat-card::before,
.page-soc .panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    opacity: 0;
    transition: opacity .22s ease;
    pointer-events: none;
    z-index: 1;
}

.page-soc .stat-card:hover::before,
.page-soc .panel:hover::before { opacity: 0.9; }

.page-soc .stat-card:hover,
.page-soc .panel:hover {
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 18px 36px -22px rgba(0, 0, 0, 0.75);
}

/* ─── Section header icon + accent underline ──────────────────── */

.page-soc .section-head h2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.page-soc .sec-ic {
    display: inline-flex;
    color: var(--accent);
}
.page-soc .sec-ic svg { width: 16px; height: 16px; }

.page-soc .section-head.tight {
    position: relative;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-soft);
}

.page-soc .section-head.tight::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.page-soc .stat-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.page-soc .stat-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.page-soc .stat-value {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.page-soc .stat-delta {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 12.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
}

.page-soc .stat-delta svg { width: 11px; height: 11px; flex: none; }

.page-soc .stat-delta.tone-good    { color: var(--good); background: rgba(45, 212, 191, 0.14); }
.page-soc .stat-delta.tone-bad     { color: var(--bad);  background: rgba(255, 107, 107, 0.14); }
.page-soc .stat-delta.tone-neutral { color: var(--faint); background: rgba(255, 255, 255, 0.06); }

.page-soc .stat-caption {
    margin-top: -5px;
    font-size: 11.5px;
    color: var(--faint);
}

/* sparkline sits near the bottom, inset from the card edges */
.page-soc .stat-spark {
    margin-top: auto;
    margin-bottom: 18px;
    width: 100%;
    height: 48px;
    display: block;
    /* reveal the line + fill left-to-right */
    animation: wipe-right 1s cubic-bezier(.4, 0, .2, 1) both;
    animation-delay: .1s;
}

.page-soc .stat-area {
    fill: url(#statFill);
}

.page-soc .stat-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

/* per-severity indicator (replaces the sparkline on some cards) */
.page-soc .stat-sev {
    margin-top: auto;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-soc .stat-sev-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-variant-numeric: tabular-nums;
}

.page-soc .stat-sev-dot {
    width: 11px;
    height: 11px;
    display: inline-block;
    border-radius: 0;
}

.page-soc .stat-sev-count {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

/* ─── Overview row (severity + traffic map) ───────────────────────
   Severity mix on the left, traffic overview on the right. The map
   is the wider column but does not span the full width. */

.page-soc .overview-grid {
    display: grid;
    grid-template-columns: 0.9fr 1.7fr;
    gap: 18px;
    align-items: stretch;
}

/* ─── Incident volume + classification row ────────────────────── */

.page-soc .volume-grid {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 18px;
    align-items: stretch;
}

/* classification names ("Benign positive") need a wider label column */
.page-soc .class-card .sev-breakdown li { grid-template-columns: 11px 104px 1fr auto; }

/* donut + severity breakdown — fills the panel height */

.page-soc .sev-panel { display: flex; flex-direction: column; }

.page-soc .donut {
    width: 214px;
    height: 214px;
    display: block;
    margin: 10px auto 24px;
}

.page-soc .donut-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 15;
}

.page-soc .donut-seg {
    /* stroke matches fill (set inline) to cover the anti-aliased seam between sectors.
       The ring sweeps in via geometry (ArrowSegs + the count-up ticker), so no CSS entrance here. */
    stroke-width: 1;
    stroke-linejoin: round;
    transition: filter .2s ease;
}

.page-soc .donut-seg:hover { filter: brightness(1.15); }

.page-soc .donut-total {
    fill: var(--text);
    font: 700 34px var(--font-display);
    text-anchor: middle;
}

.page-soc .donut-caption {
    fill: var(--faint);
    font: 500 11px var(--font-body);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-anchor: middle;
}

.page-soc .sev-breakdown {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 10px;
    flex: 1;
}

.page-soc .sev-breakdown li {
    display: grid;
    grid-template-columns: 11px 76px 1fr auto;
    align-items: center;
    gap: 11px;
    font-size: 13px;
}

.page-soc .sev-dot { width: 9px; height: 9px; border-radius: 0; }

.page-soc .sev-name { color: var(--muted); }

.page-soc .sev-bar {
    height: 7px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.10);
    overflow: hidden;
}

.page-soc .sev-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    /* slide in left-to-right, same wipe as the graph lines */
    animation: wipe-right .9s cubic-bezier(.22, .9, .3, 1) both;
    animation-delay: .1s;
}

.page-soc .sev-val { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.page-soc .sev-val small { font-weight: 500; color: var(--faint); margin-left: 4px; }

/* ─── Incident volume — area / line chart ─────────────────────────── */

.page-soc .area-wrap { display: flex; flex-direction: column; gap: 8px; }

.page-soc .area-chart {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
    /* reveal the line + fill left-to-right */
    animation: wipe-right 1.2s cubic-bezier(.4, 0, .2, 1) both;
    animation-delay: .1s;
}

.page-soc .area-chart .grid {
    stroke: rgba(255, 255, 255, 0.10);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.page-soc .area-chart .area {
    fill: url(#areaFill);
}

.page-soc .area-chart .line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.page-soc .x-axis {
    display: flex;
    justify-content: space-between;
    padding: 0 4px;
    font-size: 11.5px;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ─── Responsive ──────────────────────────────────────────────── */

@media (max-width: 1280px) {
    .page-soc .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .page-soc .overview-grid { grid-template-columns: 1fr; }
    .page-soc .volume-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .page-soc .stat-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .page-soc .stat-spark,
    .page-soc .area-chart,
    .page-soc .sev-bar span,
    .page-soc .welcome-text,
    .page-soc .donut-seg { animation: none; clip-path: none; }
}
