/* Estilos para los botones de edición de personaje */
.contenedor_btn_editar_personaje {
    width: calc(100% / 5 - 32px / 4);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (max-width: 768px) {
    .contenedor_btn_editar_personaje {
        width: calc(100% / 4 - 24px / 3);
    }
}

.btn_editar_personaje {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border: 1px solid #192b30;
    background-color: #f2f2f7;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    align-items: center;
}

/* Contenedor interno de los canvas de personajes */
#characterEditorBtnContainer {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 4px;
}

.contenedor_interno_campo_personaje {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 19px;
    margin-top: -19px;
    padding-top: 4px;
    width: 100%;
}

@media (max-width: 768px) {
    #characterEditorBtnContainer {
        margin-top: -6px !important;
    }

    .contenedor_interno_campo_personaje {
        padding: 4px !important;
        padding-bottom: 19px !important;
        margin-top: -6px !important;
    }
}

/* Ocultar elementos no necesarios */
.contenedor_personajes .cl-option-content {
    display: none;
}

.campo_personaje .cl-accordion input {
    display: none;
}

/* Estilos generales del contenedor principal */
#personajes_sp_v2_externo {
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    inset: 0;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

@media (min-width: 992px) {
    #personajes_sp_v2_externo {
        padding: 38px 0px;
    }
}

#personajes_sp_v2.transicion_vertical {
    transform: translateY(100vh);
}

#personajes_sp_v2 {
    width: 100%;
    height: 100%;
    max-width: 1398px;
    display: flex;
    background: white;
    border-radius: 10px;
    position: relative;
    transition: transform 0.4s;
}

@media (min-width: 992px) {
    #personajes_sp_v2 {
        max-height: 777px;
    }
}

#personajes_sp_v2 #nivel1 {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Barra superior móvil en nivel 1 */
#personajes_sp_v2 #nivel1 .barra_superior_mobile {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    z-index: 30;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Botón 'Siguiente' en la barra superior móvil */
#personajes_sp_v2 #nivel1 .barra_superior_mobile #btnNextMobile {
    color: white;
    border: none;
    cursor: pointer;
    padding: 5px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    width: 100%;
    border-radius: 8px;
    background-color: rgba(5, 42, 49, 1);
    height: 38px;
}

#personajes_sp_v2 #nivel1 .barra_superior_mobile #btnNextMobile:disabled {
    background-color: grey;
}

/* Contenedor de opciones en nivel 1 */
#personajes_sp_v2 #mainCharacters {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-content: center;
    flex: 1;
    width: calc(100% - 80px);
    gap: 24px;
    padding: 0 40px;
    padding-bottom: 96px;
    flex-direction: row;
    justify-content: flex-start;
    margin-top: 60px;
    /* Ajuste para móvil */
}

#personajes_sp_v2 label.opcion_nivel1 {
    display: flex;
    flex-direction: row;
    gap: 20px;
    background-color: #fafafc;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid #fafafc;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    color: #182a2f;
}

#personajes_sp_v2 input[type="radio"] {
    display: none !important;
}

#personajes_sp_v2 #mainCharacters input[type="radio"]:checked+label {
    border: 2px solid #01de8e;
}

#personajes_sp_v2 .opcion_nivel1 .imagen_nivel1 {
    width: 112px;
    height: 112px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Personalizador */
#personajes_sp_v2 #personalizador {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
}

#personajes_sp_v2 .tg-errors {
    display: none;
    justify-content: center;
    align-items: center;
    position: absolute;
    z-index: 11;
    width: 100%;
    height: 100%;
    background-color: #0000003d;
    border-radius: 20px;
}

#personajes_sp_v2 .tg-errors.show {
    display: flex;
}

#personajes_sp_v2 .tg-errors .error-window {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    background-color: white;
    border-radius: 10px;
    width: 100%;
    max-width: 441px;
    padding: 20px 18px;
    animation: wiggle 0.5s;
}

#personajes_sp_v2 .tg-errors .error-window .error-close {
    position: absolute;
    right: 8px;
    top: 10px;
    cursor: pointer;
}

#personajes_sp_v2 .tg-errors .error-window .error-close img {
    width: 23px;
}

