/* =========================================
   1. ESTILOS GLOBALES
   ========================================= */
body {
    background: radial-gradient(circle at top center, #1a2a3a 0%, #0f1214 80%) !important;
    color: #e0e0e0;
    overflow-x: hidden;
}

.px-4 {
    padding-right: 3px !important;
    padding-left: 3px !important;
}

/* =========================================
   2. HEADER DE VIDEO (MÁSCARA)
   ========================================= */
.header-video-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding-top: 2rem;
    padding-bottom: 2rem;
    background: radial-gradient(circle at top center, #1a2a3a 0%, #0f1214 80%) !important;
}

.display-stack {
    position: relative;
    max-width: 600px;
    width: 100%;
}

.display-frame {
    width: 100%;
    height: auto;
    position: relative;
    z-index: 10;
    pointer-events: none;
    display: block;
}

.video-mask {
    position: absolute;
    z-index: 1;
    background-color: #000;
    overflow: hidden;
    /* Ajuste fino para la imagen display.webp */
    top: 10%;
    left: 17.5%;
    width: 65%;
    height: 72%;
    border-radius: 4px;
}

.header-video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fade-in {
    animation: fadeIn 1s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* =========================================
   3. HUD DE BIENVENIDA
   ========================================= */
.welcome-hud {
    background: rgba(0, 85, 164, 0.1);
    border-left: 4px solid #00d2ff;
    backdrop-filter: blur(10px);
    border-radius: 0 12px 12px 0;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.05);
    margin-bottom: 3rem;
}

.welcome-hud::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: hud-scan 4s infinite;
}

@keyframes hud-scan {
    0% {
        left: -100%;
    }

    100% {
        left: 200%;
    }
}

.hud-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.7);
}

.btn-telegram {
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s;
}

.btn-telegram:hover {
    background: rgba(42, 171, 238, 0.2);
    border-color: #2AABEE;
    color: #fff;
    box-shadow: 0 0 15px rgba(42, 171, 238, 0.3);
}

/* =========================================
   4. ACORDEÓN DASHBOARD
   ========================================= */
.accordion-tech {
    --bs-accordion-bg: transparent;
    --bs-accordion-border-color: transparent;
}

.accordion-tech .accordion-item {
    border: 1px solid rgba(0, 210, 255, 0.4) !important;
    border-left: 5px solid #00d2ff !important;
    margin-bottom: 0.5rem;
    border-radius: 12px !important;
    background-color: rgba(20, 25, 30, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.1);
}

.accordion-tech .accordion-item:hover {
    border-color: #00d2ff !important;
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.25);
}

.accordion-collapse.show {
    overflow: visible !important;
}

/* El header contiene el botón con fondo - necesita overflow:hidden para border-radius */
.accordion-tech .accordion-header {
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

.accordion-tech .accordion-item:not(:has(.accordion-collapse.show)) .accordion-header {
    border-radius: 12px;
}

/* Botón Cabecera */
.accordion-tech .accordion-button {
    background-color: transparent;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    position: relative;
    border: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: height 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Pseudo-elemento para la IMAGEN DE FONDO */
/* Usamos la variable --cat-bg definida inline en el HTML para evitar errores de ruta */
.accordion-tech .accordion-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--cat-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.accordion-tech .accordion-button.collapsed::before {
    opacity: 0.5;
}

.accordion-tech .accordion-button:not(.collapsed)::before {
    opacity: 1;
    transform: scale(1.05);
}

/* Elemento de VIDEO de fondo */
.accordion-tech .accordion-bg-video {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.8s ease;
    transform: scale(1.05);
}

/* Alturas */
.accordion-tech .accordion-button.collapsed {
    height: 120px;
}

.accordion-tech .accordion-button:not(.collapsed) {
    height: 600px;
    color: white !important;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.125);
}

/* Gradiente superpuesto */
.accordion-tech .accordion-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    transition: background 0.6s ease;
    background-size: 100% 100% !important;
    background-repeat: no-repeat !important;
    background-image: none !important;
}

.accordion-tech .accordion-button.collapsed::after {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 50%, rgba(0, 0, 0, 0.2) 100%);
}

.accordion-tech .accordion-button:not(.collapsed):after {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.5) 25%, rgba(0, 0, 0, 0) 100%);
}

