/*
 * Achievements — the badge wall and the reveal.
 *
 * Every class here is es_ach_ prefixed on purpose. The theme claims bare
 * Bootstrap names: `.badge` is styled white-on-transparent and would render an
 * invisible badge, which on a celebration modal is the worst possible first
 * impression. Nothing below relies on a Bootstrap component class except the
 * modal shell itself.
 */

/* ---------------------------------------------------------------- the wall */

.es_ach_wall_head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.es_ach_wall_title {
    margin: 0;
    font-size: 1.15rem;
}

.es_ach_count {
    font-size: .8rem;
    font-weight: 400;
    color: #6c757d;
    margin-left: 6px;
}

.es_ach_points {
    text-align: right;
    line-height: 1.2;
}

.es_ach_points_num {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1c4966;
}

.es_ach_points_label {
    font-size: .8rem;
    color: #6c757d;
}

.es_ach_points_sub {
    display: block;
    font-size: .75rem;
    color: #6c757d;
}

.es_ach_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.es_ach_item {
    text-align: center;
    padding: 16px 10px 14px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    background: #fff;
}

.es_ach_medal {
    width: 62px;
    height: 62px;
    margin: 0 auto 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.es_ach_name {
    font-weight: 700;
    font-size: .92rem;
    line-height: 1.25;
}

.es_ach_blurb {
    font-size: .78rem;
    color: #495057;
    margin-top: 6px;
    line-height: 1.35;
}

.es_ach_meta {
    font-size: .72rem;
    color: #868e96;
    margin-top: 6px;
}

/* Earned. */
.es_ach_held .es_ach_medal {
    background: linear-gradient(160deg, #2b7ea1, #1c4966);
    color: #fff;
    border: 2px solid #1c4966;
}

.es_ach_held {
    border-color: #b6d4e0;
}

/*
 * Not earned yet — a mystery rather than a preview.
 *
 * The dashed silhouette says a badge belongs here without saying which one: no
 * name, no icon, just a question mark in the ring it will eventually fill. The
 * name and icon are not merely hidden, they are never rendered (see
 * Achievements::wall_rows), so the page source keeps the secret too.
 *
 * What does stay is the goal and the progress bar. A mystery with nothing to
 * act on is only frustrating; the goal tells you what moves it, and the bar
 * shows it moving.
 */
.es_ach_locked {
    border-style: dashed;
    background: #f8f9fa;
}

.es_ach_locked .es_ach_medal {
    background: transparent;
    border: 2px dashed #adb5bd;
    color: #adb5bd;
    /* The glyph, not an icon font — nothing here should depend on Font Awesome
       having loaded, and a text ? scales with the ring. */
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
}

.es_ach_goal {
    font-size: .8rem;
    font-style: italic;
    color: #6c757d;
    line-height: 1.3;
    /* Occupies the space the name would, so earned and unearned tiles keep the
       same rhythm across the grid. */
    min-height: 2.4em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.es_ach_progress {
    height: 4px;
    border-radius: 2px;
    background: #dee2e6;
    margin-top: 8px;
    overflow: hidden;
}

.es_ach_progress_bar {
    display: block;
    height: 100%;
    background: #2b7ea1;
}

/* ------------------------------------------------- dashboard "latest badge" */

.es_ach_latest {
    text-align: center;
}

/*
 * The card inside the Tasks widget, which core's tasks/widget.twig wraps in
 * this class. It sits directly under the last task row and needs air, or the
 * medal reads as part of the list rather than as its own thing.
 *
 * Only here: the standalone dashboard widget already has the widget's own
 * padding around it and does not want a second gap.
 */
.es_ach_tasks_strip {
    margin-top: 15px;
}

.es_ach_medal_lg {
    width: 84px;
    height: 84px;
    font-size: 34px;
    margin-bottom: 12px;
}

.es_ach_latest .es_ach_medal_lg {
    background: linear-gradient(160deg, #2b7ea1, #1c4966);
    color: #fff;
    border: 2px solid #1c4966;
}

/* The no-badges-yet state borrows the locked ring, so an empty dashboard reads
   as "not yet" rather than as something broken. */
.es_ach_latest .es_ach_medal_empty {
    background: transparent;
    border: 2px dashed #adb5bd;
    color: #adb5bd;
    font-weight: 700;
    line-height: 1;
}

.es_ach_latest_name {
    font-weight: 700;
    font-size: 1.05rem;
}

.es_ach_latest_blurb {
    font-size: .82rem;
    color: #495057;
    margin-top: 4px;
    line-height: 1.35;
}

.es_ach_next {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #dee2e6;
}

.es_ach_next_head {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6c757d;
}

.es_ach_next_goal {
    font-size: .85rem;
    font-style: italic;
    color: #495057;
    margin: 3px 0 7px;
}

.es_ach_latest_foot {
    margin-top: 14px;
    font-size: .78rem;
    color: #6c757d;
}

.es_ach_kudos {
    color: #2b7ea1;
}

/* --------------------------------------------------------------- the reveal */

.es_ach_reveal_content {
    border: none;
    border-radius: 14px;
    overflow: hidden;
}

.es_ach_reveal .modal-body {
    padding: 34px 30px 28px;
}

.es_ach_reveal_medal {
    width: 108px;
    height: 108px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 46px;
    color: #fff;
    background: linear-gradient(160deg, #2b7ea1, #1c4966);
    box-shadow: 0 0 0 8px rgba(43, 126, 161, .15);
    animation: es_ach_pop .45s cubic-bezier(.2, .9, .3, 1.3) both;
}

.es_ach_reveal_kicker {
    text-transform: uppercase;
    letter-spacing: .09em;
    font-size: .7rem;
    color: #2b7ea1;
    margin: 0 0 2px;
}

.es_ach_reveal_title {
    font-size: 1.7rem;
    margin: 0 0 10px;
}

.es_ach_reveal_first {
    font-weight: 600;
    margin: 0 0 8px;
}

.es_ach_reveal_blurb {
    color: #495057;
    margin: 0 0 22px;
}

@keyframes es_ach_pop {
    from { transform: scale(.4); opacity: 0; }
    to   { transform: scale(1);  opacity: 1; }
}

/*
 * The modal still appears and still says the thing — it just does not fly.
 */
@media (prefers-reduced-motion: reduce) {
    .es_ach_reveal_medal {
        animation: none;
    }
}

/* ------------------------------------------------------------- gifting */

/*
 * The call to action on somebody else's wall. Only rendered when the viewer
 * has something to send, so it never appears as a control that always refuses.
 */
.es_ach_gift_cta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    margin: 0 0 16px;
}

.es_ach_gift_cta_sub,
.es_ach_gift_balance,
.es_ach_gift_optional {
    font-size: .8rem;
    color: #6c757d;
}

.es_ach_gift_title {
    margin: 0 0 14px;
    font-size: 1.1rem;
}

.es_ach_gift_row {
    margin-bottom: 14px;
}

.es_ach_gift_row label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.es_ach_gift_points {
    width: 90px;
    display: inline-block;
    margin-right: 8px;
}

/*
 * The reassurance is the point of the whole feature: gifting spends balance and
 * never earned, so it cannot cost a badge. People do not believe that until it
 * is written down next to the button.
 */
.es_ach_gift_reassure {
    font-size: .82rem;
    color: #495057;
    background: #f1f5f9;
    border-left: 3px solid #94a3b8;
    padding: 8px 10px;
    margin: 0 0 16px;
}

.es_ach_gift_actions {
    text-align: right;
}

.es_ach_gift_error {
    color: #842029;
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    border-radius: 4px;
    padding: 8px 10px;
    margin: 0 0 14px;
}

.es_ach_gift_notice {
    padding: 6px 2px;
}

/*
 * Said on the refreshed wall after a gift. Deliberately not .alert — the theme
 * claims bare Bootstrap names, and .badge is already invisible under it.
 */
.es_ach_flash {
    border-radius: 4px;
    padding: 9px 12px;
    margin: 0 0 14px;
    font-size: .9rem;
}

.es_ach_flash_success {
    color: #0f5132;
    background: #d1e7dd;
    border: 1px solid #badbcc;
}

.es_ach_flash_error {
    color: #842029;
    background: #f8d7da;
    border: 1px solid #f5c2c7;
}

/* --------------------------------------------------------- leaderboard */

.es_ach_board_head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
}

.es_ach_board_title {
    margin: 0;
    font-size: 1.15rem;
}

.es_ach_board_sub,
.es_ach_board_note,
.es_ach_board_unit {
    font-size: .8rem;
    color: #6c757d;
}

.es_ach_board_list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
}

.es_ach_board_row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid #e9ecef;
}

.es_ach_board_rank {
    flex: 0 0 2em;
    font-weight: 700;
    color: #6c757d;
    text-align: right;
}

.es_ach_board_name {
    flex: 1 1 auto;
}

.es_ach_board_badges {
    flex: 0 0 auto;
    font-size: .8rem;
    color: #6c757d;
}

.es_ach_board_score {
    flex: 0 0 auto;
    font-weight: 700;
    min-width: 5.5em;
    text-align: right;
}

/* The viewer's own row, so it can be found without counting down the list. */
.es_ach_board_you {
    background: #eef4f8;
    border-radius: 4px;
}

/*
 * es_ach_ prefixed like everything else here: the theme styles bare `.badge`
 * white-on-transparent, so a Bootstrap name would render this invisible.
 */
.es_ach_board_flag {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #fff;
    background: #2d6a8e;
    border-radius: 3px;
    padding: 1px 6px;
    margin-left: 6px;
}

/* Separated from the top of the board, which it is not contiguous with. */
.es_ach_board_yours {
    margin-top: -4px;
    border-top: 2px dashed #dee2e6;
    padding-top: 8px;
}

.es_ach_board_empty {
    color: #495057;
    background: #f1f5f9;
    border-left: 3px solid #94a3b8;
    padding: 10px 12px;
    margin: 0 0 14px;
}

.es_ach_board_link {
    margin: 14px 0 0;
    font-size: .9rem;
}

/* The second board on the leaderboard page, set apart from the monthly one. */
.es_ach_hall_head {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid #e9ecef;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Admin — Points Sources and Manual Awards (1.7.0)

   Module-scoped names throughout. The theme reuses several Bootstrap class
   names for something else entirely, so .badge and friends are avoided here.
   ═══════════════════════════════════════════════════════════════════════════ */

.es_ach_adminnav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #dfe4e8;
    margin: 0 0 18px;
}

.es_ach_adminnav_item {
    padding: 8px 16px;
    color: #4a5560;
    text-decoration: none;
    border-radius: 4px 4px 0 0;
    font-weight: 600;
    font-size: 14px;
}

.es_ach_adminnav_item:hover {
    background: #eef2f5;
    text-decoration: none;
}

.es_ach_adminnav_current {
    background: #1a7ab5;
    color: #fff;
}

.es_ach_adminnav_current:hover {
    background: #1a7ab5;
    color: #fff;
}

.es_ach_panel {
    background: #fff;
    border: 1px solid #dfe4e8;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.es_ach_panel_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.es_ach_panel_head h3 { margin: 0; }

/* The search box sits outside the replaced div, so it keeps its own spacing. */
.es_ach_search { margin: 12px 0; max-width: 380px; }

/* ── the sources table ─────────────────────────────────────────────────── */

.es_ach_sources code {
    font-size: 12px;
    background: #f4f6f8;
    padding: 1px 4px;
    border-radius: 3px;
}

/* A source that is not counting is dimmed rather than hidden: knowing it was
   declared and is not running is the whole reason to look at this screen. */
.es_ach_source_absent td,
.es_ach_source_broken td { color: #8a939b; }

.es_ach_status {
    display: inline-block;
    font-size: 10px;
    border-radius: 3px;
    padding: 1px 6px;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.es_ach_status_ok      { background: #e6f6ec; color: #1c7a45; border: 1px solid #b3e0c4; }
.es_ach_status_absent  { background: #f1f3f5; color: #6c757d; border: 1px solid #d8dde1; }
.es_ach_status_broken  { background: #fdecec; color: #a32020; border: 1px solid #f2c2c2; }

/* ── the awards table ──────────────────────────────────────────────────── */

.es_ach_awards .es_ach_award_when   { white-space: nowrap; color: #6c757d; font-size: 13px; }
.es_ach_awards .es_ach_award_points { font-weight: 700; text-align: right; width: 5em; }
.es_ach_awards .es_ach_award_actions { text-align: right; white-space: nowrap; }

.es_ach_modal_title { margin-top: 0; }

.es_ach_award_form .form-group { margin-bottom: 14px; }

/* ==========================================================================
   Badge images (Achievements 1.9.0)

   An uploaded image replaces the Font Awesome icon wherever a badge appears.
   It is stored downsampled to fit 256px, and every frame it lands in is
   smaller than that, so it is only ever scaled DOWN in the browser.
   ========================================================================== */

.es_ach_medal_img {
    /* fills the round medal frame without distorting a non-square upload */
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* --- the admin list ------------------------------------------------------ */

.es_ach_badges_admin .es_ach_badge_cell {
    width: 64px;
    text-align: center;
    vertical-align: middle;
}

.es_ach_badges_admin .es_ach_badge_img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
}

.es_ach_badges_admin .es_ach_badge_icon {
    font-size: 28px;
    color: #1b6b60;
}

.es_ach_badges_admin .es_ach_badge_blurb {
    font-size: .85em;
}

.es_ach_badges_admin .es_ach_badge_key {
    font-size: .78em;
    opacity: .7;
}

/* A hidden badge still has to be findable — it is greyed, not removed, or the
   screen could not show you the thing you hid. */
.es_ach_badge_hidden_row {
    opacity: .55;
}

/* Named es_ach_tag_ rather than .badge: the theme redefines Bootstrap's badge
   as white-on-transparent, which is invisible. */
.es_ach_tag_hidden,
.es_ach_tag_admin {
    display: inline-block;
    font-size: .72em;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 2px;
    border: 1px solid currentColor;
}

.es_ach_tag_hidden { color: #9c4630; background: #f1ded8; }
.es_ach_tag_admin  { color: #1b6b60; background: #dce8e4; }

/* --- the form ------------------------------------------------------------ */

.es_ach_badge_current {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
}

.es_ach_badge_current img {
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid #d5d5d5;
}

.es_ach_badge_remove,
.es_ach_badge_hide {
    font-weight: 400;
    display: block;
}

/* --- the start date, editable on the Points Sources screen (1.9.1) -------- */

.es_ach_startdate {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin: 0 0 18px;
    border: 1px solid #cbd4c9;
    border-radius: 3px;
    background: #f5f7f4;
}

.es_ach_startdate label {
    margin: 0;
    font-weight: 600;
}

.es_ach_startdate input[type="date"] {
    padding: 4px 8px;
    border: 1px solid #cbd4c9;
    border-radius: 3px;
}

.es_ach_startdate_note {
    flex: 1 1 320px;
    font-size: .86em;
    color: #4c5c55;
}

/* Unset is the state that matters — it is why the badge widget is missing. */
.es_ach_startdate_unset {
    color: #9c4630;
}

/* A source counted for badges but worth no points (1.9.4). Named es_ach_
   rather than .badge, which the theme renders white-on-transparent. */
.es_ach_unscored {
    display: inline-block;
    font-size: .8em;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #8a6a3b;
    background: #f2e9cf;
    border: 1px solid currentColor;
    border-radius: 2px;
    padding: 1px 6px;
}

/* The Facts table sits under the Sources one on the same screen (1.10.0). */
.es_ach_facts_head {
    margin-top: 32px;
}
