/* Stride Asset Store — prototype theme */
:root {
    --bg: #0f1115;
    --surface: #181b22;
    --surface-2: #20242d;
    --border: #2a2f3a;
    --text: #e6e8ec;
    --muted: #9aa3b2;
    --accent: #5b8def;
    --accent-2: #8a5bef;
    --ok: #4ade80;
    --warn: #fbbf24;
    --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
    display: flex; align-items: center; gap: .75rem;
    padding: .8rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(90deg, rgba(91,141,239,.08), transparent);
    position: sticky; top: 0; z-index: 10; backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: .5rem; color: var(--text); font-size: 1.15rem; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); font-size: 1.3rem; }
.brand-text strong { color: var(--accent); }
.brand-tag {
    font-size: .65rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--warn); border: 1px solid var(--warn); border-radius: 999px; padding: .1rem .5rem;
}
.brand-link { font-size: .82rem; color: var(--muted); margin-left: .4rem; }
.brand-link:hover { color: var(--accent); }
.app-nav { margin-left: auto; font-size: .9rem; display: flex; align-items: center; }
.btn-dl {
    background: var(--accent); color: #fff; border-radius: 7px; padding: .35rem .7rem;
    font-size: .85rem; font-weight: 600; margin-right: 1rem;
}
.btn-dl:hover { filter: brightness(1.1); text-decoration: none; }

/* About page links */
.links { display: flex; flex-direction: column; gap: .8rem; }
.link-row { display: flex; flex-direction: column; gap: .15rem; }
.link-row > a:first-child { font-weight: 600; font-size: .95rem; }
.link-row > span { color: var(--muted); font-size: .85rem; line-height: 1.4; }
.app-main { flex: 1; padding: 1.5rem; max-width: 1200px; margin: 0 auto; width: 100%; }
.app-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem; text-align: center; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1.2rem; }
.toolbar input[type=text], .toolbar select {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: .5rem .7rem; font-size: .9rem;
}
.toolbar input[type=text] { flex: 1; min-width: 220px; }
.toolbar label { color: var(--muted); font-size: .85rem; display: inline-flex; align-items: center; gap: .35rem; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.card-thumb {
    position: relative; overflow: hidden;
    height: 120px; display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: .8rem .9rem; display: flex; flex-direction: column; gap: .4rem; }
.card-title { font-weight: 600; color: var(--text); }
.card-desc { color: var(--muted); font-size: .82rem; line-height: 1.35; min-height: 2.4em; }
.card-meta { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .2rem; }

/* Badges & tags */
.badge {
    font-size: .68rem; padding: .12rem .5rem; border-radius: 999px;
    background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge.cat { color: var(--accent); border-color: rgba(91,141,239,.4); }
.badge.stride { color: var(--text); }
.badge.certified { color: var(--ok); border-color: rgba(74,222,128,.4); }
.badge.nuget { color: var(--accent-2); border-color: rgba(138,91,239,.4); }
.badge.stars { color: #facc15; border-color: rgba(250,204,21,.4); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.tag { font-size: .7rem; color: var(--muted); }

/* States */
.notice { color: var(--muted); padding: 2rem 0; }
.notice.error { color: var(--warn); }
.cache-note { color: var(--warn); font-size: .8rem; margin-bottom: .8rem; }

/* Detail */
.detail-head { display: flex; gap: 1.2rem; align-items: flex-start; margin-bottom: 1.2rem; }
.detail-thumb { position: relative; overflow: hidden; width: 96px; height: 96px; border-radius: var(--radius); flex: none;
    display: flex; align-items: center; justify-content: center; font-size: 2.4rem; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.detail h1 { margin: 0 0 .2rem; font-size: 1.5rem; }
.detail .sub { color: var(--muted); font-size: .9rem; }
.detail section { margin: 1.2rem 0; }
.detail h2 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 .5rem; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: .4rem .8rem; font-size: .9rem; }
.extdeps { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.extdep { display: flex; align-items: baseline; gap: .6rem; padding: .45rem .85rem;
    border-top: 1px solid var(--border); font-size: .9rem; }
.extdep:first-child { border-top: none; }
.extdep-name { word-break: break-all; }
.extdep-ver { color: var(--muted); flex: none; white-space: nowrap; }

/* Repository file tree */
.filetree { border: 1px solid var(--border); border-radius: 10px; padding: .4rem .7rem; max-height: 400px; overflow: auto; font-size: .85rem; }
.tree-folder { margin: .05rem 0; }
.tree-folder > summary { cursor: pointer; list-style: none; padding: .15rem 0; user-select: none; }
.tree-folder > summary::-webkit-details-marker { display: none; }
.tree-folder > summary::before { content: "▸"; display: inline-block; width: 1em; color: var(--muted); transition: transform .12s ease; }
.tree-folder[open] > summary::before { transform: rotate(90deg); }
.tree-children { margin-left: .8rem; border-left: 1px solid var(--border); padding-left: .7rem; }
.tree-file { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .15rem 0; }
.tree-ico { opacity: .85; margin-right: .15rem; }
.filesize { color: var(--muted); flex: none; white-space: nowrap; }

/* Rendered README */
.readme { line-height: 1.6; }
.readme h1, .readme h2, .readme h3, .readme h4 { margin: 1.2rem 0 .5rem; line-height: 1.3; }
.readme h1 { font-size: 1.5rem; } .readme h2 { font-size: 1.25rem; } .readme h3 { font-size: 1.05rem; }
.readme p { margin: .5rem 0; }
.readme ul, .readme ol { margin: .5rem 0 .5rem 1.4rem; }
.readme code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 5px; font-size: .9em; }
.readme pre { background: var(--surface-2); padding: .8rem; border-radius: 8px; overflow-x: auto; border: 1px solid var(--border); }
.readme pre code { background: none; padding: 0; }
.readme img { max-width: 100%; height: auto; border-radius: 6px; }
.readme a { color: var(--accent); }
.readme table { border-collapse: collapse; margin: .5rem 0; }
.readme th, .readme td { border: 1px solid var(--border); padding: .3rem .6rem; }
.readme blockquote { border-left: 3px solid var(--border); margin: .5rem 0; padding: .2rem .9rem; color: var(--muted); }

.kv .k { color: var(--muted); }
.mono { font-family: 'Cascadia Code', Consolas, monospace; font-size: .82rem; }
.back { display: inline-block; margin-bottom: 1rem; color: var(--muted); }
/* Import-mode tabs */
.modes { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: .8rem; }
.mode {
    background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--muted); padding: .5rem .9rem; cursor: pointer; font-size: .9rem; font-weight: 600;
}
.mode:hover:not(.disabled):not(.active) { color: var(--text); }
.mode.active { color: var(--accent); border-bottom-color: var(--accent); }
.mode.disabled { opacity: .4; cursor: not-allowed; }
.mode-desc { color: var(--muted); font-size: .85rem; margin: 0 0 .7rem; }
.mode-desc code { background: var(--bg); padding: .05rem .3rem; border-radius: 4px; }
.install-grid { display: flex; flex-direction: column; gap: .5rem; max-width: 760px; }
.field { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .85rem; }
.install-cta { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; padding: .7rem .8rem;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); border: 1px solid var(--accent);
    border-radius: var(--radius); }

/* Screenshot gallery + lightbox */
.gallery { display: flex; flex-wrap: wrap; gap: .5rem; margin: .2rem 0 1rem; }
.gallery .shot { padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
    background: var(--surface-2); cursor: zoom-in; width: 132px; height: 88px; flex: none; transition: border-color .12s ease; }
.gallery .shot:hover { border-color: var(--accent); }
.gallery .shot img, .gallery .shot video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .shot { position: relative; }
.shot-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.4rem; text-shadow: 0 1px 6px rgba(0,0,0,.7); pointer-events: none;
    background: rgba(0,0,0,.18); }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.82);
    display: flex; align-items: center; justify-content: center; padding: 3vh 4vw; }