#personajes_sp_v2 .tg-errors .error-window img {
    width: 48px;
}

#personajes_sp_v2 .tg-errors .error-window .error-message {
    font-size: 18px;
    font-weight: 400;
    line-height: 23px;
    text-align: center;
    color: rgba(5, 42, 49, 1);
}

#personajes_sp_v2 #previsualizacion {
    height: 100%;
    width: 50%;
    border-radius: 20px 0 0 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: background-image 0.3s;
}

#personajes_sp_v2 #configurador_personajes {
    height: 100%;
    width: 50%;
    display: flex;
    flex-direction: column;
    transition: 1s;
}

#personajes_sp_v2 #configurador_personajes #nivel3,
#personajes_sp_v2 #configurador_personajes #nivel4 {
    padding: 0 30px 12px 30px;
}

#personajes_sp_v2 #configurador_personajes #nivel2 {
    position: relative;
}

#personajes_sp_v2 #configurador_personajes #nivel2 .three_inner {
    display: flex;
    gap: 5.4%;
    align-items: flex-end;
    border-bottom: 1px solid #e9e9e9;
    overflow-x: scroll;
    overflow-y: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
    width: 100%;
}

#personajes_sp_v2 #configurador_personajes #nivel2 .nivel2-option {
    padding-top: 15px;
    min-width: 13.2%;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

#personajes_sp_v2 #configurador_personajes #nivel2 .nivel2-option .nombre_nivel2 {
    font-size: 12px;
    font-weight: 700;
}

#personajes_sp_v2 #nivel2 .three_inner::-webkit-scrollbar {
    display: none;
}

#personajes_sp_v2 #nivel2 label {
    /* min-width: 92px; */
    /* max-width: 92px; */
    border-bottom: 3px solid transparent;
    cursor: pointer;
    display: flex;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    font-size: 12px;
    color: #7c8689;
    gap: 6px;
    padding-bottom: 21px;
}

#personajes_sp_v2 .opcion_nivel2 .imagen_nivel2 {
    width: 50px;
    height: 36px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

#personajes_sp_v2 #nivel2 input[type="radio"]:checked+label {
    border-bottom: 3px solid #192b30;
    color: #192b30;
}

#personajes_sp_v2 #nivel2 input[type="radio"]:checked+label .imagen_nivel2 {
    filter: brightness(0.78) contrast(4);
}

/* Botones de navegación en nivel 3 */
#personajes_sp_v2 #configurador_personajes .btn-left,
#personajes_sp_v2 #configurador_personajes .btn-right {
    position: absolute;
    height: 100%;
    width: 50px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    transition: opacity 0.2s;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
}

#personajes_sp_v2 #configurador_personajes .btn-right {
    background: linear-gradient(to left, #ffffffd6 30px, #ffffff00 48px);
    right: 0;
}

#personajes_sp_v2 #configurador_personajes .btn-right::before {
    content: "";
    background-image: url(../img/flecha_nivel3_der.svg);
    width: 20px;
    height: 20px;
    display: block;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

#personajes_sp_v2 #configurador_personajes .btn-left {
    background: linear-gradient(to right, #ffffffd6 30px, #ffffff00 48px);
    left: 0;
}

#personajes_sp_v2 #configurador_personajes .btn-left::before {
    content: "";
    background-image: url(../img/flecha_nivel3_izq.svg);
    width: 20px;
    height: 20px;
    display: block;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

#personajes_sp_v2 #configurador_personajes #nivel3 {
    position: relative;
    padding: 16px 14px;
}

#personajes_sp_v2 #configurador_personajes #nivel3 .three_inner {
    height: 42px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 0;
    overflow-x: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
    mask-composite: intersect;
    white-space: nowrap;
}

#personajes_sp_v2 #configurador_personajes #nivel3 .three_inner .nombre_nivel3 {
    font-size: 12px;
    font-weight: 700;
}

#personajes_sp_v2 #nivel3::-webkit-scrollbar {
    display: none;
}

