/* =================================================================    
   TextLabHub - Estilos Globales y Sistema de Diseño Unificado
   ================================================================ */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --text: #f1f5f9; /* Slate 100 */
    --bg: #0f172a; /* Slate 900 */
    --card-bg: #1e293b; /* Slate 800 */
    --border: #334155; /* Slate 700 */
    --muted: #94a3b8; /* Slate 400 */
    --radius: 12px;
    --transition: all 0.25s ease;
}

*, *:before, *:after {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* --- Layout Principal --- */
main, .header-container, .footer-container, .footer-bottom {
    width: 90%;
    max-width: 1350px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

main {
    margin-top: 40px;
    margin-bottom: 60px;
    overflow: hidden;
}

main.tool-container {
    max-width: 1000px;
}

main.post-container {
    max-width: 850px;
}

/* --- Header Moderno & Menú Sticky --- */
header.site-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 99999;
    width: 100%;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    white-space: nowrap;
}

img.site-logo {
    height: 36px;
    width: auto;
    display: block;
}

.logo-fallback {
    font-size: 1.5rem;
    font-weight: 700;
    color: #38bdf8;
    letter-spacing: -0.5px;
}

.logo-fallback span {
    color: #ffffff;
}

/* Menú de Escritorio */
.site-nav ul {
    display: flex;
    list-style: none;
    gap: 28px;
    margin: 0;
    padding: 0;
    align-items: center;
}

.site-nav a {
    text-decoration: none;
    color: #020617;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.site-nav a:hover, .site-nav a.active {
    color: #38bdf8;
}

/* Botón Hamburguesa (Móvil) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    padding: 0;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2.5px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: var(--transition);
}

/* --- Grids & Cards Modernas --- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    width: 100%;
    max-width: 100%;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.card:hover {
    border-color: #475569;
    transform: translateY(-2px);
}

/* Control estricto de tamaño para imágenes en tarjetas y posts */
.card img, .post-box img, article img {
    max-height: 200px !important;
    width: 100% !important;
    object-fit: cover !important;
    display: block;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #38bdf8;
    background-color: #0284c71a;
    border: 1px solid #0284c733;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.badge-dark {
    background-color: #020617;
    color: #94a3b8;
    border-color: var(--border);
}

.card h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    letter-spacing: -0.3px;
    overflow-wrap: break-word;
}

.card h3 a {
    color: #ffffff;
    text-decoration: none;
}

.card h3 a:hover {
    color: #38bdf8;
}

.card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.6;
    overflow-wrap: break-word;
}

.btn {
    display: inline-block;
    margin-top: 18px;
    padding: 10px 16px;
    background: #2563eb;
    color: #ffffff;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.88rem;
    transition: var(--transition);
    text-align: center;
}

.btn:hover {
    background: #1d4ed8;
}

/* --- Tool & Post Boxes --- */
.box, article.post-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 35px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.box h2 {
    margin: 0 0 12px 0;
    font-size: 1.8rem;
    color: #ffffff;
    letter-spacing: -0.5px;
    overflow-wrap: break-word;
}

/* Separación específica para el bloque SEO inferior de la home */
main > section:last-of-type, 
.box:has(h2) {
    margin-top: 60px;
}

textarea, input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    margin-bottom: 16px;
    background: #0f172a;
    color: #f1f5f9;
    transition: var(--transition);
    max-width: 100%;
}

textarea:focus, input[type="text"]:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

textarea {
    height: 180px;
    resize: vertical;
}

button {
    padding: 12px 20px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
    transition: var(--transition);
}

button:hover {
    background: #1d4ed8;
}

.stats {
    display: flex;
    gap: 20px;
    background: #0f172a;
    padding: 16px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
    flex-wrap: wrap;
}

.stats span {
    color: #38bdf8;
}

/* --- Article Specifics --- */
article.post-box h1 {
    font-size: 2.2rem;
    line-height: 1.25;
    margin-top: 0;
    color: #ffffff;
    letter-spacing: -0.5px;
    overflow-wrap: break-word;
}

.post-meta {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.adsense-box {
    background: #0f172a;
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    color: var(--muted);
    margin: 30px 0;
    font-size: 0.85rem;
    width: 100%;
    box-sizing: border-box;
}

.post-content {
    line-height: 1.8;
    color: #cbd5e1;
    overflow-wrap: break-word;
}

.post-content h3 {
    margin-top: 30px;
    color: #ffffff;
    font-size: 1.3rem;
}

/* --- Footer Profesional (Contenedores Alineados) --- */
footer.site-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 50px 0 30px 0;
    color: #020617;
    font-size: 0.9rem;
    margin-top: 80px;
    width: 100%;
    overflow: hidden;
}

