/* src/styles/programming.css - VERSIÓN FINAL: X ALINEADA A LA IZQUIERDA */

/* =========================================
   BASE & FONDOS
   ========================================= */
body { 
    background-color: #020211; 
    font-family: 'Courier New', monospace; 
    margin: 0; 
    overflow: hidden; 
}

#grid-scan-canvas { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    z-index: 1; pointer-events: none; 
}

.fade-target { transition: opacity 0.5s ease, filter 0.5s ease; }
body.modal-active .fade-target { opacity: 0; pointer-events: none; filter: blur(5px); }

/* =========================================
   NAVEGACIÓN SUPERIOR
   ========================================= */
.nav-btn {
    position: fixed; top: 40px; z-index: 100;
    font-family: 'Courier New', monospace; font-size: 0.9rem; font-weight: bold;
    text-decoration: none; letter-spacing: 2px; padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px); color: white; 
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    opacity: 0; animation: fadeInSimple 1s forwards 3s;
}
.nav-btn.left { left: 40px; } 
.nav-btn.right { right: 40px; text-align: right; }

.nav-btn:hover { 
    background: rgba(255, 255, 255, 0.1); border-color: #00e5ff; color: #00e5ff; 
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3); transform: translateY(-2px); 
}
.switch-mode:hover { 
    border-color: #ff0055; color: #ff0055; box-shadow: 0 0 15px rgba(255, 0, 85, 0.3); 
}

/* =========================================
   INTRO & SCROLL
   ========================================= */