#personajes_sp_v2 #nivel3 label {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    gap: 8px;
    padding: 0px 8px;
    height: 36px;
    background-color: #f2f2f7;
    border: 1px solid #f2f2f7;
    border-radius: 100px;
    font-size: 12px;
    color: #7c8689;
}

#personajes_sp_v2 .opcion_nivel3 .imagen_nivel3 {
    width: 16px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

#personajes_sp_v2 #nivel3 input[type="radio"]:checked+label {
    border: 1px solid #192b30;
    color: #192b30;
}

#personajes_sp_v2 #nivel3 input[type="radio"]:checked+label .imagen_nivel3 {
    filter: brightness(0.78) contrast(4);
}

/* Nivel 4 */
#personajes_sp_v2 #configurador_personajes #nivel4 {
    flex: 1;
    background-color: #fafafc;
    box-shadow: inset 0px 30px 30px -30px rgba(0, 0, 0, 0.125);
    mask-image: linear-gradient(to top, transparent 10px, black 32px);
    overflow-y: scroll;
    margin-bottom: 50px;
    padding-top: 12px;
}

@media (min-width: 993px) {
    #personajes_sp_v2 #nivel4 {
        scrollbar-color: initial;
        scrollbar-width: 5px;
    }

    #personajes_sp_v2 #nivel4::-webkit-scrollbar {
        width: 5px;
    }

    #personajes_sp_v2 #nivel4::-webkit-scrollbar-track {
        background: rgba(236, 236, 246, 0.4);
        border-radius: 10px;
    }

    #personajes_sp_v2 #nivel4::-webkit-scrollbar-thumb {
        background: rgba(124, 134, 137, 1);
        border-radius: 5px;
    }

    #personajes_sp_v2 #nivel4::-webkit-scrollbar-thumb:hover {
        background: rgba(124, 134, 137, 1);
    }
}

#personajes_sp_v2 #nivel4 .grupo_radios {
    display: flex;
    flex-direction: column;
}

#personajes_sp_v2 #nivel4 .nombre_imagen_nivel4 {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 0 12px;
}

#personajes_sp_v2 #nivel4 .imagen_nivel4 {
    filter: brightness(0.78) contrast(4);
    width: 16px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

#personajes_sp_v2 #nivel4 .nombre_nivel4 {
    font-size: 16px;
    font-weight: 700;
    color: #192b30;
}

/* Nivel 5 */
#personajes_sp_v2 #configurador_personajes .nivel5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e9e9e9;
}

#personajes_sp_v2 .nivel5 label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    background-color: #f2f2f7;
    border: 1px solid #f2f2f7;
    border-radius: 8px;
    cursor: pointer;
}

#personajes_sp_v2 .opcion_nivel5 .imagen_nivel5 {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    margin-right: unset;
}

#personajes_sp_v2 .opcion_nivel5 .imagen_nivel5.unset {
    width: 80%;
    height: 80%;
    filter: contrast(0.0);
}

#personajes_sp_v2 .nivel5 input[type="radio"]:checked+label {
    border: 1px solid rgba(1, 216, 138, 1);
    background-color: rgba(0, 221, 141, 0.07);
}

/* Botón cerrar */
#personajes_sp_v2 .btn_cerrar {
    width: 32px;
    height: 32px;
    position: absolute;
    background-image: url(../img/btn_cerrar_escritorio.svg);
    background-repeat: no-repeat;
    background-size: contain;
    cursor: pointer;
}

/* Posicionamiento específico para el botón de cerrar en el personalizador */
#personajes_sp_v2>.btn_cerrar {
    top: -38px;
    right: -38px;
    border-radius: 50%;
}

/* Ocultar el botón de cerrar dentro de .barra_superior_mobile en escritorio */
@media (min-width: 992px) {
    #personajes_sp_v2 #nivel1 .barra_superior_mobile {
        display: none;
    }
}

/* Ocultar el botón de cerrar directamente dentro de #personajes_sp_v2 en móvil */
@media (max-width: 992px) {
    #personajes_sp_v2>.btn_cerrar {
        top: 5px;
        right: 5px;
        width: 32px;
        height: 32px;
        background-image: url(../img/btn_cerrar_movil.svg);
        background-size: contain;
        background-repeat: no-repeat;
        cursor: pointer;
        z-index: 999;
    }
}

