/*
    Shared styling for the theme gallery, its cards, the preview frame and the current-theme tile.
    Not scoped per-component (::deep would be needed everywhere) — these classes are all prefixed and
    only used by the Components/Themes set. Linked from App.razor alongside the other site CSS.
*/

/* ── Theme card ─────────────────────────────────────────────────────────────────────────────── */
.tc-card {
    width: 110px;
    cursor: pointer;
    border-radius: 12px;
    padding: 4px;
    border: 2px solid transparent;
    transition: border-color 150ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
    -webkit-tap-highlight-color: transparent;
}
/* Hover lift only with a real pointer — on touch, :hover latches after the tap. */
@media (hover: hover) and (pointer: fine) {
    .tc-card:hover { transform: translateY(-2px); }
}
.tc-card:active { transform: scale(0.97); transition-duration: 100ms; }
.tc-card:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.tc-card.selected { border-color: var(--accent-primary); }

.tc-thumb {
    position: relative;
    height: 64px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.tc-thumb svg {
    width: 26px; height: 26px;
    fill: none; stroke: rgba(255,255,255,.9); stroke-width: 1.5;
    stroke-linecap: round; stroke-linejoin: round;
}
.tc-emoji { font-size: 1.5rem; line-height: 1; }

.tc-badge {
    position: absolute;
    left: 4px; right: 4px; bottom: 4px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-align: center;
    padding: 2px 0;
    border-radius: 6px;
    background: rgba(224, 160, 60, .92);
    color: #2a1c05;
}

.tc-label {
    margin-top: 6px;
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.25;
}
.tc-card.needs-setup .tc-thumb { opacity: .78; }

/* ── Preview frame ──────────────────────────────────────────────────────────────────────────── */
.tpf-stage {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 6px 18px rgba(0,0,0,.28);
    flex: none;
}
.tpf-frame {
    position: absolute;
    top: 0; left: 0;
    border: 0;
    transform-origin: top left;
    /* The preview is for looking at, not clicking into. */
    pointer-events: none;
}
.tpf-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%; padding: 12px;
    font-size: 12px; text-align: center; color: var(--text-muted);
}

/* ── Gallery dialog ─────────────────────────────────────────────────────────────────────────── */
.tg-root {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    min-height: 60vh;
}
.tg-browse { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.tg-detail {
    flex: 0 0 340px;
    position: sticky; top: 0;
    display: flex; flex-direction: column; gap: 12px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(0,0,0,.04);
}

.tg-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tg-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; cursor: pointer; }

.tg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tg-chip {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(128,128,128,.35);
    background: transparent;
    color: inherit;
    font-family: inherit;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 150ms ease, border-color 150ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
@media (hover: hover) and (pointer: fine) {
    .tg-chip:not(.on):hover { border-color: var(--color-amber-300); }
}
.tg-chip:active { transform: scale(0.97); transition-duration: 100ms; }
.tg-chip:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.tg-chip.on { border-color: var(--accent-primary); background: var(--accent-primary-soft); font-weight: 600; }

.tg-results { max-height: 58vh; overflow-y: auto; padding-right: 6px; }
.tg-cat { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; }
.tg-cat span { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.tg-rule { flex: 1; height: 1px; background: rgba(128,128,128,.25); }
.tg-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.tg-empty { font-size: 0.8125rem; color: var(--text-muted); padding: 24px 0; }

.tg-detail-empty { font-size: 0.8125rem; color: var(--text-muted); text-align: center; padding: 40px 12px; }
.tg-detail-head { display: flex; flex-direction: column; gap: 4px; }
.tg-detail-title { font-size: 1.0625rem; font-weight: 700; }
.tg-detail-desc { font-size: 0.75rem; color: var(--text-body-soft); line-height: 1.4; }
.tg-detail-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: auto; }

.tg-gap, .ct-gap {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    font-size: 0.75rem;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(224,160,60,.14);
    color: var(--color-warning-text);
}
.tg-gap a, .ct-gap a { color: inherit; font-weight: 700; }

/* ── Current-theme tile ─────────────────────────────────────────────────────────────────────── */
.ct-card { display: flex; flex-direction: column; gap: 16px; }
.ct-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.ct-preview { flex: none; }
.ct-none {
    display: flex; align-items: center; justify-content: center;
    width: 150px; height: 266px;
    border-radius: 12px;
    background: rgba(128,128,128,.14);
    font-size: 0.75rem; color: var(--text-body-soft);
}
.ct-meta { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ct-eyebrow { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.ct-title { font-size: 1.25rem; font-weight: 700; }
.ct-desc { font-size: 0.8125rem; color: var(--text-body-soft); line-height: 1.45; }
.ct-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.ct-link { font-size: 0.8125rem; font-weight: 600; text-decoration: none; }

.ct-options { border-top: 1px solid rgba(128,128,128,.2); padding-top: 14px; }
.ct-options-title {
    font-size: 0.6875rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-muted); margin-bottom: 10px;
}

/* ── Options panel ──────────────────────────────────────────────────────────────────────────── */
.top-panel { display: flex; flex-direction: column; gap: 16px; }
.top-field { display: flex; flex-direction: column; }
.top-field > label { font-size: 0.75rem; font-weight: 600; margin-bottom: 6px; color: var(--text-body-soft); }
.top-hint { font-size: 0.6875rem; color: var(--text-muted); margin-top: 4px; }
.top-note { font-size: 0.8125rem; color: var(--text-body-soft); margin: 0 0 8px; line-height: 1.45; }
.top-warn { font-size: 0.75rem; color: var(--color-danger-text); margin: 0; }
.top-link { font-size: 0.8125rem; font-weight: 600; text-decoration: none; }
.top-cta {
    display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
    border: 1px solid var(--accent-primary); background: rgba(224,138,99,.1); color: var(--accent-primary-deep);
    border-radius: 10px; padding: 10px 16px; font-size: 0.875rem; font-weight: 700;
    align-self: flex-start;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 150ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
@media (hover: hover) and (pointer: fine) {
    .top-cta:hover { background: rgba(224,138,99,.18); }
}
.top-cta:active { transform: scale(0.97); transition-duration: 100ms; }
.top-date {
    width: 100%; padding: 8px 12px; border-radius: 8px;
    border: 1px solid rgba(128,128,128,.3);
    background: rgba(128,128,128,.06);
    font-size: 0.875rem;
}

@media (max-width: 900px) {
    .tg-root { flex-direction: column; }
    .tg-detail { flex: 1 1 auto; width: 100%; position: static; }
    .tg-results { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
    .tc-card, .tg-chip, .top-cta { transition-property: border-color, background-color; }
}

/* Admin-only marker on a theme withdrawn from everyone else. Top corner, so it never
 collides with the Needs setup strip along the bottom. */
.tc-hidden {
    position: absolute;
    top: 4px; right: 4px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(74, 56, 38, .82);
    color: #fff;
}
