:root {
    /* Tokens de tema (valores por defecto: claro) */
    --bg: #ffffff;
    --text: #111111;
    --muted: #6b6b6b;
    --card-bg: #f8f8f8;
    --card-hover: #e6e6e6;
    --border-color: #e6e6e6;
    --button-bg: transparent;
    --button-text: var(--text);

    --radius: 0.5rem;
    --padding: 2rem;
    --ancho: 60rem;

    /* Variables antiguas para compatibilidad */
    --fondo: var(--card-bg);
    --borde: 0.1rem var(--border-color) solid;
    --bordeBoton: 0.1rem rgba(31, 31, 31, 0.55) solid;
    --blanco: var(--text);
}

@layer base {
    html[data-theme='dark'] {
        --bg: #080808;
        --text: #d4d4d4;
        --muted: #a2a2a2;
        --card-bg: #0f0f0f;
        --card-hover: #1a1a1a;
        --border-color: #161616;
        --button-bg: transparent;
        --button-text: var(--text);

        --fondo: var(--card-bg);
        --borde: 0.1rem var(--border-color) solid;
        --bordeBoton: 0.1rem rgba(31, 31, 31, 0.55) solid;
    }

    /* Glory Calendario (clases camelCase en español) */
    .calCont {
        background-color: var(--fondo);
        border: var(--borde);
        border-radius: 0.5rem;
        padding: 0.75rem;
        width: 200px;
    }

    .calNav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
    }

    .calMesAnio {
        font-size: 0.875rem;
        font-weight: 500;
        color: #e2e8f0;
    }

    .calNavBtn {
        height: 1.75rem;
        width: 1.75rem;
        background-color: transparent;
        padding: 0;
        border: var(--borde);
        border-radius: 0.375rem;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #cbd5e0;
    }

    .calTabla {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 0.5rem;
    }

    .calTabla th {
        color: #a0aec0;
        border-radius: 0.375rem;
        width: calc(100% / 7);
        font-weight: 400;
        font-size: 0.8rem;
        padding-bottom: 0.5rem;
    }

    .calTabla td {
        padding: 0;
        text-align: center;
        font-size: 12px;
        position: relative;
    }

    .calDia {
        height: 2rem;
        width: 2rem;
        line-height: 2rem;
        padding: 0;
        font-weight: 400;
        border-radius: 0.375rem;
        cursor: pointer;
        display: inline-block;
        color: #e2e8f0;
        transition: background-color 0.1s ease-in-out, color 0.1s ease-in-out;
    }

    .calDia:hover {
        background-color: #2d2d2d;
        color: #fff;
    }

    .calDiaFuera {
        color: #4a5568;
        opacity: 0.8;
    }

    .calDiaFuera:hover {
        background-color: transparent;
    }

    .calDiaHoy .calDiaNum {
        background-color: #2d2d2d;
        color: #e2e8f0;
        border-radius: 0.375rem;
        display: inline-block;
        width: 100%;
        height: 100%;
    }

    .calDiaHoy.calDiaSel .calDiaNum {
        background-color: #3182ce;
        color: #fff;
    }

    .calDiaSel .calDiaNum {
        background-color: #3182ce;
        color: #fff;
        border-radius: 0.375rem;
        display: inline-block;
        width: 100%;
        height: 100%;
    }

    .calDiaSel .calDiaNum:hover {
        background-color: #2c5282;
    }

    .calDiaDeshab {
        color: #4a5568;
        opacity: 0.5;
        cursor: default;
    }

    .calDiaDeshab:hover {
        background-color: transparent;
    }

    .calAcciones {
        display: flex;
        justify-content: space-between;
        margin-top: 0.75rem;
    }

    .calBtnAccion {
        padding: 5px 12px;
        border: var(--borde);
        cursor: pointer;
    }

    .calBtnAccion:hover {
        background-color: #2d2d2d;
    }

    .calCont tr {
        padding: 1px 0px;
        display: flex;
        justify-content: space-around;
    }

    @import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Source+Sans+3:wght@200..900&display=swap');

    html {
        background: var(--bg);
        font-size: 62.5%;
    }

    main {
        width: 100%;
    }

    .firefox * {
        scrollbar-width: thin;
        scrollbar-color: #373737 transparent;
    }

    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }

    .bloque {
        display: flex;
        background: var(--fondo);
        border-radius: var(--radius);
        padding: var(--padding);
        border: var(--borde);
        width: var(--ancho);
        max-width: 100%;
        gap: 1rem;
    }

    code {
        background: var(--card-hover);
        padding: 0.1rem 0.3rem;
        margin: 0.1rem;
    }

    img {
        border-style: none;
        vertical-align: top;
        max-width: 100%;
        height: auto;
    }

    .flex {
        display: flex;
    }

    .gap {
        gap: 1rem;
    }

    .gap15 {
        gap: 1.5rem;
    }

    .gap20 {
        gap: 2rem;
    }

    body.noScroll {
        overflow: hidden;
    }

    .oculto {
        display: none;
    }

    .flexRow {
        flex-direction: row;
    }

    .spaceBetween {
        justify-content: space-between;
    }

    .alignItemCenter {
        align-items: center;
    }

    .columna {
        flex-direction: column;
    }

    .w100 {
        width: 100%;
    }

    .w50 {
        width: 50%;
    }

    body,
    body p,
    textarea {
        font-size: 1.2rem;
        display: block;
        margin-block-start: 0em;
        margin-block-end: 0em;
        margin-inline-start: 0rem;
        margin-inline-end: 0rem;
        unicode-bidi: isolate;
        color: var(--text);
        line-height: 1.6;
        font-family: 'Source Sans 3', Arial, Helvetica, sans-serif;
        letter-spacing: 0rem;
        font-weight: 400;
        text-decoration: none;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
        text-decoration: none;
        text-wrap: pretty;
    }

    .firefox *::-webkit-scrollbar {
        width: 0.4rem;
        background: transparent;
    }

    .firefox *::-webkit-scrollbar-thumb {
        border-radius: 1rem;
        border: 0.2rem solid transparent;
        background-clip: padding-box;
    }

    .firefox .menu-container {
        filter: url(#blur-effect) !important;
        background-color: rgba(9, 9, 9, 0.85);
    }

    .firefox .panelperfilsupsec {
        background: #070707;
        background-color: rgb(7, 7, 7);
        filter: url(#blur-effect) !important;
        background-color: rgba(9, 9, 9, 0.85);
    }

    ::-webkit-scrollbar {
        width: 0.4rem;
        height: 0.4rem;
        transition: width 0.3s ease, height 0.3s ease;
    }
    ::-webkit-scrollbar-track {
        background: none;
    }
    ::-webkit-scrollbar-thumb {
        background: #555;
        border-radius: 1rem;
    }

    .scrollVisible::-webkit-scrollbar {
        width: 0.4rem;
        height: 0.4rem;
    }
    .scrollVisible::-webkit-scrollbar-thumb {
        background: unset;
    }
    .scrollVisible::-webkit-scrollbar-thumb:hover {
        background: #888;
    }

    .appAndroid p {
        font-size: 1.4rem;
    }

    .appAndroid button {
        font-size: 1.4rem !important;
    }

    .appAndroid a {
        font-size: 1.4rem;
    }

    .appAndroid .jhvsfw a {
        font-size: 1.5rem !important;
    }

    .appAndroid .zvjvza {
        padding-bottom: 0rem;
        line-height: 1.3rem;
        padding-top: 0.5rem;
    }

    .appAndroid .hqlxwd a {
        font-size: 1.2rem;
    }
    @media (max-width: 640px) {
        ::-webkit-scrollbar {
            width: 0rem;
            height: 0rem;
            transition: width 0.3s ease, height 0.3s ease;
        }

        .scrollVisible::-webkit-scrollbar {
            width: 0rem;
            height: 0rem;
        }
    }

    .appAndroid .infoIaBtn,
    .appAndroid span.postTag,
    .appAndroid .badge,
    .appAndroid .postTagToggle {
        font-size: 1.3rem !important;
    }

    ul {
        list-style: none;
    }

    .borde {
        border: var(--borde);
    }

    textarea {
        /* Adaptar al token de texto del tema */
        color: var(--text);
        border: none;
        padding: 0rem;
        margin-bottom: 1rem;
        font-size: 1.2rem;
        background: none;
        resize: none;
        width: 100%;
    }

    .seleccionado {
        filter: brightness(2);
        opacity: 1 !important;
        border: 0.1rem solid #676767;
    }

    .botonesBloques button {
        width: -webkit-fill-available;
        justify-content: center;
    }

    button {
        all: unset;
        display: flex;
        margin: 0rem;
        /* Usar tokens de tema para que el color se adapte (light/dark) */
        color: var(--button-text);
        background: var(--button-bg);
        font-size: 1.2rem;
        border-radius: 0.4rem;
        cursor: pointer;
        padding: 0.8rem 1.5rem;
        align-items: center;
        height: fit-content;
        gap: 0.5rem;
    }

    .botonPrincipal {
        background: transparent !important;
        color: var(--button-text) !important;
        border: none !important;
    }

    .preview {
        border: var(--borde);
        border-radius: var(--radius);
        display: flex;
        align-content: center;
        text-align: center;
        padding: var(--padding);
        min-height: 6rem;
        cursor: pointer;
        width: 100%;
        place-content: center;
    }

    .noBorde {
        border: unset;
    }

    body {
        display: flex;
        justify-content: center;
        align-items: flex-start;
    }

    label {
        /* +0.1rem respecto al valor anterior (1.2rem -> 1.3rem) y en negrita */
        font-size: 1.3rem;
        font-weight: 700;
    }

    /* En formularios, forzar los labels en bloque para colocar inputs/selects debajo */
    .gloryForm .formCampo > label {
        display: block;
        margin-bottom: 0.6rem;
    }

    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        -webkit-font-smoothing: antialiased;
        text-rendering: optimizeLegibility;
    }

    form {
        display: flex;
        flex-direction: column;
    }

    .heartAnimation {
        animation: fade 2s ease forwards;
        color: red;
        font-size: 3rem;
    }

    .waveformContainer {
        cursor: pointer;
    }

    .modal {
        display: none;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background-color: var(--fondo);
        border: var(--borde);
        padding: 2rem;
        border-radius: var(--radius);
        width: 40rem;
        max-width: 90%;
        z-index: 1006;
        font-size: 1.1rem;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 1rem;
        max-height: 82%;
        overflow: auto;
    }

    .customCheckbox {
        display: flex;
        cursor: pointer;
        padding: 0.5rem;
        user-select: none;
        color: #6b6b6b;
        border: var(--borde);
        border-radius: 0.5rem;
        width: 100%;
        justify-content: center;
    }

    .customCheckbox input[type='checkbox'] {
        display: none !important;
    }

    input,
    textarea {
        background: unset !important;
        /* padding: 0.7rem 0rem !important; */
        border-bottom: var(--borde) !important;
        font-size: 1.2rem !important;
        /* Usar token de tema para el color del texto */
        color: var(--text) !important;
        border-radius: 0rem;
        border: none;
        resize: none;
        line-height: 1.5;
        width: 100%;
        margin: 0.4rem 0;
    }

    /* Estilos para selects: similares a un input (borde inferior) */
    select {
        width: 100%;
        border: unset;
        background: unset;
        font-family: 'Source Sans 3';
        padding: 0.5rem;
        padding-left: 0rem;
        margin: unset;
        font-size: 1.2rem; /* igual a inputs */
        border-bottom: var(--borde);
        outline: none;
        color: var(--text);
        margin: 0.4rem 0;
    }
    select:focus {
        outline: none;
    }
    select option {
        color: var(--text);
        background: var(--bg);
    }

    /* Toggle estilo switch para checkboxes */
    .opcionCheck {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1.2rem 1.5rem;
        border: var(--borde);
        border-radius: 0.8rem;
    }
    .opcionCheck > div label {
        color: var(--text);
        font-weight: 700;
        display: block; /* asegurar que el select quede debajo en bloques similares */
    }
    .opcionCheck .description {
        color: var(--muted);
        font-size: 1.1rem;
        line-height: 1.4rem;
        max-width: 25rem;
    }

    .switch {
        position: relative;
        display: inline-block;
        width: 3.5rem;
        height: 1.8rem;
    }
    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }
    .slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--card-bg);
        transition: background-color 0.18s ease, border-color 0.18s ease;
        border-radius: 3.4rem;
        border: 0.1rem solid var(--border-color);
    }
    .slider:before {
        position: absolute;
        content: '';
        height: 1.6rem;
        width: 1.6rem;
        background-color: var(--bg);
        transition: transform 0.18s ease;
        border-radius: 50%;
        box-shadow: 0 0.1rem 0.2rem rgba(0, 0, 0, 0.2);
    }
    .switch input:checked + .slider {
        background-color: var(--text);
        border-color: var(--text);
    }
    .switch input:checked + .slider:before {
        transform: translateX(1.7rem);
        background-color: var(--bg);
    }
    .switch input:focus + .slider,
    .switch input:active + .slider {
        box-shadow: none; /* eliminar halo que añade la sensación de grosor */
    }

    /* Minimal modern checkbox group */
    .checkboxGroup {
        display: flex;
        flex-direction: column;
    }
    .checkboxGroup label {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 0.6rem 0.6rem 0.6rem 3rem; /* espacio para la casilla personalizada */
        border-radius: 0.8rem;
        cursor: pointer;
        position: relative;
        transition: transform 120ms ease;
        color: var(--text);
        background: transparent;
        border: 0.1rem solid transparent;
        font-size: 1.2rem; /* igual que inputs */
        font-weight: 400; /* texto normal */
    }
    /* eliminar efecto hover visual para los checkboxes del grupo */
    .checkboxGroup label:hover {
        background: transparent;
    }
    .checkboxGroup input[type='checkbox'] {
        display: none;
    }
    .checkboxVisualWrapper {
        position: relative;
    }
    .checkboxVisualWrapper::before {
        content: '';
        position: absolute;
        left: -2.8rem;
        top: 50%;
        transform: translateY(-50%);
        width: 1.4rem;
        height: 1.4rem;
        border-radius: 0.3rem;
        border: 0.1rem solid var(--border-color);
        background: transparent; /* sin background */
        display: block;
        box-sizing: border-box;
    }
    .checkboxVisualWrapper::after {
        content: '✔';
        position: absolute;
        left: -2.8rem;
        top: 50%;
        transform: translateY(-50%);
        width: 1.4rem;
        height: 1.4rem;
        display: none;
        align-items: center;
        justify-content: center;
        color: var(--text);
        font-size: 1rem;
        line-height: 1.4rem;
        text-align: center;
    }
    /* Mostrar checkmark cuando está marcado */
    label input:checked + .checkboxVisualWrapper::after {
        display: block;
    }
    label input:checked + .checkboxVisualWrapper::before {
        /* mantener sin background, solo cambiar color del borde si se desea */
        background: transparent;
        border-color: var(--text);
    }

    /* También un estilo para customCheckbox (campo individual con clase) para mantener coherencia */
    .customCheckbox {
        justify-content: flex-start;
        padding-left: 3.4rem;
        position: relative;
    }
    .customCheckbox input[type='checkbox'] {
        display: none;
    }
    .customCheckbox::before {
        content: '';
        position: absolute;
        left: 0.8rem;
        top: 50%;
        transform: translateY(-50%);
        width: 1.8rem;
        height: 1.8rem;
        border-radius: 0.4rem;
        border: 0.1rem solid var(--border-color);
        background: var(--bg);
    }

    input::placeholder,
    textarea::placeholder {
        color: var(--muted);
        opacity: 0.9;
    }

    input:focus,
    textarea:focus {
        outline: none;
    }

    .preview img {
        max-height: 20rem;
        object-fit: cover !important;
        width: 100% !important;
    }

    .openModal {
        cursor: pointer;
    }

    .activa {
        opacity: 1 !important;
    }

    .pestanas button {
        font-size: 1.3rem;
        padding: 0rem;
        font-weight: 500;
        opacity: 0.6;
    }
    .pestanas {
        display: flex;
        align-items: center;
        gap: 2rem;
        padding: 1rem 1.8rem;
    }

    .submenus {
        display: none;
        background: #080808;
        padding: 1rem 0.6rem;
        border-radius: 0.5rem;
        width: 15rem;
        overflow: auto;
        border: var(--borde);
        z-index: 1010;
        position: fixed;
        flex-direction: column;
    }

    .submenus a {
        font-size: 1.2rem;
        padding: 0.5rem;
        padding-left: 1rem;
        cursor: pointer;
        color: white;
        width: -webkit-fill-available;
        width: -moz-available;
    }

    /* Muestra el menú cuando está activo */
    .submenus.activo {
        display: flex;
    }

    .arrastrando {
        filter: brightness(1.2);
    }

    .previewsForms.activo {
        display: flex; /* o flex, grid, etc., según necesites */
    }

    .gloryImageUploader {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .previewImagen {
        border: var(--borde);
        border-radius: var(--radius);
        display: flex;
        align-content: center;
        text-align: center;
        padding: var(--padding);
        min-height: 11rem;
        cursor: pointer;
        width: 100%;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    /* Badges list component (Glory) */
    .badgeList {
        display: flex;
        gap: 0.8rem;
        flex-wrap: wrap;
        align-items: center;
    }

    .badgeList .badge {
        /* basarse en variables del tema */
        color: var(--muted);
        background: var(--card-bg);
        border-radius: 10rem;
        padding: 0.2rem 1.1rem;
        cursor: pointer;
        font-size: 1.2rem; /* 12px equivalente */
        white-space: nowrap;
        transition: opacity 120ms ease, transform 120ms ease, background-color 120ms ease, color 120ms ease;
        opacity: 0.85;
    }

    .badgeList .badge.activo {
        background: var(--card-bg);
        color: var(--text);
        opacity: 1;
        transform: translateY(-0.1rem);
    }

    .badgeList .badge.inactivo {
        opacity: 0.45;
    }

    .badgeList .badgeControl {
        font-size: 1.1rem;
        padding: 0.4rem 0.8rem;
        border-radius: 0.6rem;
        border: 0.1rem solid var(--border-color);
        background: transparent;
    }

    .hljs {
        background: var(--card-bg) !important;
    }

    pre code.hljs {
        display: block;
        overflow-x: auto;
        padding: 1em;
        font-size: 1rem;
    }

    button.previewRemover {
        position: absolute;
        top: 25px;
        right: 25px;
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(30px);
        padding: 8px;
    }

    .submenu {
        display: none;
        position: fixed;
        background: var(--fondo);
        border: var(--borde);
        border-radius: var(--radius);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        padding: 0.5rem;
        min-width: 150px;
        z-index: 1001;
        flex-direction: column;
        gap: 5px;
        list-style: none;
    }

    .submenu.activo {
        display: flex;
    }

    .submenu button {
        width: -webkit-fill-available;
        width: -moz-available;
        width: fill-available;
        text-align: left;
        padding: 0.5rem 1rem;
        background: none;
        border: none;
        cursor: pointer;
        border-radius: var(--radius);
        color: var(--text);
    }

    .submenu button:hover {
        background-color: var(--fondo);
        filter: brightness(1.4);
    }

    .gloryThemeToggle {
        color: var(--text);
        background: var(--card-bg);
        border: var(--borde);
        width: 40px;
        height: 40px;
        padding: 0px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 1rem;
        right: 1rem;
        z-index: 2000;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
    }
}
