/*
================================================
GLOSARIO ESPACIAL - CSS
================================================
Estilos para el glosario espacial con enlaces a YouTube
Diseño responsivo y efectos espaciales
================================================
*/

/* ================================================
   1. RESET Y CONFIGURACIÓN BASE
   ================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans', sans-serif;
    background: url('assets/glosario/imgfondoglosario.jpeg');
    min-height: 100vh;
    color: white;
    overflow-x: hidden;
    position: relative;
}

/* ================================================
   2. FONDO DE ESTRELLAS
   ================================================ */

.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite alternate;
}

@keyframes twinkle {
    0% { 
        opacity: 0.3; 
        transform: scale(0.8); 
    }
    100% { 
        opacity: 1; 
        transform: scale(1.2); 
    }
}

/* ================================================
   3. LAYOUT PRINCIPAL
   ================================================ */

.container {
    position: relative;
    z-index: 10;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ================================================
   4. HEADER
   ================================================ */

.header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    backdrop-filter: blur(15px);
    box-shadow: 0 0 40px rgba(79, 195, 247, 0.2);
    animation: headerFadeIn 1s ease-out;
}

@keyframes headerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header h1 {
    font-size: 3.5rem;
    background: linear-gradient(45deg, #fff, #4fc3f7, #e1bee7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    text-shadow: 0 0 30px rgba(79, 195, 247, 0.8);
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { filter: brightness(1); }
    to { filter: brightness(1.2); }
}

.header p {
    font-size: 1.3rem;
    color: #b0bec5;
    font-style: italic;
    margin-top: 10px;
}

/* ================================================
   5. BOTÓN DE REGRESO
   ================================================ */

.back-btn {
    position: fixed;
    top: 25px;
    left: 25px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 1.8rem;
    font-weight: bold;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.back-btn:hover {
    background: rgba(79, 195, 247, 0.3);
    border-color: rgba(79, 195, 247, 0.6);
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(79, 195, 247, 0.4);
}

/* ================================================
   6. GRID DE TÉRMINOS
   ================================================ */

.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
    padding: 20px;
}

/* ================================================
   7. TARJETAS DE TÉRMINOS (AHORA SON ENLACES)
   ================================================ */

.term-card {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 25px;
    padding: 25px;
    backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.term-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.term-card:hover::before {
    left: 100%;
}

.term-card:hover {
    transform: translateY(-15px) scale(1.03);
    box-shadow: 0 25px 50px rgba(79, 195, 247, 0.3);
}

.term-title {
    font-size: 1.6rem;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
    color: #4fc3f7;
    text-shadow: 0 0 15px rgba(79, 195, 247, 0.8);
}

.term-definition-preview {
    font-size: 1rem;
    line-height: 1.6;
    color: #e0e0e0;
    text-align: center;
    margin-top: auto;
    padding-top: 15px;
}

/* ================================================
   8. CONTENEDORES DE GIF
   ================================================ */

.gif-container {
    position: relative;
    width: 100%;
    height: 200px;
    margin: 15px 0;
    border-radius: 15px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Agregar después de la clase .gif-container existente */

.gif-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 13px;
}

/* Opcional: Si quieres que el contenedor se adapte al ratio 16:9 */
.gif-container.video-container {
    height: 0;
    padding-bottom: 56.25%; /* Ratio 16:9 */
    position: relative;
}

/* Responsive para videos */
@media (max-width: 1024px) {
    .gif-container iframe {
        border-radius: 12px;
    }
}

@media (max-width: 768px) {
    .gif-container iframe {
        border-radius: 10px;
    }
}

.term-gif {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    transition: opacity 0.3s ease;
}

.gif-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(79, 195, 247, 0.2), rgba(225, 190, 231, 0.2));
    border-radius: 13px;
}

.gif-placeholder span {
    font-size: 4rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(79, 195, 247, 0.5));
    animation: placeholderPulse 2s ease-in-out infinite;
}

