/* Anime Wordle - Achievements styles
 * Used by the profile page achievements list and the global unlock toast.
 *
 * Visual language matches shared/streak.css and shared/leaderboard.css —
 * deep ocean panels, soft sky borders, rounded corners, no nested cards.
 *
 * Variables used (defined in shared/styles.css / per-page):
 *   --bg-card, --bg-dropdown, --accent-sky, --accent-ocean,
 *   --color-correct, --color-close, --color-incorrect,
 *   --text-primary, --text-secondary
 */

/* =====================================================================
 * Achievement list (profile page tab)
 * ================================================================== */

.ach-list {
    list-style: none;
    margin: 0;
    padding: 8px 6px 8px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 60vh;
    overflow-y: auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary, #F5F5F0);

    /* Subtle scrollbar — matches the ocean panel aesthetic. */
    scrollbar-width: thin;
    scrollbar-color: rgba(91, 164, 212, 0.45) transparent;
}

.ach-list::-webkit-scrollbar {
    width: 8px;
}
.ach-list::-webkit-scrollbar-track {
    background: transparent;
}
.ach-list::-webkit-scrollbar-thumb {
    background: rgba(91, 164, 212, 0.35);
    border-radius: 999px;
}
.ach-list::-webkit-scrollbar-thumb:hover {
    background: rgba(91, 164, 212, 0.6);
}

.ach-empty {
    padding: 24px 12px;
    text-align: center;
    color: rgba(245, 245, 240, 0.65);
    font-size: 0.9rem;
}

/* ---------------------------------------------------------------------
 * Row: 3-column grid keeps the progress bar pinned to a stable bottom
 * edge so locked/unlocked transitions never shift layout.
 * ------------------------------------------------------------------ */

.ach-row {
    position: relative;
    display: grid;
    grid-template-columns: 44px 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 12px 14px 12px; /* bottom padding leaves room for the bar */
    background: var(--bg-card, rgba(20, 60, 100, 0.85));
    border: 1px solid rgba(91, 164, 212, 0.2);
    border-radius: 12px;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.ach-row.is-unlocked {
    border-color: var(--accent-sky, #5BA4D4);
    background: rgba(20, 60, 100, 0.92);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.ach-row.is-locked {
    opacity: 0.55;
}

.ach-row.is-locked .ach-icon {
    filter: grayscale(0.85);
}

.ach-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 1.6rem;
    line-height: 1;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(91, 164, 212, 0.25);
    border-radius: 10px;
    color: var(--text-primary, #F5F5F0);
    user-select: none;
}

.ach-row.is-unlocked .ach-icon {
    background: rgba(91, 164, 212, 0.18);
    border-color: rgba(91, 164, 212, 0.55);
    filter: drop-shadow(0 0 6px rgba(91, 164, 212, 0.45));
}

.ach-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ach-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary, #F5F5F0);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ach-desc {
    font-size: 0.82rem;
    color: var(--text-secondary, rgba(245, 245, 240, 0.75));
    line-height: 1.3;
}

.ach-progress-text {
    margin-top: 2px;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(245, 245, 240, 0.7);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.ach-row.is-unlocked .ach-progress-text {
    color: var(--accent-sky, #5BA4D4);
}

/* ---------------------------------------------------------------------
 * Progress bar pinned to the bottom of the row.
 * Fixed height + position so it never shifts the layout above it.
 * ------------------------------------------------------------------ */

.ach-progress-bar {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 6px;
    height: 6px;
    background: rgba(245, 245, 240, 0.12);
    border-radius: 999px;
    overflow: hidden;
}

.ach-progress-fill {
    height: 100%;
    width: 0;
    background: rgba(245, 245, 240, 0.18);
    border-radius: inherit;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ach-row.is-unlocked .ach-progress-fill {
    background: linear-gradient(90deg,
        var(--accent-sky, #5BA4D4) 0%,
        var(--accent-ocean, #1E5A8A) 100%);
    box-shadow: 0 0 8px rgba(91, 164, 212, 0.45);
}

/* =====================================================================
 * Unlock toast (global; appears on game pages too)
 * ================================================================== */

.ach-toast-container {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    z-index: 9999;
    width: min(420px, 92vw);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.ach-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-dropdown, rgba(15, 45, 80, 0.96));
    border: 1px solid var(--accent-sky, #5BA4D4);
    border-radius: 12px;
    color: var(--text-primary, #F5F5F0);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ach-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.ach-toast.is-leaving {
    opacity: 0;
    transform: translateY(-12px);
}

.ach-toast-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    background: rgba(91, 164, 212, 0.18);
    border: 1px solid rgba(91, 164, 212, 0.5);
    border-radius: 10px;
    filter: drop-shadow(0 0 6px rgba(91, 164, 212, 0.55));
}

.ach-toast-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ach-toast-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-correct, #5BA4D4);
}

.ach-toast-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary, #F5F5F0);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =====================================================================
 * Reduced motion: drop slide and progress fill animations.
 * ================================================================== */

@media (prefers-reduced-motion: reduce) {
    .ach-row,
    .ach-progress-fill,
    .ach-toast {
        transition: opacity 0.15s ease !important;
        animation: none !important;
    }
    .ach-toast {
        transform: none !important;
    }
    .ach-toast.is-visible,
    .ach-toast.is-leaving {
        transform: none !important;
    }
}

/* =====================================================================
 * Mobile tweaks
 * ================================================================== */

@media (max-width: 600px) {
    .ach-list {
        max-height: 65vh;
        gap: 6px;
        padding-right: 2px;
    }
    .ach-row {
        grid-template-columns: 38px 1fr;
        gap: 10px;
        padding: 9px 10px 13px 10px;
    }
    .ach-icon {
        width: 38px;
        height: 38px;
        font-size: 1.35rem;
        border-radius: 9px;
    }
    .ach-title { font-size: 0.9rem; }
    .ach-desc  { font-size: 0.78rem; }
    .ach-progress-text { font-size: 0.74rem; }

    .ach-toast {
        padding: 9px 12px;
        gap: 10px;
    }
    .ach-toast-icon {
        width: 34px;
        height: 34px;
        font-size: 1.3rem;
    }
    .ach-toast-title { font-size: 0.9rem; }
}
