/* --- 1. CONFIGURACIÓN GENERAL --- */

body {
    font-family: 'Inter', sans-serif;
    background-color: #121212 !important;
    color: #f8f9fa;
    margin: 0;
    padding: 0;
}

#matrixCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: #000;
}

/* --- 2. HEADER Y VIDEO --- */

.matrix-header {
    position: relative;
    height: 300px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 300px;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2;
}

.header-content {
    position: relative;
    z-index: 3;
}

.header-content h1 {
    color: #00ff41;
    text-shadow: 0 0 15px rgba(0, 255, 65, 0.8);
}

/* --- 3. SECCIONES Y TÍTULOS --- */

.category-title {
    font-weight: 600;
    font-size: 1.8rem;
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    color: #00ff41;
    /* fallback si alguna sección no lleva clase cat-* */
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-left: 5px solid #00ff41;
    padding-left: 15px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

/* --- 3.1 SISTEMA DE COLOR POR CATEGORÍA ---
   Cada sección define su propio --cat-color. El título (h2) y los
   títulos de tarjeta (.card-title/h5/h6) dentro de esa sección heredan
   la variable automáticamente. El verde Matrix se reserva como color
   de marca (botones, buscador, hover) y no se repite aquí salvo en
   "Code & Dev Agents", donde encaja temáticamente. */

.cat-tutoriales {
    --cat-color: #00e5ff;
}

.cat-diseno {
    --cat-color: #9d6bff;
}

.cat-iconos {
    --cat-color: #4d9fff;
}

.cat-editores {
    --cat-color: #ff5c5c;
}

.cat-optimiz {
    --cat-color: #ffb020;
}

.cat-tipografia {
    --cat-color: #ff4fa3;
}

.cat-creativos {
    --cat-color: #ff8a3d;
}

.cat-devagents {
    --cat-color: #00ff41;
}

.cat-asistentes {
    --cat-color: #7c8cff;
}

.cat-newgen {
    --cat-color: #2dd4bf;
}

.cat-ia-avanz {
    --cat-color: #b8e34d;
}

h2.category-title[class*="cat-"] {
    color: var(--cat-color) !important;
    border-left-color: var(--cat-color);
}

.row[class*="cat-"] .card-title,
.row[class*="cat-"] h5,
.row[class*="cat-"] h6 {
    color: var(--cat-color) !important;
    text-shadow: 0 0 5px color-mix(in srgb, var(--cat-color) 35%, transparent);
}

/* Botones: da igual si la tarjeta trae btn-primary, btn-danger, btn-dark,
   btn-light o cualquier variante outline; dentro de una categoría todos
   los botones se ven iguales, con el color de esa categoría. */
.row[class*="cat-"] .btn {
    background-color: transparent !important;
    border: 1px solid var(--cat-color) !important;
    color: var(--cat-color) !important;
}

.row[class*="cat-"] .btn:hover,
.row[class*="cat-"] .btn:focus {
    background-color: var(--cat-color) !important;
    border-color: var(--cat-color) !important;
    color: #000 !important;
    box-shadow: 0 0 10px color-mix(in srgb, var(--cat-color) 50%, transparent);
}

/* --- 4. MAQUETACIÓN DE TARJETAS --- */

main .col,
main [class*="col-"] {
    padding: 15px;
}

main .card {
    background-color: rgba(33, 37, 41, 0.1) !important;
    backdrop-filter: blur(5px);
    color: #ffffff !important;
    border: 1px solid #343a40;
    border-radius: 12px;
    min-height: 180px;
    max-height: 250px;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}

main .card:hover {
    transform: translateY(-10px);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.4);
    border-color: #00ff41 !important;
    background-color: rgba(0, 0, 0, 1) !important;
}

main .card-body {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* --- 5. TEXTOS Y BOTONES --- */

main .card-title {
    font-size: 1.1rem !important;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Ya no forzamos verde global en .text-primary/.text-success: el color
   de cada título lo da ahora el sistema de categorías de arriba. Estas
   clases de Bootstrap se quedan neutras (heredan el color de categoría). */
.text-primary,
.text-success {
    color: inherit;
}

main .card-text {
    font-size: 0.85rem !important;
    line-height: 1.4;
    color: #f1f1f1 !important;
}

main .card .text-muted {
    color: #f1f1f1 !important;
    opacity: 0.92;
}

/* Para resaltar tarjetas especiales de IA o Agentes */
.border-glow-blue {
    border-color: #00e5ff !important;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

/* --- 6. NUEVA SECCION: REPORTES --- */

.btn-reporte:hover {
    transform: scale(1.2);
    color: #ff0000;
}

/* Asegura que el contenedor principal de la tarjeta sea el relativo */
.card-reportable {
    position: relative !important;
}

/* Posiciona el botón de reporte directamente sobre la tarjeta */
.card-reportable .btn-reporte {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 100;
}

.btn-reporte {
    background: rgba(0, 0, 0, 0.5);
    /* Fondo semitransparente para que resalte */
    border: none;
    color: #ff4d4d;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s;
    border-radius: 50%;
    padding: 2px 8px;
}

/* --- 7. BUSCADOR --- */

.buscador-container {
    max-width: 500px;
    margin: 2rem auto 1rem auto;
    text-align: center;
}

#buscadorEnlaces {
    background-color: rgba(33, 37, 41, 0.6);
    border: 1px solid #00ff41;
    color: #ffffff;
    border-radius: 30px;
    padding: 10px 20px;
}

#buscadorEnlaces:focus {
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    border-color: #00ff41;
}

#buscadorEnlaces::placeholder {
    color: #adb5bd;
}

#resultadosContador {
    font-size: 0.85rem;
    color: #00ff41;
    margin-top: 8px;
    min-height: 1.2em;
}

.oculto {
    display: none !important;
}

/* --- 8. COMENTARIOS (GISCUS) --- */
.comentarios-container {
    margin-top: 2rem;
    margin-bottom: 4rem;
}

/* --- 9. ADAPTACIÓN MÓVIL (HEADER Y TIPOGRAFÍA) --- */
@media (max-width: 576px) {

    /* Permitir que el contenedor del header se adapte al contenido */
    .matrix-header,
    .overlay {
        height: auto !important;
        min-height: 320px;
        padding: 2.5rem 1rem 2rem 1rem;
    }

    /* Reducir el tamaño de la letra del título principal */
    .header-content h1,
    .header-content h1.display-3 {
        font-size: 2rem !important;
        line-height: 1.2;
    }

    /* Ajustar el tamaño del texto descriptivo */
    .header-content .lead {
        font-size: 0.95rem !important;
        margin-top: 0.5rem;
    }

    /* Ajustar los botones para que entren holgadamente */
    .header-content .btn {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.8rem !important;
        margin-top: 0.5rem !important;
    }
}

/* --- 10. FOOTER Y CONTADOR DE VISITAS --- */
.site-footer {
    margin-top: 2rem;
    padding: 1.5rem 0 2.5rem 0;
}

.contador-visitas {
    display: inline-block;
    opacity: 0.85;
    filter: grayscale(0.3);
    transition: opacity 0.2s ease, filter 0.2s ease;
    border-radius: 6px;
}

.contador-visitas:hover {
    opacity: 1;
    filter: none;
}

.contador-visitas img {
    max-width: 200px;
    height: auto;
}