/*
 * Admin Achievements — page-specific styles (ADMIN REDESIGN Step 9).
 *
 * Renders inside .main (light tokens). The gallery card itself is the
 * reusable .tile archetype, the overflow menu is the reusable .menu popover,
 * and the loading shimmer is the reusable .skeleton — all live in
 * components.css. This file owns only what's specific to this page: the
 * toolbar, the card stat row, the skeleton geometry, the upload preview, and
 * the empty/error states. All colours come from tokens (no hardcoded hex).
 */

.ach-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* ─── Filter bar ──────────────────────────────────────────────────────── */

/* The page-level actions (Rebuild + Add) live in .page-head__actions, so this
   bar is a clean, balanced filter row: search grows on the left, the two
   selects sit beside it, and the result count anchors to the right. */
.ach-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

/* Search input with a leading magnifier icon. */
.ach-search {
    position: relative;
    flex: 1 1 300px;
    min-width: 220px;
    max-width: 440px;
}
.ach-search__icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
    pointer-events: none;
}
.ach-search:focus-within .ach-search__icon { color: var(--color-accent); }
.ach-search__input { width: 100%; padding-left: 36px; }

/* Filter selects size to content + sit inline (beat the global width:100%). */
.ach-toolbar .ach-filter {
    width: auto;
    flex: 0 0 auto;
    min-width: 156px;
    max-width: 210px;
}

.ach-count {
    flex: 0 0 auto;
    margin-left: auto;        /* anchor the count to the right of the bar */
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ─── Card: bigger portrait art ──────────────────────────────────────── */

/* These badges are portrait posters (2:3) — give them a tall band so the
   artwork reads large. The kit frames the image (radius + shadow + spotlight). */
.ach-page .tile__art {
    height: 288px;
    padding: var(--space-base) var(--space-lg);
}

/* ─── Card: trigger pill + labeled stat sheet ────────────────────────── */

.tile__body .ach-trigger {
    align-self: flex-start;
    max-width: 100%;
    margin-top: 2px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    border: 1px solid var(--hairline);
    color: var(--color-text-secondary);
    font-family: var(--font-mono, ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ach-stats {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 10px 0 0;
    padding-top: var(--space-md);
    border-top: 1px solid var(--hairline);
}
.ach-stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-md);
    margin: 0;
}
.ach-stat__label {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}
.ach-stat__value {
    margin: 0;
    min-width: 0;
    text-align: right;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ach-edit-btn { flex: 1 1 auto; }
.ach-menu-btn { flex: 0 0 auto; }

/* ─── Skeleton tile geometry (reuses the .skeleton shimmer) ──────────── */

.ach-skel { border-radius: var(--radius-sm); }
.ach-skel--art { align-self: stretch; flex: 1 1 auto; width: 100%; border-radius: var(--radius-md); }
.ach-skel--title { height: 17px; width: 70%; }
.ach-skel--trigger { height: 18px; width: 40%; margin-top: 8px; border-radius: var(--radius-sm); }
.ach-skel--line { height: 11px; width: 100%; margin-top: 8px; }
.ach-skel--short { width: 80%; }
.ach-skel--stats { height: 76px; width: 100%; margin-top: 12px; }
.ach-skel--btn { height: 34px; flex: 1 1 auto; }
.ach-skel--menu { height: 34px; width: 34px; flex: 0 0 34px; }

/* ─── Empty + error states ───────────────────────────────────────────── */

.ach-empty__title {
    margin: 0 0 6px;
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text);
}
.ach-empty__hint {
    margin: 0;
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--color-text-secondary);
}

.ach-error {
    padding: var(--space-lg) var(--space-base);
    text-align: center;
    color: var(--color-danger);
    background: rgba(217, 45, 32, 0.06);
    border: 1px solid rgba(217, 45, 32, 0.28);
    border-radius: var(--radius-md);
}

/* ─── Upload modal (PNG file input + preview) ────────────────────────── */

.ach-file { padding: 7px 10px; cursor: pointer; }

.ach-upload-preview {
    margin-top: var(--space-md);
    padding: var(--space-base);
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-sunken);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}
.ach-upload-preview img {
    max-height: 240px;
    max-width: 100%;
    border-radius: var(--radius-sm);
    display: block;
}
.ach-upload-preview__empty {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

/* ─── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .ach-search { max-width: none; flex-basis: 100%; }
    .ach-toolbar .ach-filter { flex: 1 1 0; max-width: none; min-width: 0; }
    .ach-count { margin-left: 0; flex-basis: 100%; }
    .ach-page .tile__art { height: 300px; }
    /* Page-head actions stack full-width and read as a clear action pair. */
    .page-head__actions { width: 100%; }
    .page-head__actions .btn { flex: 1 1 auto; }
}
