/* SINGLE START */

.singleHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap; /* Permite reorganizar en pantallas más pequeñas */
}

.singleHeadTexts {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.singleHeadTitle {
    font-size: 48px;
}

.singleHeadDescription {
    font-size: 20px;
    font-weight: 300;
}

.singleHeadDetail {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

.singleCategory {
    padding: 4px;
    border-radius: 5px;
    background-color: var(--bgSoft);
    color: var(--textSoft);
    font-size: 14px;
}

/* 📌 SINGLE HEAD IMAGE */
.singleHeadImage {
    flex: 1;
    max-width: 600px;
    max-height: 350px;
    object-fit: cover;
    border-radius: 10px;
    transition: max-width 0.3s ease;
}

.singleBottom {
    display: flex;
    justify-content: space-between;
    gap: 50px;
    margin-top: 50px;
}

.singleContent {
    flex: 3;
    font-size: 20px;
    line-height: 32px;
}

.singleContent p,
.singleContent h1,
.singleContent h2,
.singleContent h3 {
    margin: 20px 0px;
}

.singleContent img {
    width: 100%; /* 🔹 Que siempre ocupe todo el ancho del contenedor */
    height: auto; /* 🔹 Mantiene la proporción original */
    max-width: 900px; /* 🔹 Evita que sean demasiado grandes en pantallas grandes */
    display: block; /* 🔹 Evita espacios extra debajo de la imagen */
    margin: 20px auto; /* 🔹 Centrar imagen y agregar espacio */
    border-radius: 12px; /* 🔹 Bordes redondeados */
    border: 2px solid var(--bgSoft); /* 🔹 Borde sutil para destacar */
    transition: transform 0.3s ease;
}

.singleContent img:hover {
    transform: scale(1.02); /* 🔹 Pequeña animación al pasar el mouse */
}

.singleContent a {
    color: var(--textSoft);
    font-weight: bold;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.singleContent a:hover {
    color: var(--text); /* 🔹 Cambia de color al pasar el mouse */
}

/* CODE START */
.singleContent .highlight {
    background-color: var(--bgSoft); /* 🔹 Fondo oscuro para el bloque de código */
    border-radius: 10px;
    padding: 15px;
    overflow-x: auto; /* 🔹 Permite scroll horizontal si es necesario */
    position: relative;
    font-size: 16px;
    line-height: 1.5;
    max-width: 100%;
    border: 1px solid var(--textSoft);
}

/* Aplica los estilos al pre dentro de .highlight */
.singleContent .highlight pre {
    background: none; /* 🔹 Elimina el fondo extra del <pre> */
    border: none; /* 🔹 Evita bordes dobles */
    padding: 0;
    margin: 0;
    overflow: visible;
    white-space: pre-wrap; /* 🔹 Ajusta el código automáticamente */
    word-wrap: break-word;
}

/* 🔹 Mejora la visibilidad del código */
.singleContent .highlight code {
    font-family: 'Courier New', monospace;
    color: var(--text);
    display: block;
}

/* 📌 BOTÓN DE COPIAR CÓDIGO */
.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--textSoft);
    color: var(--bg);
    border: none;
    padding: 5px 10px;
    font-size: 14px;
    border-radius: 5px;
    cursor: pointer;
    display: none; /* 🔹 Oculto por defecto */
    transition: background-color 0.3s ease, transform 0.2s ease;
}

/* 🔹 Aparece solo cuando se hace hover sobre el bloque de código */
.singleContent .highlight:hover .copy-button {
    display: block;
}

/* 🔹 Animación al presionar el botón */
.copy-button:active {
    transform: scale(0.95);
}

/* 🎨 Personaliza el scrollbar del código */
.singleContent .highlight pre::-webkit-scrollbar {
    height: 8px;
    background-color: transparent;
}

.singleContent .highlight pre::-webkit-scrollbar-thumb {
    background: var(--textSoft);
    border-radius: 5px;
}

.singleContent .highlight pre::-webkit-scrollbar-thumb:hover {
    background: var(--text);
}
/* CODE END */


.singleContent img {
    width: 100%;
    object-fit: cover;
}

.singleContent pre {
    width: 100%;
    overflow-x: scroll;
    padding: 20px;
}

.singleRightBar {
    flex: 1
}

/* VIDEO CSS START */
.video-container {
    margin: 0 auto;           /* Centra el contenedor */
    max-width: 720px;         /* Ancho máximo deseado */
    width: 100%;              /* Ocupa el 100% del ancho disponible */
    text-align: center;       /* Centra el contenido dentro del contenedor */
    padding-top: 40px;        /* Padding superior */
    padding-bottom: 0;        /* Sin padding inferior */
}

.video {
    display: none; /* Hide all videos by default */
}

.video.active {
    display: block; /* Only active video is visible */
}

.video-container iframe {
    width: 100%;
    aspect-ratio: 16 / 9;     /* Mantiene la relación de aspecto 16:9 */
    max-height: 405px;        /* Altura máxima para evitar que se vea demasiado alto */
    border-radius: 10px;      /* Opcional: bordes redondeados */
}

/* Toggle button styling with animation */
.toggle-video-btn {
    background-color: var(--bgSoft);
    color: var(--text);
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.toggle-video-btn:hover {
    background-color: var(--textSoft);
    color: var(--bg);
    transform: scale(1.05);
}

.toggle-video-btn:active {
    transform: scale(0.95);
}

/* VIDEO CSS END */

/* SINGLE END */

/* RIGHT BAR START */

.rightBar{
    position: sticky;
    top: 100px;
}

.relatedPosts {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--bgSoft);
    border-radius: 10px;
}

.relatedPosts h2 {
    font-size: 20px;
    margin-bottom: 10px;
    align-items: center;
}

.relatedPosts ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.relatedPosts li {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.relatedPosts li:last-child {
    margin-bottom: 0;
}

.relatedPostImage {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.relatedPosts a {
    text-decoration: none;
    color: var(--textColor);
    gap: 15px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    display: flex;
    align-items: center;
    flex-grow: 1;
    transition: color 0.2s ease-in-out;
}

.relatedPosts a:hover {
    color: var(--textSoft);
}

/* RIGHT BAR END */

/* RESPONSIVE START */

/* ===========================
   🖥️ RESPONSIVE - MONITORES DE 1280PX O MENORES
   =========================== */
   @media (max-width: 1280px) {
    .singleHead {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .singleHeadImage {
        max-width: 90%;
        height: auto;
        max-height: 320px;
        order: -1; /* Mueve la imagen arriba del título */
    }

    .singleHeadTitle {
        font-size: 42px;
    }

    .singleHeadDescription {
        font-size: 18px;
    }

    .singleHeadDetail {
        justify-content: center;
    }

    .singleContent img {
        width: 100%;
        max-height: 450px; /* 🔹 Limita el tamaño en escritorio */
        object-fit: cover;
        border-radius: 12px; /* 🔹 Bordes redondeados */
        border: 2px solid var(--bgSoft); /* 🔹 Agrega un borde sutil */
        transition: transform 0.3s ease;
    }
    
    .singleContent img:hover {
        transform: scale(1.02); /* 🔹 Pequeña animación al pasar el mouse */
    }
}

@media (max-width: 1024px) {
    .singleBottom {
        flex-direction: column;
        gap: 30px;
    }

    .singleContent {
        flex: none;
        width: 100%;
    }

    .singleRightBar {
        flex: none;
        width: 100%; /* Ocupará todo el ancho */
    }

    .relatedPosts {
        width: 100%;
    }
}

/* **Celulares grandes (768px y menores)** */
@media (max-width: 768px) {
    .singleHead {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .singleHeadImage {
        max-width: 100%;
        height: auto;
        max-height: 280px;
        border-radius: 8px;
    }

    .singleHeadTitle {
        font-size: 36px;
    }

    .singleHeadDescription {
        font-size: 17px;
    }

    .singleContent {
        font-size: 16px;
        line-height: 20px;
    }

    .singleContent h1 {
        font-size: 36px;
        line-height: 1.3; /* 🔹 Aumentar espacio entre líneas */
    }
    
    .singleContent h2 {
        font-size: 28px;
        line-height: 1.4;
    }
    
    .singleContent h3 {
        font-size: 24px;
        line-height: 1.4;
    }
}

/* **Celulares pequeños (640px y menores)** */
@media (max-width: 640px) {
    .singleBottom {
        flex-direction: column;
        gap: 20px;
    }

    .singleContent {
        font-size: 14px;
        line-height: 20px;
    }

}

/* **Celulares muy pequeños (475px y menores)** */
@media (max-width: 475px) {
    .singleHead {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .singleHeadImage {
        max-width: 100%;
        max-height: 250px;
        border-radius: 6px;
    }

    .singleHeadTitle {
        font-size: 28px;
    }

    .singleHeadDescription {
        font-size: 16px;
    }
}

@media (max-width: 375px) {
    .singleHead {
        text-align: center;
    }

    .singleHeadImage {
        max-width: 100%;
        max-height: 220px;
    }

    .singleHeadTitle {
        font-size: 24px;
    }

    .singleHeadDescription {
        font-size: 14px;
    }
}