.footer-container {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    align-items: start;
    width: 90%;
    max-width: 1350px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.footer-brand img.footer-logo {
    height: 36px;
    width: auto;
    margin-bottom: 16px;
}

.footer-links h4 {
    color: #ffffff;
    font-size: 1rem;
    margin: 0 0 16px 0;
}

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

.footer-links ul li {
    margin-bottom: 10px;
}

.footer-links ul li a {
    color: #020617;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links ul li a:hover {
    color: #38bdf8;
}

.footer-bottom {
    width: 90%;
    max-width: 1350px;
    margin: 40px auto 0 auto;
    padding-top: 20px;
    border-top: 1px solid #1e293b;
    text-align: center;
    font-size: 0.82rem;
    color: #64748b;
    box-sizing: border-box;
}

/* --- Encabezados y Anclajes --- */
h1, h2, h3, h4, h5, h6, [id] {
    scroll-margin-top: 90px;
}

/* --- Media Queries Responsivas (Móviles <= 768px) --- */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #0f172a;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease-in-out;
    }

    .site-nav.active {
        max-height: 280px;
    }

    .site-nav ul {
        flex-direction: column;
        gap: 0;
        padding: 15px 0;
        width: 100%;
    }

    .site-nav li {
        width: 100%;
        text-align: center;
    }

    .site-nav a {
        display: block;
        padding: 12px 0;
        width: 100%;
        font-size: 1rem;
        border-bottom: 1px solid #1e293b;
    }

    .footer-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .box, article.post-box {
        padding: 20px;
    }

    .grid {
        grid-template-columns: 1fr;
    }
}

/* --- Forzar Ocultar Hamburguesa en Escritorio --- */
@media (min-width: 769px) {
    .menu-toggle {
        display: none !important;
    }
    .site-nav {
        display: block !important;
        max-height: none !important;
        position: static !important;
        background: transparent !important;
        box-shadow: none !important;
    }
}

/* =================================================================    
   Sistema de Paginación Unificado (TextLabHub)
   ================================================================ */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 50px auto 30px auto;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.page-btn, .page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 10px;
    transition: var(--transition);
    box-sizing: border-box;
}

/* Botones de Anterior / Siguiente */
.page-nav-btn {
    padding: 10px 16px;
    gap: 6px;
}

.page-nav-btn:hover:not(.disabled) {
    background: #1e293b;
    border-color: #475569;
    color: #ffffff;
}

/* Iconos de flechas */
.page-icon {
    width: 16px;
    height: 16px;
    color: var(--muted);
    transition: var(--transition);
}

.page-nav-btn:hover:not(.disabled) .page-icon {
    color: #38bdf8;
}

/* Grupo de Números */
.page-numbers-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-number {
    width: 38px;
    height: 38px;
    padding: 0;
}

.page-number:hover {
    background: #1e293b;
    border-color: #475569;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Página Activa */
.page-number.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Puntos suspensivos (...) */
.page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 38px;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
    user-select: none;
}

/* Estados Deshabilitados */
.page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #0f172a;
    border-color: #1e293b;
}

/* Indicador para móviles pequeños */
.page-mobile-indicator {
    display: none;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--muted);
}

.page-mobile-indicator span {
    color: #38bdf8;
    font-weight: 600;
}

/* Ajuste Responsivo para móviles */
@media (max-width: 640px) {
    .page-numbers-group {
        display: none; /* Oculta la lista larga en móviles muy estrechos */
    }
    .page-mobile-indicator {
        display: inline-flex; /* Muestra el texto "Pág X de Y" en su lugar */
    }
}

/* =================================================================    
   Botones "View All" (Home) - TextLabHub
   ================================================================ */
.home-view-all-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 35px;
    width: 100%;
}

.home-view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.home-view-all-btn:hover {
    background: #1e293b;
    border-color: #475569;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.home-view-all-icon {
    width: 16px;
    height: 16px;
    color: #38bdf8;
    transition: transform 0.25s ease;
}

.home-view-all-btn:hover .home-view-all-icon {
    transform: translateX(4px);
}