/* Texto del botón */
.accordion-tech .accordion-header-content {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    width: 100%;
    padding-left: 1rem;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.accordion-tech .accordion-button:not(.collapsed) .accordion-header-content {
    transform: translateY(-130px);
}

/* Cuerpo interior */
.accordion-tech .accordion-body {
    padding: 1.5rem;
    background: rgba(15, 20, 25, 0.5);
    border-top: 1px solid rgba(0, 210, 255, 0.3);
    position: relative;
    z-index: 5;
}

/* =========================================
   5. TARJETAS DE HERRAMIENTAS (ITEMS)
   ========================================= */
.tool-list-card {
    background: rgba(40, 45, 50, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    filter: grayscale(100%);
    opacity: 0.7;
}

.tool-list-card:hover,
.tool-list-card.active {
    background: rgba(40, 45, 50, 0.9);
    border-color: #00d2ff;
    filter: grayscale(0%);
    opacity: 1;
    transform: translateX(5px);
}

.tool-list-thumb {
    width: 190px;
    height: 140px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 1rem;
}

.tool-list-info {
    flex-grow: 1;
    min-width: 0;
}

.tool-list-info h6 {
    color: #fff;
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
}

.tool-list-info small {
    color: #adb5bd;
    font-size: 0.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =========================================
   6. VISOR LATERAL
   ========================================= */
.tool-visor-container {
    position: sticky;
    top: 80px;
    background: rgba(20, 25, 30, 0.8);
    border: 1px solid rgba(0, 210, 255, 0.3);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-height: calc(100vh - 120px);
    /* Altura máxima = viewport menos header y márgenes */
    height: fit-content;
    /* Se adapta al contenido */
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Scroll interno si el contenido excede */
}

.visor-image-wrapper {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    background: #000;
}

.visor-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
}

.visor-video {
    width: 100%;
    height: calc(100% + 50px);
    top: -10px;
    object-fit: cover;
    position: absolute;
    left: 0;
    display: none;
    transition: opacity 0.3s ease;
}

.visor-title {
    color: #00d2ff;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.visor-desc {
    color: #e0e0e0;
    font-size: 1.1rem;
    line-height: 1.4;
    font-weight: 500;
    margin-bottom: 1rem;
}

.visor-long-desc {
    background-color: rgba(0, 0, 0, 0.2);
    border-left: 3px solid #00d2ff;
    padding: 1rem;
    font-size: 0.9rem;
    color: #ced4da;
    line-height: 1.6;
    border-radius: 0 6px 6px 0;
    margin-top: 0.5rem;
}

.visor-long-desc strong {
    color: #fff;
}

/* =========================================
   7. RESPONSIVE (MÓVIL)
   ========================================= */
@media (max-width: 991.98px) {
    .accordion-tech .accordion-button {
        height: auto !important;
        min-height: 80px;
        background-color: rgba(20, 25, 30, 0.9) !important;
    }

    .accordion-tech .accordion-button::before,
    .accordion-tech .accordion-button::after,
    .accordion-tech .accordion-bg-video {
        display: none !important;
    }

    .accordion-tech .accordion-button:not(.collapsed) .accordion-header-content {
        transform: none !important;
    }

    .accordion-tech .accordion-header-content {
        display: grid !important;
        grid-template-columns: min-content 1fr;
        grid-template-rows: auto auto;
        column-gap: 15px;
        align-items: center;
        width: 100%;
        padding-left: 0 !important;
    }

    .accordion-tech .accordion-header-content i {
        grid-row: 1 / 3;
        grid-column: 1;
        margin-right: 0 !important;
        font-size: 2rem !important;
        color: #00d2ff;
    }

    .accordion-tech .accordion-header-content>span:first-of-type {
        grid-row: 1;
        grid-column: 2;
        font-size: 1.1rem !important;
        line-height: 1.2;
        align-self: end;
        white-space: normal;
    }

    .accordion-tech .accordion-header-content .badge {
        grid-row: 2;
        grid-column: 2;
        justify-self: start;
        margin-left: 0 !important;
        margin-top: 4px;
        font-size: 0.65rem !important;
        align-self: start;
    }

    .tool-list-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 0;
        filter: none !important;
        opacity: 1 !important;
        box-shadow: 0 0 20px rgba(0, 210, 255, 0.1);
        transform: none !important;
    }

    .tool-list-card:hover,
    .tool-list-card.active {
        transform: none !important;
    }

    .tool-list-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
        object-fit: cover;
        border-radius: 6px 6px 0 0;
        margin-right: 0;
        margin-bottom: 0;
    }

    .tool-list-info {
        padding: 1rem;
        width: 100%;
    }

    .tool-list-info h6 {
        margin-bottom: 0.25rem;
        font-size: 1.1rem;
    }

    .tool-full-desc-mobile {
        display: block;
        width: 100%;
        background-color: rgba(0, 210, 255, 0.05);
        border-top: 1px solid rgba(0, 210, 255, 0.2);
        padding: 1rem;
        font-size: 0.85rem;
        color: #ced4da;
        line-height: 1.5;
    }

    .col-lg-5 {
        display: none !important;
    }

    .col-lg-7 {
        width: 100%;
    }

    .col-xl-2-sm-12 {
        width: 100%;
    }

    .row-cols-xl-2 {
        --bs-rows: 1;
    }

    .row .col {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (min-width: 992px) {
    .col-xl-2-sm-12 {
        flex: 0 0 auto;
        width: 50%;
    }

    .accordion-tech .accordion-item {
        margin-bottom: 1.5rem !important;
    }
}