/* =========================================================
   LOGROS / ACHIEVEMENTS - BASE
========================================================= */

.vm-achievements {
    --vm-achievements-shadow: 0 1px 3px 0 #1111111a, 0 0 1px 0 #e1e1e1;
    --vm-achievements-shadow-hover: 0 2px 15px rgba(8, 16, 30, 0.06);
    --vm-achievements-border: var(--vm-border, #e5e7eb);
    --vm-achievements-soft: var(--vm-soft, #f8fafc);
    --vm-achievements-brand: var(--vm-brand, #1e293b);
    --vm-achievements-muted: #64748b;
    --vm-achievements-muted-soft: #94a3b8;
    --vm-achievements-accent: var(--vm-accent, #2563eb);
    --vm-achievements-success: #15803d;

    display: grid;
    gap: 24px;
    margin: 30px 0 50px;
}

.vm-achievements-card {
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--vm-achievements-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--vm-achievements-shadow);
}

.vm-achievements-card--summary,
.vm-achievements-card--featured {
    height: 100%;
}

.vm-achievements__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--vm-achievements-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.vm-achievements__title,
.vm-achievements__section-title,
.vm-achievements__featured-content h3,
.vm-badge-card__title,
.vm-next-card__content h4 {
    margin: 0;
    color: var(--vm-achievements-brand);
}

.vm-achievements__empty {
    padding: 16px 0;
    font-size: 14px;
}

.vm-achievements__empty p {
    margin: 8px 0 0;
    color: #475569;
    line-height: 1.55;
}


/* =========================================================
   HERO SUPERIOR
========================================================= */

.vm-achievements__hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 24px;
}

/* =========================================================
   CTA RANKING ENTRE HERO E INSIGNIAS
========================================================= */

.vm-achievements-ranking {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    min-width: 0;
    padding: 18px 22px;
    border: 1px solid rgba(37, 99, 235, 0.16);
    border-radius: 20px;
    background:
        radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.08), transparent 42%),
        linear-gradient(180deg, #ffffff 0%, var(--vm-achievements-soft) 100%);
    box-shadow: var(--vm-achievements-shadow);
}

.vm-achievements-ranking__main {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.vm-achievements-ranking__icon {
    display: grid;
    place-items: center;
    flex: 0 0 50px;
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: rgba(37, 99, 235, 0.11);
    color: var(--vm-achievements-accent);
}

.vm-achievements-ranking__icon svg {
    display: block;
    width: 25px;
    height: 25px;
    fill: currentColor;
}

.vm-achievements-ranking__copy {
    min-width: 0;
}

.vm-achievements-ranking__copy h3 {
    margin: 0;
    color: var(--vm-achievements-brand);
    font-size: 19px;
    line-height: 1.25;
}

.vm-achievements-ranking__copy p {
    margin: 5px 0 0;
    color: var(--vm-achievements-muted);
    font-size: 13.5px;
    line-height: 1.45;
}

.vm-achievements-ranking__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 10px 16px;
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-radius: 999px;
    background: #fff;
    color: var(--vm-achievements-brand);
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    box-shadow: none;
    transition:
        transform 0.16s ease,
        background-color 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease;
}

.vm-achievements-ranking__button:focus {
    border-style: solid !important;
    background: #fff;
    color: var(--vm-achievements-brand);
    outline: none;
}

.vm-achievements-ranking__button:hover {
    border-color: rgba(37, 99, 235, 0.35);
    background: var(--vm-achievements-brand);
    color: #fff;
    text-decoration: none;
}

/* =========================================================
   CARD RESUMEN DE NIVEL
========================================================= */

.vm-achievements__heading {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.vm-achievements__level-chip {
    display: inline-flex;
    align-self: flex-start;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--vm-achievements-accent);
    font-size: 13px;
    font-weight: 700;
}

.vm-achievements__title {
    font-size: clamp(1.65rem, 2vw, 2rem);
    line-height: 1.15;
}

.vm-achievements__stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.vm-achievements__stat {
    padding: 16px;
    border: 1px solid var(--vm-achievements-border);
    border-radius: 16px;
    background: var(--vm-achievements-soft);
}

.vm-achievements__stat-value {
    display: block;
    margin-bottom: 6px;
    color: var(--vm-achievements-brand);
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
}

.vm-achievements__stat-label {
    display: block;
    color: var(--vm-achievements-muted);
    font-size: 13px;
}

.vm-achievements__progress-wrap {
    display: grid;
    gap: 10px;
}

.vm-achievements__progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--vm-achievements-muted);
    font-size: 14px;
}


