/* ========================================
   GESSOF Academy - Componentes
   Estilos para Módulos, Videos, Carruseles y Modales
   ======================================== */

/* ========================================
   Módulos / Herramientas
   ======================================== */

.grid-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.module {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    transition: all 0.4s ease;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.module:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.module-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 14px;
    color: white;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0, 153, 216, 0.25);
}

/* ========================================
   Tarjetas de Video
   ======================================== */

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.video-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s var(--ease-out);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    flex: 0 0 300px;
    scroll-snap-align: start;
}

.video-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.video-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    background: transparent;
    overflow: hidden;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s var(--ease-out);
    opacity: 1 !important;
    filter: none !important;
    -webkit-filter: none !important;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
}

.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-card:hover .play-overlay {
    opacity: 1;
}

.play-icon {
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 20px var(--primary-glow);
    transform: scale(0.8);
    transition: transform 0.3s var(--ease-spring);
}

.video-card:hover .play-icon {
    transform: scale(1);
}

.video-info {
    padding: 1.25rem;
}

.video-number {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    display: block;
}

.video-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.video-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

/* ========================================
   Checkbox de Progreso y Videos Importantes
   ======================================== */

.video-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 10;
}

.video-important-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.video-important-btn:hover {
    background: var(--accent-orange);
    transform: scale(1.1);
}

.video-important-btn.active {
    background: var(--accent-orange);
    color: white;
}

.video-card.watched::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-lg);
    z-index: 5;
    pointer-events: none;
}

.video-card.watched {
    opacity: 1 !important;
}

/* ========================================
   Carrusel
   ======================================== */

.carousel-wrapper {
    position: relative;
    margin: 0 -1rem;
    padding: 1rem;
}

.videos-grid:not(.layout-grid) {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1.5rem;
    padding-bottom: 2rem;
    scrollbar-width: none;
}

.videos-grid:not(.layout-grid)::-webkit-scrollbar {
    display: none;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    color: var(--text-primary);
}

.carousel-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.carousel-btn.prev {
    left: -20px;
}

.carousel-btn.next {
    right: -20px;
}

/* ========================================
   Modales
   ======================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow-y: auto;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-card);
    margin: 5% auto;
    padding: 0;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 800px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: modalSlideIn 0.3s var(--ease-out);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-main);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close {
    color: var(--text-muted);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: var(--primary);
}

.modal-body {
    padding: 2rem;
    color: var(--text-secondary);
}

.code-block {
    background: #1e1e1e;
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #d4d4d4;
    margin: 1rem 0;
}

.summary-section h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.important-note {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--accent-orange);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

.key-points {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--accent-green);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

/* ==========================================================================
   GLOSARIO Y BUSCADOR
   ========================================================================== */

.search-container {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
    transform: translateY(-2px);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.glossary-category-section {
    margin-bottom: 3.5rem;
    animation: fadeIn 0.5s ease;
}

.category-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border), transparent);
}

.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.glossary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.glossary-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.glossary-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.glossary-card h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.glossary-tag {
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
}

.glossary-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

.glossary-example {
    margin-top: 0.5rem;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 1rem;
    border-left: 3px solid var(--primary);
}

.glossary-example strong {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.glossary-example pre {
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    overflow-x: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    .glossary-grid {
        grid-template-columns: 1fr;
    }

    .search-container {
        max-width: 100%;
    }
}