@keyframes placeholderPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.gif-placeholder p {
    font-size: 1.1rem;
    color: #4fc3f7;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(79, 195, 247, 0.8);
}

/* Colores específicos para cada término */
.term-card:nth-child(1) { border-color: rgba(79, 195, 247, 0.4); }
.term-card:nth-child(1):hover { border-color: rgba(79, 195, 247, 0.8); }

.term-card:nth-child(2) { border-color: rgba(225, 190, 231, 0.4); }
.term-card:nth-child(2):hover { border-color: rgba(225, 190, 231, 0.8); }

.term-card:nth-child(3) { border-color: rgba(255, 152, 0, 0.4); }
.term-card:nth-child(3):hover { border-color: rgba(255, 152, 0, 0.8); }

.term-card:nth-child(4) { border-color: rgba(76, 175, 80, 0.4); }
.term-card:nth-child(4):hover { border-color: rgba(76, 175, 80, 0.8); }

.term-card:nth-child(5) { border-color: rgba(233, 30, 99, 0.4); }
.term-card:nth-child(5):hover { border-color: rgba(233, 30, 99, 0.8); }

.term-card:nth-child(6) { border-color: rgba(156, 39, 176, 0.4); }
.term-card:nth-child(6):hover { border-color: rgba(156, 39, 176, 0.8); }

.term-card:nth-child(7) { border-color: rgba(255, 193, 7, 0.4); }
.term-card:nth-child(7):hover { border-color: rgba(255, 193, 7, 0.8); }

.term-card:nth-child(8) { border-color: rgba(0, 188, 212, 0.4); }
.term-card:nth-child(8):hover { border-color: rgba(0, 188, 212, 0.8); }

.term-card:nth-child(9) { border-color: rgba(255, 87, 34, 0.4); }
.term-card:nth-child(9):hover { border-color: rgba(255, 87, 34, 0.8); }

.term-card:nth-child(10) { border-color: rgba(103, 58, 183, 0.4); }
.term-card:nth-child(10):hover { border-color: rgba(103, 58, 183, 0.8); }

.term-card:nth-child(11) { border-color: rgba(139, 195, 74, 0.4); }
.term-card:nth-child(11):hover { border-color: rgba(139, 195, 74, 0.8); }

.term-card:nth-child(12) { border-color: rgba(255, 64, 129, 0.4); }
.term-card:nth-child(12):hover { border-color: rgba(255, 64, 129, 0.8); }

/* ================================================
   9. DISEÑO RESPONSIVO
   ================================================ */

/* Tablets */
@media (max-width: 1024px) {
    .header h1 {
        font-size: 2.8rem;
    }
    
    .header p {
        font-size: 1.1rem;
    }
    
    .glossary-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 25px;
    }
    
    .term-card {
        min-height: 350px;
        padding: 20px;
    }
    
    .term-title {
        font-size: 1.4rem;
    }
    
    .gif-container {
        height: 180px;
    }
}

/* Móviles */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 30px 20px;
        margin-bottom: 30px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .back-btn {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
        top: 20px;
        left: 20px;
    }
    
    .glossary-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 10px;
    }
    
    .term-card {
        min-height: 320px;
        padding: 18px;
    }
    
    .term-title {
        font-size: 1.3rem;
    }
    
    .gif-container {
        height: 160px;
    }
    
    .gif-placeholder span {
        font-size: 3rem;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    .back-btn {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .term-card {
        min-height: 280px;
        padding: 15px;
    }
    
    .term-title {
        font-size: 1.1rem;
    }
    
    .gif-container {
        height: 140px;
    }
    
    .gif-placeholder span {
        font-size: 2.5rem;
    }
    
    .gif-placeholder p {
        font-size: 0.9rem;
    }
    
    .term-definition-preview {
        font-size: 0.9rem;
    }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Estados de focus para accesibilidad */
.term-card:focus,
.back-btn:focus {
    outline: 3px solid #4fc3f7;
    outline-offset: 2px;
}
/* Scrollbar personalizado para el modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(79, 195, 247, 0.5);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 195, 247, 0.7);
}