/* =========================================================
   BARRAS DE PROGRESO COMPARTIDAS
========================================================= */

.vm-achievements__progress,
.vm-badge-card__progress,
.vm-next-card__progress {
    position: relative;
    overflow: hidden;
    height: 12px;
    border-radius: 999px;
    background: #e2e8f0;
}

.vm-achievements__progress > span,
.vm-badge-card__progress > span,
.vm-next-card__progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--vm-achievements-accent), var(--vm-accent-2, #22c55e));
}


/* =========================================================
   IMÁGENES PNG DE BADGES
========================================================= */

.usm-gamification-badge-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}


/* =========================================================
   INSIGNIA DESTACADA
========================================================= */

.vm-achievements__featured-badge {
    display: flex;
    gap: 22px;
    align-items: center;
    flex-direction: column;
}

.vm-achievements__featured-icon {
    display: grid;
    place-items: center;
    width: 122px;
    height: 122px;
    overflow: visible;
    border-radius: 999px;
    background:
        radial-gradient(circle at 50% 45%, rgba(37, 99, 235, 0.10), transparent 64%),
        linear-gradient(180deg, #ffffff, #f8fafc);
    color: var(--vm-achievements-accent);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.10);
}

.vm-achievements__featured-icon .usm-gamification-badge-img {
    filter: drop-shadow(0 12px 20px rgba(15, 23, 42, 0.16));
}

.vm-achievements__featured-icon svg {
    width: 42px;
    height: 42px;
    color: var(--vm-achievements-accent);
}

.vm-achievements__featured-content {
    min-width: 0;
    text-align: center;
}

.vm-achievements__featured-content h3{
    font-size: 22px;
}

.vm-achievements__featured-content p {
    margin: 8px 0 0;
    color: #475569;
    font-size: 16px;
    line-height: 1.55;
}

.vm-achievements__featured-date {
    display: inline-block;
    margin-top: 12px;
    color: var(--vm-achievements-muted);
    font-size: 13px;
}


/* =========================================================
   CABECERAS DE SECCIÓN
========================================================= */

.vm-achievements__section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
}


/* =========================================================
   COLECCIÓN DE INSIGNIAS
========================================================= */

.vm-badge-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.vm-badge-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    min-width: 0;
    min-height: 174px;
    padding: 20px;
    border: 1px solid var(--vm-achievements-border);
    border-radius: 18px;
    background:
        radial-gradient(circle at 8% 12%, rgba(37, 99, 235, 0.055), transparent 36%),
        linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.vm-badge-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0), rgba(37, 99, 235, 0.035));
    opacity: 0;
    transition: opacity 0.18s ease;
}

.vm-badge-card:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: var(--vm-achievements-shadow-hover);
}

.vm-badge-card:hover::before {
    opacity: 1;
}

.vm-badge-card__media {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 126px;
    align-items: end;
}