.lightbox .lb-img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,.5); cursor: default; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px;
    border: none; border-radius: 8px; background: rgba(255,255,255,.08); color: #fff; font-size: 2rem;
    cursor: pointer; line-height: 1; }
.lb-nav:hover { background: rgba(255,255,255,.18); }
.lb-nav.prev { left: 2vw; } .lb-nav.next { right: 2vw; }
.lb-close { position: absolute; top: 2.5vh; right: 2.5vw; width: 40px; height: 40px; border: none;
    border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 1.1rem; cursor: pointer; }
.lb-close:hover { background: rgba(255,255,255,.22); }
.lb-count { position: absolute; bottom: 2.5vh; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,.8); font-size: .85rem; background: rgba(0,0,0,.4); padding: .2rem .6rem; border-radius: 999px; }

/* File-system picker (desktop install) */
.fb-path { display: flex; gap: .4rem; align-items: center; }
.fb-path .ipt { flex: 1; }
.fs { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.fs-row { display: flex; align-items: center; gap: .5rem; background: none; border: none; border-bottom: 1px solid var(--border);
    color: var(--text); text-align: left; padding: .4rem .7rem; cursor: pointer; font-size: .88rem; }
.fs-row:last-child { border-bottom: none; }
.fs-row:hover { background: var(--surface-2); }
.fs-row.file { color: var(--accent); }
.fs-ico { width: 1.2rem; }
.check { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; font-size: .9rem; }
.check .install-hint { margin-left: .3rem; }

/* Publish page */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.panel h2 { margin-top: 0; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem 1rem; }
.form label { display: flex; flex-direction: column; gap: .25rem; font-size: .82rem; color: var(--muted); }
.form label.wide { grid-column: 1 / -1; }
.ipt { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: .45rem .6rem; font-size: .9rem; }
.problems { margin: .6rem 0 0; padding-left: 1.1rem; color: var(--warn); font-size: .82rem; }
.problems li { margin: .1rem 0; }

/* Environment badge */
.env { font-size: .8rem; margin-right: 1rem; }
.env.local { color: var(--ok); }
.env.online { color: var(--accent); }

/* Install / commands */
.cmd { display: flex; align-items: center; gap: .5rem; margin: .4rem 0; }
.cmd code {
    flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
    padding: .45rem .6rem; font-family: 'Cascadia Code', Consolas, monospace; font-size: .82rem; overflow-x: auto;
}
.btn {
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
    border-radius: 6px; padding: .45rem .7rem; cursor: pointer; font-size: .82rem;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover, .btn[disabled]:hover { border-color: var(--border); filter: none; }
.install-hint { color: var(--muted); font-size: .82rem; margin-top: .3rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Boot loading indicator (shown until the WASM runtime starts) */
.loading-progress {
    position: relative; display: block; width: 6rem; height: 6rem; margin: 22vh auto 1rem auto;
}
.loading-progress circle {
    fill: none; stroke: var(--border); stroke-width: .5rem;
    transform-origin: 50% 50%; transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * .8), 500%;
    transition: stroke-dasharray .05s ease-in-out;
}
.loading-progress-text {
    position: absolute; text-align: center; font-weight: 600; inset: calc(22vh + 2.6rem) 0 auto 0; color: var(--muted);
}
.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* Blazor Server reconnection overlay (themed) */
#components-reconnect-modal { display: none; }
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex; position: fixed; inset: 0; z-index: 2000;
    align-items: center; justify-content: center;
    background: rgba(8, 10, 14, .72); backdrop-filter: blur(3px);
}
.reconnect-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    padding: 1.6rem 2rem; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.5); min-width: 280px;
}
.reconnect-spinner {
    width: 38px; height: 38px; margin: 0 auto .9rem; border-radius: 50%;
    border: 3px solid var(--border); border-top-color: var(--accent);
    animation: reconnect-spin .8s linear infinite;
}
@keyframes reconnect-spin { to { transform: rotate(360deg); } }
.reconnect-title { font-weight: 600; color: var(--text); }
.reconnect-sub { color: var(--muted); font-size: .82rem; margin-top: .25rem; }
#components-reconnect-modal.components-reconnect-failed .reconnect-spinner,
#components-reconnect-modal.components-reconnect-rejected .reconnect-spinner { border-top-color: var(--warn); animation: none; }

