/* ======================================================================
   Link analytics page (Pages/LinkDetails.razor). Reuses the result card
   pieces from home.css and the design system in admin.css.
   ====================================================================== */
.back-link { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 12px; color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 600; }
.back-link:hover { color: var(--text); }

.link-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; padding: 22px 24px; }
.link-hero.disabled .result-link > a { color: var(--muted); text-decoration: line-through; }
.link-hero.disabled .result-qr img { opacity: .35; filter: grayscale(1); }
.link-hero-main { display: grid; gap: 12px; min-width: 0; align-content: start; }
.link-hero .code-pill .mono { padding: 3px 8px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); }
.link-hero .result-dest { color: var(--muted); text-decoration: none; }
.link-hero .result-dest:hover span { text-decoration: underline; }
.link-hero .result-qr img { width: 140px; height: 140px; }

/* KPI tiles. */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi2 { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.kpi2-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi2-label { color: var(--muted); font-size: .82rem; }

/* Clicks per day. */
.chart2 { position: relative; height: 220px; margin: 6px 0 0 36px; }
.chart2-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart2-grid span { position: relative; border-top: 1px dashed color-mix(in srgb, var(--border) 90%, transparent); height: 0; }
.chart2-grid span:last-child { border-top-style: solid; }
.chart2-grid span::before { content: attr(data-v); position: absolute; right: calc(100% + 8px); top: -.6em; color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart2-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 3px; }
.chart2-bars.dense { gap: 1px; }
.chart2-col { flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 4px 4px 0 0; }
.chart2-col:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.chart2-bar {
    width: 100%; min-height: 2px; border-radius: 4px 4px 0 0;
    background: linear-gradient(to top, color-mix(in srgb, var(--accent) 70%, transparent), var(--accent));
    transition: filter .15s;
}
.chart2-bar.zero { background: var(--border); opacity: .6; }
.chart2-col:hover .chart2-bar:not(.zero) { filter: brightness(1.15); }
.chart2-axis { display: flex; justify-content: space-between; margin: 8px 0 0 36px; color: var(--muted); font-size: .78rem; }

/* Breakdown cards. */
.breakdown-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.breakdown-card { margin: 0; }
.breakdown-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.breakdown-head h2 { margin: 0; font-size: 1rem; flex: 1; }
.breakdown-empty { margin: 4px 0 0; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rank-list li { display: grid; grid-template-columns: 22px 1fr auto; grid-template-rows: auto 6px; gap: 4px 10px; align-items: center; }
.rank { grid-row: 1 / 3; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--bg); color: var(--muted); font-size: .72rem; font-weight: 700; }
.rank-list li:first-child .rank { background: var(--accent-soft); color: var(--accent); }
.rank-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.rank-value { font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank-bar { grid-column: 2 / 4; height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 999px; background: color-mix(in srgb, var(--accent) 75%, transparent); }
.flag { margin-right: 4px; }
.breakdown-more { margin-top: 12px; font-size: .85rem; }

@media (max-width: 620px) {
    .link-hero { grid-template-columns: 1fr; padding: 18px; }
    .link-hero .result-qr { justify-self: center; }
    .chart2 { height: 170px; }
}