.vm-badge-card__icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 118px;
    height: 118px;
    overflow: visible;
    border-radius: 999px;
    background:
        radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.4) 58%, transparent 70%);
    color: var(--vm-achievements-accent);
    transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.vm-badge-card__icon .usm-gamification-badge-img {
    filter: drop-shadow(0 10px 16px rgba(15, 23, 42, 0.13));
    transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.vm-badge-card:hover .vm-badge-card__icon .usm-gamification-badge-img {
    transform: scale(1.035);
    filter: drop-shadow(0 13px 20px rgba(15, 23, 42, 0.17));
}

.vm-badge-card__icon svg {
    width: 44px;
    height: 44px;
}

.vm-badge-card__status {
    position: absolute;
    top: 7px;
    left: 7px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--vm-achievements-soft);
    color: var(--vm-achievements-muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.vm-badge-card__content {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 8px;
    min-width: 0;
}

.vm-badge-card__title {
    font-size: 18px;
    line-height: 1.22;
}

.vm-badge-card__description {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    margin-bottom: 5px;
    color: #475569;
    font-size: 13px;
    line-height: 1.45;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.vm-badge-card__meta,
.vm-badge-card__remaining {
    margin: 0;
    color: var(--vm-achievements-muted);
    font-size: 12px;
    line-height: 1.35;
}

.vm-badge-card__progress {
    height: 10px;
    margin-top: 1px;
}


/* Estado conseguida */

.vm-badge-card.is-unlocked {
    border-color: rgba(37, 99, 235, 0.18);
}

.vm-badge-card.is-unlocked .vm-badge-card__status {
    background: rgba(34, 197, 94, 0.12);
    color: var(--vm-achievements-success);
}


/* Estado bloqueada */

.vm-badge-card.is-locked {
    border-color: #e2e8f0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.vm-badge-card.is-locked .vm-badge-card__icon {
    background:
        radial-gradient(circle at 50% 45%, rgba(226, 232, 240, 0.75), rgba(241, 245, 249, 0.35) 62%, transparent 74%);
}

.vm-badge-card.is-locked .vm-badge-card__icon .usm-gamification-badge-img {
    filter: grayscale(1) saturate(0.18) brightness(1.02);
    opacity: 0.36;
}

.vm-badge-card.is-locked:hover .vm-badge-card__icon .usm-gamification-badge-img {
    transform: none;
    filter: grayscale(1) saturate(0.18) brightness(1.02);
    opacity: 0.44;
}

.vm-badge-card.is-locked .vm-badge-card__title {
    color: var(--vm-achievements-muted);
}

.vm-badge-card.is-locked .vm-badge-card__description,
.vm-badge-card.is-locked .vm-badge-card__meta,
.vm-badge-card.is-locked .vm-badge-card__remaining {
    color: var(--vm-achievements-muted-soft);
}

.vm-badge-card.is-locked .vm-badge-card__status {
    background: #e2e8f0;
    color: var(--vm-achievements-muted);
    box-shadow: none;
}


/* =========================================================
   ESPECIALIZACIONES
========================================================= */

.vm-specialty-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.vm-specialty-card {
    display: grid;
    gap: 16px;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--vm-achievements-border);
    border-radius: 18px;
    background: #fff;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.vm-specialty-card:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: var(--vm-achievements-shadow-hover);
}

.vm-specialty-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.vm-specialty-card__head h4 {
    margin: 0;
    color: var(--vm-achievements-brand);
    font-size: 17px;
}

.vm-specialty-card__head p {
    margin: 5px 0 0;
    color: var(--vm-achievements-muted);
    font-size: 13px;
}

.vm-specialty-card__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 12px;
    border: 1px solid var(--vm-achievements-border);
    border-radius: 999px;
    background: #fff;
    color: var(--vm-achievements-brand);
    box-shadow: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.vm-specialty-card__button:focus {
    border: 1px solid var(--vm-achievements-border) !important;
    background: #fff;
    color: var(--vm-achievements-brand);
}
.vm-specialty-card__button:hover {
    border-color: rgba(37, 99, 235, 0.25) !important;
    background: var(--vm-achievements-soft);
    color: var(--vm-achievements-brand);
}

.vm-specialty-card__icons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vm-specialty-card__icons span {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    overflow: visible;
    border-radius: 999px;
    background: transparent;
    color: var(--vm-achievements-accent);
}

.vm-specialty-card__icons span .usm-gamification-badge-img {
    filter: drop-shadow(0 7px 11px rgba(15, 23, 42, 0.11));
}

.vm-specialty-card__icons span.is-locked .usm-gamification-badge-img {
    filter: grayscale(1) saturate(0.18) brightness(1.02);
    opacity: 0.38;
}

.vm-specialty-card__icons span.is-unlocked .usm-gamification-badge-img {
    opacity: 1;
}

.vm-specialty-card__icons svg {
    width: 24px;
    height: 24px;
}

.vm-specialty-card__progress {
    position: relative;
    overflow: hidden;
    height: 10px;
    border-radius: 999px;
    background: #e2e8f0;
}

.vm-specialty-card__progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--vm-achievements-accent), var(--vm-accent-2, #22c55e));
}


/* =========================================================
   PRÓXIMOS RETOS
========================================================= */

.vm-next-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.vm-next-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;

    min-width: 0;
    min-height: 255px;
    padding: 22px 18px 20px;
    border: 1px solid var(--vm-achievements-border);
    border-radius: 18px;

    background:
        radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.075), transparent 42%),
        linear-gradient(180deg, #ffffff 0%, var(--vm-achievements-soft) 100%);

    text-align: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.vm-next-card:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: var(--vm-achievements-shadow-hover);
}

.vm-next-card__icon {
    display: grid;
    place-items: center;
    width: 104px;
    height: 104px;
    margin-bottom: 14px;
    overflow: visible;
    border-radius: 999px;
    background:
        radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.35) 58%, transparent 72%);
    color: var(--vm-achievements-accent);
}