/* Botón siguiente y finalizar */
#personajes_sp_v2 #btnNext,
#personajes_sp_v2 .customizer_footer-btns {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

#personajes_sp_v2 #btnNext,
#personajes_sp_v2 .footer__boton__finalizar {
    cursor: pointer;
    width: 113px;
    padding: 7px;
    border-radius: 8px;
    text-align: center;
    background-color: rgba(5, 42, 49, 1);
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 700;
}

#personajes_sp_v2 #btnNext:disabled,
#personajes_sp_v2 .footer__boton__finalizar:disabled {
    background-color: grey;
}

/* Ocultar el botón 'Siguiente' de escritorio en móvil */
@media (max-width: 991px) {
    #btnNext {
        display: none;
    }
}

/* Botón editar personaje físico */
.btnEditCharacter {
    background-color: #182a2f;
    text-align: center;
    color: white;
    border: none;
    font-size: 11px;
    padding: 4px 2px;
    border-radius: 8px;
    width: 100%;
    font-weight: 500;
    margin-top: 8px;
    cursor: pointer;
    word-wrap: break-word;
}

@media (max-width: 992px) {
    .btnEditCharacter {
        font-size: 10px;
    }
}

/* Logos */
#personajes_sp_v2 #logotipo_tg {
    position: absolute;
    bottom: 20px;
    right: 50%;
    transform: translateX(50%);
    background-repeat: no-repeat;
    background-size: contain;
    width: 64px;
    height: 64px;
}

#personajes_sp_v2 #logotipo_transparentgift {
    background-image: url(../img/logo_transparentgift.svg);
    background-repeat: no-repeat;
    background-size: contain;
    width: 280px;
    height: 33px;
    margin-top: 82px;
}

/* Estilos móviles */
@media (max-width: 992px) {

    /* Barra superior en nivel 1 */
    #personajes_sp_v2 #nivel1 .barra_superior_mobile {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: white;
        z-index: 30;
        display: flex;
        align-items: center;
        padding: 0 20px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    /* Ajustes para el contenedor de opciones */
    #personajes_sp_v2 #nivel1 #mainCharacters {
        padding-top: 20px;
        margin: 0;
        overflow-y: auto;
    }

    /* Ocultar logo en móvil */
    #personajes_sp_v2 #nivel1 #logotipo_transparentgift {
        display: none;
    }

    #personajes_sp_v2 {
        margin-top: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    #personajes_sp_v2 #mainCharacters {
        display: flex;
        flex-direction: column;
        width: calc(100% - 40px);
        gap: 14px;
        padding: 0 20px;
        overflow-y: scroll;
        padding-bottom: 74px;
    }

    #personajes_sp_v2 label.opcion_nivel1 {
        width: 100%;
    }

    #personajes_sp_v2 .opcion_nivel1 .imagen_nivel1 {
        width: 80px;
        height: 80px;
    }

    #personajes_sp_v2 #personalizador {
        display: block;
    }

    #personajes_sp_v2 .tg-errors {
        padding: 0px 70px;
        border-radius: unset;
    }

    #personajes_sp_v2 .tg-errors .error-window {
        padding: 30px 18px;
    }

    #personajes_sp_v2 .tg-errors .error-window .error-close img,
    #personajes_sp_v2 .tg-errors .error-window .error-close {
        width: 17px;
        height: 17px;
        vertical-align: unset;
    }

    #personajes_sp_v2 .tg-errors .error-window .error-message {
        font-size: 16px;
        line-height: 20px;
    }

    #personajes_sp_v2 #previsualizacion {
        width: 100%;
        max-height: 46%;
        border-radius: 0;
        z-index: 8;
        position: absolute;
        top: 0;
    }

    #personajes_sp_v2 #configurador_personajes {
        width: 100%;
        max-height: calc(54% + 30px);
        margin-top: -30px;
        z-index: 10;
        position: absolute;
        bottom: 0;
    }

    #personajes_sp_v2 #configurador_personajes #nivel2 {
        border-radius: 30px 30px 0 0;
        overflow: hidden;
    }

    #personajes_sp_v2 #configurador_personajes #nivel2 .three_inner {
        background-color: white;
        padding: 0px 6px;
        gap: 1.05%;
    }

    #personajes_sp_v2 #configurador_personajes #nivel2 .nivel2-option {
        padding-top: 16px;
        min-width: 17.5%;
    }

    #personajes_sp_v2 .opcion_nivel2 .imagen_nivel2 {
        width: 36px;
        height: 28px;
    }

    #personajes_sp_v2 #nivel2 label {
        font-size: 10px;
        /* max-width: 78px;
        min-width: 78px; */
    }

    #personajes_sp_v2 #configurador_personajes #nivel3 {
        height: 64px;
        width: 100%;
        display: flex;
        align-items: center;
    }

    #personajes_sp_v2 #configurador_personajes #nivel3 .three_inner {
        width: 100%;
        margin-left: 0;
    }

    #personajes_sp_v2 #nivel3 label {
        height: 30px;
        font-size: 10px;
    }

    #personajes_sp_v2 #configurador_personajes #nivel4 {
        mask-image: none;
        margin-bottom: 59px;
    }

    /* #personajes_sp_v2 #configurador_personajes #nivel2, */
    #personajes_sp_v2 #configurador_personajes #nivel3,
    #personajes_sp_v2 #configurador_personajes #nivel4 {
        width: 100%;
        padding: 16px;
    }

    #personajes_sp_v2 .nivel5 label {
        width: 100%;
        aspect-ratio: 1;
    }

    #personajes_sp_v2 #logotipo_tg,
    #personajes_sp_v2 #logotipo_transparentgift {
        display: none;
    }

    #personajes_sp_v2 .customizer_footer-btns {
        position: fixed;
        top: auto;
        z-index: 20;
        right: 0;
        bottom: 0;
        width: 100%;
        background-color: white;
        padding: 10px 16px;
        display: flex;
        justify-content: center;
        border-top: 1px solid rgba(239, 239, 239, 1);
    }

    #personajes_sp_v2 .customizer_footer-btns .footer__boton__finalizar {
        width: 100%;
    }
}