.intro-container { 
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); 
    text-align: center; z-index: 20; pointer-events: none; 
    animation: titleExit 0.8s cubic-bezier(0.55, 0.085, 0.68, 0.53) 2.5s forwards; 
}
.glitch-title { font-size: 5rem; color: #fff; font-weight: 900; text-shadow: 0 0 30px rgba(0, 229, 255, 0.9); }
.intro-subtitle { color: #fff; letter-spacing: 5px; margin-top: 15px; font-size: 1.2rem; opacity: 0; animation: fadeInSimple 0.5s forwards 0.5s; }

.infinite-scroll-viewport { position: relative; z-index: 10; width: 100%; height: 100vh; overflow-y: auto; scrollbar-width: none; opacity: 0; animation: fadeInSimple 1s forwards 3s; }
.project-slide { width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; position: relative; scroll-snap-align: start; scroll-snap-stop: always; }

/* =========================================
   TARJETAS
   ========================================= */
.tech-card {
    width: 60%; max-width: 800px; height: 120px;
    background: rgba(10, 10, 18, 0.85); border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--card-color, #00e5ff); border-radius: 10px; backdrop-filter: blur(15px);
    display: flex; align-items: center; padding: 0 40px; gap: 30px;
    cursor: pointer; overflow: hidden; transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 10px 40px rgba(0,0,0,0.6); position: relative;
}
.tech-card:hover { height: 550px; flex-direction: column; align-items: flex-start; justify-content: center; padding: 50px; border-color: var(--card-color); box-shadow: 0 0 60px var(--card-glow); transform: scale(1.05); }

.tech-card:hover .card-icon { align-self: center; margin-bottom: 20px; transform: scale(1.3); }
.tech-card:hover .card-header { align-self: center; text-align: center; margin-bottom: 40px; }
.tech-card:hover .card-body { opacity: 1; width: 100%; height: auto; display: flex; flex-direction: column; align-items: center; text-align: center; }

.card-icon svg { width: 50px; height: 50px; fill: #fff; transition: 0.4s; }
.card-header h2 { margin: 0; color: #fff; font-size: 2rem; }
.card-body { opacity: 0; width: 0; height: 0; overflow: hidden; transition: 0.4s; }
.detail-desc { color: #d0d0d0; font-size: 1.15rem; line-height: 1.8; max-width: 650px; margin-bottom: 30px; }
.detail-tags { display: flex; gap: 15px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.tag { border: 1px solid var(--card-color); color: var(--card-color); background: rgba(0,0,0,0.3); padding: 8px 20px; border-radius: 4px; }

.blue-theme { --card-color: #00e5ff; --card-glow: rgba(0, 229, 255, 0.8); --card-glow-low: rgba(0, 229, 255, 0.2); }
.red-theme  { --card-color: #ff3a3a; --card-glow: rgba(255, 58, 58, 0.8); --card-glow-low: rgba(255, 58, 58, 0.2); }

/* CLICK HINT */
.click-hint-radar { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); font-size: 0.75rem; color: var(--card-color); opacity: 0; transition: all 0.5s; pointer-events: none; }
.tech-card:hover .click-hint-radar { opacity: 1; right: 50px; }
.radar-ping { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 0; height: 0; border-radius: 50%; border: 2px solid var(--card-color); opacity: 0; }
.tech-card:hover .radar-ping { animation: radarWave 2s infinite ease-out; }
@keyframes radarWave { 0% { width: 10px; opacity: 0.8; } 100% { width: 140px; opacity: 0; } }

/* SCROLL HUD */
.scroll-hud-indicator { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; align-items: center; gap: 15px; opacity: 0.7; pointer-events: none; --hud-color: #00e5ff; }
.scroll-hud-indicator.red-theme-active { --hud-color: #ff3a3a; }
.hud-line { width: 40px; height: 1px; background: var(--hud-color); }
.hud-text { color: var(--hud-color); font-size: 0.75rem; display: flex; flex-direction: column; align-items: center; }
.hud-arrow { font-size: 1rem; animation: bounceArrow 1.5s infinite; }
@keyframes bounceArrow { 0%, 100% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(5px); opacity: 1; } }


/* =========================================
   HUD MODAL (LA CAJA DE DETALLE)
   ========================================= */

#prog-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 5000; opacity: 0; pointer-events: none;
    background: rgba(0, 5, 10, 0.85);
    transition: opacity 0.4s ease;
    display: flex; justify-content: center; align-items: center;
}
#prog-modal-overlay.active { opacity: 1; pointer-events: auto; }

/* Altura segura para portátiles (75vh) */
.hud-container {
    width: 96vw; max-width: 1920px; 
    height: 75vh; 
    display: flex; gap: 30px; 
    perspective: 2000px; transform-style: preserve-3d;
    align-items: stretch; 
}

.hud-box {
    position: relative; flex-grow: 1; flex-shrink: 0;
    transform-style: preserve-3d; transform: translateZ(0); opacity: 0;
    background: transparent; box-shadow: none; border: none;
    transition: transform 0.1s; 
}
#prog-modal-overlay.active .hud-box { opacity: 1 !important; transform: none; }

.hud-panel-bg {
    position: absolute; inset: 0; z-index: 0;
    background: rgba(5, 10, 15, 0.95);
    border: 2px solid var(--modal-color, #00e5ff);
    box-shadow: inset 0 0 60px rgba(0,0,0,0.8);
    backdrop-filter: blur(20px);
    clip-path: polygon(30px 0, calc(100% - 30px) 0, 100% 30px, 100% calc(100% - 30px), calc(100% - 30px) 100%, 30px 100%, 0 calc(100% - 30px), 0 30px);
    pointer-events: none; transition: border-color 0.3s, background-color 0.3s, filter 0.3s;
}

.info-content-wrapper { 
    position: relative; z-index: 20; height: 100%; padding: 40px; 
    /* Padding superior extra para dar espacio a la X */
    padding-top: 60px;
    display: flex; flex-direction: column; transform-style: preserve-3d; 
}

/* VIDEO */
.video-box { flex: 4; min-width: 0; }
.hud-bracket { position: absolute; width: 50px; height: 50px; border: 3px solid var(--modal-color); z-index: 10; pointer-events: none; }
.top-left { top: 15px; left: 15px; border-right: none; border-bottom: none; }
.top-right { top: 15px; right: 15px; border-left: none; border-bottom: none; }
.bottom-left { bottom: 15px; left: 15px; border-right: none; border-top: none; }
.bottom-right { bottom: 15px; right: 15px; border-left: none; border-top: none; }

.video-content-area { width: 96%; height: 96%; background: #000; border: 1px solid rgba(255,255,255,0.1); position: relative; overflow: hidden; z-index: 5; display: flex; justify-content: center; align-items: center; }
.hud-video-content { width: 100% !important; height: 100% !important; max-width: 100% !important; max-height: 100% !important; object-fit: contain !important; display: block; margin: 0 auto; background: #000; }
.video-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--modal-color); background: radial-gradient(circle at center, rgba(255,255,255,0.05) 0%, #000 120%); }
.scan-line { position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: var(--modal-color); opacity: 0.5; animation: scanMove 4s linear infinite; pointer-events: none !important; }
@keyframes scanMove { 0% { top: -10%; } 100% { top: 110%; } }
.video-icon { font-size: 5rem; margin-bottom: 20px; }

/* INFO */
.info-box { flex: 1; min-width: 350px; max-width: 500px; }
.back-text-btn { background: transparent; border: none; color: #fff; font-family: 'Courier New', monospace; font-size: 0.8rem; cursor: pointer; opacity: 0.6; }

/* =================================================================
   CAMBIO CLAVE: BOTÓN CERRAR MOVIDO A LA IZQUIERDA
   ================================================================= */
.modal-close-btn {
    position: absolute; 
    z-index: 5000; 
    
    /* POSICIÓN FIJA DENTRO DE LA CAJA */
    top: 15px !important; 
    /* AUMENTAMOS ESTE VALOR PARA MOVERLO A LA IZQUIERDA (Antes 15px) */
    right: 35px !important; 
    
    width: 40px; height: 40px; 
    background: #000; border: 2px solid var(--modal-color); 
    color: #fff; border-radius: 50%;
    font-size: 1.5rem; line-height: 1; 
    cursor: pointer; display: flex; justify-content: center; align-items: center;
    transition: 0.3s; box-shadow: 0 0 15px var(--modal-glow); 
    pointer-events: auto !important; 
    transform: translateZ(100px); 
}
.modal-close-btn:hover { background: var(--modal-color); color: #000; transform: translateZ(100px) scale(1.1); }

/* TEXTOS DETALLE */
.info-header-tech { border-bottom: 2px solid var(--modal-color); padding-bottom: 20px; margin-bottom: 25px; }
#modal-title { font-size: 2.5rem; color: #fff; margin: 0; line-height: 0.9; }
#modal-subtitle { color: var(--modal-color); font-size: 0.9rem; margin-top: 10px; display: block; }
.info-scroll-area { flex-grow: 1; overflow-y: auto; padding-right: 15px; pointer-events: auto; }
#modal-desc { color: #ccc; font-size: 1rem; line-height: 1.5; margin-bottom: 30px; }
.tech-divider { display: flex; align-items: center; margin: 25px 0 15px 0; color: var(--modal-color); font-size: 0.8rem; letter-spacing: 3px; font-weight: bold; }
.tech-divider::after { content: ''; flex-grow: 1; height: 2px; background: var(--modal-color); margin-left: 15px; opacity: 0.3; }
.tags-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* BOTÓN VER PROYECTO */
.info-footer { margin-top: 30px; position: relative; z-index: 100; transform-style: preserve-3d; }
.cyber-btn-mega {
    display: flex; justify-content: center; align-items: center; width: 100%; padding: 18px 0; 
    text-decoration: none; background: rgba(0, 0, 0, 0.4); 
    color: var(--modal-color); border: 2px solid var(--modal-color);
    font-weight: 900; font-size: 1rem; letter-spacing: 4px;
    font-family: 'Courier New', monospace; text-transform: uppercase;
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
    transition: all 0.2s; position: relative; overflow: visible; cursor: pointer; pointer-events: auto !important; transform: translateZ(50px); 
}
.cyber-btn-mega:hover { color: #ffffff; border-color: #fff; background: transparent; transform: translateZ(60px) scale(1.02); }

@keyframes fadeInSimple { to { opacity: 1; } }
@keyframes titleExit { 0% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -150%) scale(0.5); filter: blur(10px); } }

/* RESPONSIVE MÓVIL VERTICAL */
@media (max-width: 1100px) {
    .hud-container { flex-direction: column; height: 90vh; width: 95vw; }
    .video-box { height: 300px; flex: none; width: 100%; }
    .info-box { height: auto; flex: none; width: 100%; min-height: 500px; }
}