/* Blazor error UI — hidden until an actual error occurs */
#blazor-error-ui {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: var(--surface-2); color: var(--text);
    border-top: 1px solid var(--warn); padding: .8rem 1.2rem; box-shadow: 0 -2px 10px rgba(0,0,0,.4);
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ---------------------------------------------------------------- UI polish pass */
html, body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

.card { box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: border-color .15s, transform .15s, box-shadow .15s; }
.card:hover { box-shadow: 0 10px 28px rgba(0,0,0,.4); }

.badge { padding: .15rem .55rem; font-weight: 500; }
.btn { transition: filter .12s ease, border-color .12s ease, transform .05s ease; border-radius: 7px; }
.btn:active { transform: translateY(1px); }

.panel { box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.detail h1 { letter-spacing: -.01em; }

/* Key/value detail blocks → bordered rows */
.detail .kv, .panel .kv { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; gap: 0; }
.kv > span { padding: .5rem .85rem; border-top: 1px solid var(--border); display: flex; align-items: center; }
.kv > span.k { color: var(--muted); background: rgba(255,255,255,.02); }
.kv > span:first-child, .kv > span:nth-child(2) { border-top: none; }

.cache-note { border-radius: 9px; padding: .6rem .85rem; background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.32); color: #fde68a; }

/* Validation panel (per-line, coloured, with icons) */
.validation { border-radius: 11px; padding: .85rem 1rem; margin: 1rem 0; border: 1px solid; }
.validation.error { background: linear-gradient(180deg, rgba(239,68,68,.12), rgba(239,68,68,.05)); border-color: rgba(239,68,68,.45); }
.validation.warning { background: linear-gradient(180deg, rgba(251,191,36,.12), rgba(251,191,36,.05)); border-color: rgba(251,191,36,.45); }
.validation-head { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .95rem; }
.validation.error .validation-head { color: #fca5a5; }
.validation.warning .validation-head { color: #fcd34d; }
.vbig { font-size: 1.15rem; }
.validation-list { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.vline { display: flex; align-items: flex-start; gap: .5rem; font-size: .85rem; line-height: 1.4;
    background: rgba(0,0,0,.18); border-radius: 7px; padding: .4rem .6rem; }
.vline.err { color: #fecaca; }
.vline.warn { color: #fde9b5; }
.vline .vico { flex: none; font-weight: 700; }
.vcode { font-family: 'Cascadia Code', Consolas, monospace; font-size: .72rem; opacity: .8;
    background: rgba(255,255,255,.07); border-radius: 4px; padding: .05rem .35rem; margin-right: .25rem; }

/* Inputs: subtle focus ring */
.ipt:focus, .toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(91,141,239,.25); }