@media (max-width: 768px) {
    #personajes_sp_v2 #configurador_personajes .nivel5 {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

/* Botón deslizable */
#slideup_button {
    display: none;
    cursor: pointer;
    position: absolute;
    top: -22px;
    right: calc(50% - 17px);
    width: 34px;
    height: 34px;
    transition: 0.5s;
    background-color: white;
    border-radius: 100%;
}

#slideup_button::before {
    content: "";
    background-image: url("../img/chevron.svg");
    background-size: contain;
    background-repeat: no-repeat;
    width: 15px;
    height: 10px;
    display: block;
}

#slideup_button.slideup {
    transform: rotate(180deg);
}

/* Contenedor del canvas */
.canvas-container {
    width: 400px;
    height: 400px;
    position: relative;
    user-select: none;
    max-width: 100%;
    background: white;
    pointer-events: auto;
    min-width: 300px;
    min-height: 300px;
}

#previsualizacion .canvas-container {
    width: 100%;
    height: 100% !important;
    display: flex;
    align-items: center;
    background: rgba(241, 241, 241, 1);
    border-radius: 10px 0 0 10px;
    min-height: unset !important;
    min-width: unset !important;
}

#modal-canvas {
    width: 100%;
}

@media (min-width: 992px) {
    #slideup_button {
        display: none !important;
    }
}

@media (max-width: 992px) {
    #slideup_button {
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0px 0px 14px #00000021;
    }

    #personajes_sp_v2 #configurador_personajes.slideup {
        max-height: 89%;
    }

    #personajes_sp_v2 #configurador_personajes #nivel3 {
        background: white;
    }

    #previsualizacion .canvas-container {
        border-radius: 0px;
    }
}

@keyframes wiggle {
    0% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-8px);
    }

    30% {
        transform: translateX(8px);
    }

    45% {
        transform: translateX(-6px);
    }

    60% {
        transform: translateX(6px);
    }

    75% {
        transform: translateX(-4px);
    }

    100% {
        transform: translateX(0);
    }
}