.vm-next-card__icon .usm-gamification-badge-img {
    filter: drop-shadow(0 10px 16px rgba(15, 23, 42, 0.13));
    transition: transform 0.18s ease, filter 0.18s ease;
}

.vm-next-card:hover .vm-next-card__icon .usm-gamification-badge-img {
    transform: scale(1.035);
    filter: drop-shadow(0 13px 20px rgba(15, 23, 42, 0.17));
}

.vm-next-card__icon svg {
    width: 42px;
    height: 42px;
}

.vm-next-card__content {
    display: grid;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.vm-next-card__content h4 {
    font-size: 17px;
    line-height: 1.25;
}

.vm-next-card__content p {
    display: -webkit-box;
    overflow: hidden;

    margin: 0;
    color: #475569;
    font-size: 13.5px;
    line-height: 1.45;

    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.vm-next-card__progress {
    width: 100%;
    height: 10px;
    margin-top: 6px;
}


/* =========================================================
   MODAL DE ESPECIALIZACIONES
========================================================= */

.vm-specialty-modal[hidden] {
    display: none !important;
}

.vm-specialty-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
}

.vm-specialty-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: saturate(120%) blur(4px);
    backdrop-filter: saturate(120%) blur(4px);
}

.vm-specialty-modal__shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(860px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: hidden;
    border: 1px solid var(--vm-achievements-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.vm-specialty-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--vm-achievements-border);
    background: linear-gradient(180deg, #ffffff, #f9fafb);
}

.vm-specialty-modal__header h3 {
    margin: 0;
    color: var(--vm-achievements-brand);
    font-size: 22px;
}

.vm-specialty-modal__close {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--vm-achievements-muted);
    box-shadow: none;
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
}
.vm-specialty-modal__close:focus {
    background: transparent;
    color: var(--vm-achievements-muted);
}
.vm-specialty-modal__close:hover {
    background: var(--vm-achievements-soft);
    color: var(--vm-achievements-brand);
}

.vm-specialty-modal__body {
    padding: 24px;
    overflow-y: auto;
}

.vm-specialty-modal__group h4 {
    margin: 0 0 4px;
    color: var(--vm-achievements-brand);
    font-size: 19px;
}

/* Ocultar título h5 (label) en body */
.vm-specialty-modal__group h5 {
    display: none;
}

.vm-badge-grid--modal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.vm-specialty-modal-open {
    overflow: hidden;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1100px) {
    .vm-achievements__hero,
    .vm-badge-grid,
    .vm-next-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .vm-achievements__hero,
    .vm-badge-grid,
    .vm-badge-grid--modal,
    .vm-next-grid,
    .vm-achievements__stats,
    .vm-specialty-grid {
        grid-template-columns: 1fr;
    }

    /* CTA Página ranking */
    .vm-achievements-ranking {
        align-items: stretch;
        flex-direction: column;
        padding: 20px;
    }

    .vm-achievements-ranking__main {
        align-items: flex-start;
    }

    .vm-achievements-ranking__button {
        width: 100%;
    }

    /* Seccion badges */
    .vm-achievements-card {
        padding: 20px;
    }

    .vm-achievements__featured-badge {
        justify-items: center;
        text-align: center;
    }

    .vm-achievements__featured-content {
        text-align: center;
    }

    .vm-badge-card {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 14px;
        padding: 20px 18px;
        text-align: center;
    }

    .vm-badge-card__media {
        width: 100%;
        min-height: 120px;
    }

    .vm-badge-card__icon {
        width: 112px;
        height: 112px;
    }

    .vm-badge-card__status {
        left: auto;
        right: 7px;
    }

    .vm-badge-card__content,
    .vm-next-card__content {
        width: 100%;
    }

    .vm-specialty-card__head {
        flex-direction: column;
    }

    .vm-specialty-card__button {
        width: 100%;
    }

    .vm-next-card {
        width: 100%;
    }

    .vm-specialty-modal {
        padding: 0;
    }

    .vm-specialty-modal__shell {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .vm-specialty-modal__header {
        padding: 16px 20px;
    }

    .vm-specialty-modal__body {
        padding: 20px;
    }
}

@media (max-width: 420px) {
    /* CTA Página ranking */
    .vm-achievements-ranking__icon {
        flex-basis: 46px;
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    .vm-achievements-ranking__copy h3 {
        font-size: 18px;
    }

    .vm-achievements__featured-icon {
        width: 112px;
        height: 112px;
    }

    .vm-badge-card__icon {
        width: 106px;
        height: 106px;
    }
}