/**
 * CODIFRA // TCU-452 - Sistema de Estilos y UX Oficial LeMo CAD
 * Escuela de Lenguas Modernas - Universidad de Costa Rica
 */

:root {
    --deep-sea: #001226;
    --ucr-blue: #0066B2;
    --tech-gray: #D1D3D4;
    --interface-gray: #8892b0;
    --glow-blue: #00d4ff;
    --text-main: #f0f0fa;
    --france-blue: #0055A5;
    --france-white: #ffffff;
    --france-red: #EF4135;
    --card-bg: rgba(15, 23, 42, 0.7);
    --card-border: rgba(0, 102, 178, 0.25);
    --card-hover-border: rgba(0, 212, 255, 0.6);
}

/* Ambient glow para proyecto francófono */
.ambient-france-glow {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -20%);
    width: 80vw;
    max-width: 1300px;
    height: 450px;
    background: linear-gradient(90deg, 
        rgba(0, 85, 165, 0.18) 0%, 
        rgba(255, 255, 255, 0.08) 50%, 
        rgba(239, 65, 53, 0.18) 100%
    );
    filter: blur(100px);
    border-radius: 50px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.85;
}

/* Header Ajustes */
.codifra-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flag-accent {
    display: inline-flex;
    height: 14px;
    width: 24px;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 0 8px rgba(0, 85, 165, 0.5);
    vertical-align: middle;
}
.flag-blue { width: 33.3%; background: #0055A5; }
.flag-white { width: 33.3%; background: #FFFFFF; }
.flag-red { width: 33.3%; background: #EF4135; }

/* Tipografía Hero CODIFRA: Reducción del subtítulo 15% y aumento de interlineado para evitar solapamiento de acentos */
.hero-title {
    line-height: 1.08;
}

.hero-title span {
    display: block;
    font-size: 0.85em;
    line-height: 1.25;
    margin-top: 0.35rem;
}

/* HUD Telemetría */
.hud-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(0, 102, 178, 0.15);
    border: 1px solid rgba(0, 102, 178, 0.35);
    border-radius: 4px;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.72rem;
    color: var(--glow-blue);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hud-chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 8px #2ecc71;
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* Dashboard Métricas */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin: 2.5rem 0;
}

.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--glow-blue), var(--ucr-blue));
}

.metric-card:hover {
    transform: translateY(-3px);
    border-color: var(--glow-blue);
    box-shadow: 0 10px 25px rgba(0, 102, 178, 0.25);
}

.metric-number {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.6rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    margin-bottom: 0.4rem;
}

.metric-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--interface-gray);
}

/* Bento Grid Mejorado */
.codifra-bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.8rem;
    margin-top: 2rem;
}

.col-span-12 { grid-column: span 12; }
.col-span-8  { grid-column: span 8; }
.col-span-7  { grid-column: span 7; }
.col-span-6  { grid-column: span 6; }
.col-span-5  { grid-column: span 5; }
.col-span-4  { grid-column: span 4; }

@media (max-width: 992px) {
    .col-span-8, .col-span-7, .col-span-6, .col-span-5, .col-span-4 {
        grid-column: span 12 !important;
    }
}

.bento-card-interactive {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.25rem;
    padding: 2.2rem;
    backdrop-filter: blur(14px);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.bento-card-interactive:hover {
    border-color: var(--card-hover-border);
    box-shadow: 0 12px 35px rgba(0, 102, 178, 0.25), 0 0 20px rgba(0, 212, 255, 0.15);
    transform: translateY(-4px);
}

.bento-card-interactive h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.8rem;
    letter-spacing: 0.5px;
}

.bento-card-interactive p {
    color: var(--tech-gray);
    font-size: 0.92rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

.bento-action-link {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--glow-blue);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    transition: gap 0.2s ease;
}

.bento-card-interactive:hover .bento-action-link {
    gap: 14px;
    color: #fff;
    text-shadow: 0 0 10px var(--glow-blue);
}

/* Badges */
.badge-status {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 4px;
}

.badge-active {
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid #2ecc71;
    color: #2ecc71;
    text-shadow: 0 0 8px rgba(46, 204, 113, 0.4);
}

.badge-dev {
    background: rgba(243, 156, 18, 0.15);
    border: 1px solid #f39c12;
    color: #f39c12;
    text-shadow: 0 0 8px rgba(243, 156, 18, 0.4);
}

.badge-france {
    background: rgba(0, 85, 165, 0.25);
    border: 1px solid rgba(0, 85, 165, 0.6);
    color: #00d4ff;
}

/* Buscador y Filtros */
.filter-search-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin: 2rem 0;
    padding: 1.2rem 1.6rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    backdrop-filter: blur(10px);
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.search-input {
    width: 100%;
    padding: 0.85rem 1.2rem 0.85rem 2.8rem;
    background: rgba(0, 18, 38, 0.7);
    border: 1px solid rgba(0, 102, 178, 0.4);
    border-radius: 8px;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    outline: none;
    transition: all 0.3s;
}

.search-input:focus {
    border-color: var(--glow-blue);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.35);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--interface-gray);
    font-size: 1rem;
    pointer-events: none;
}

.filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-pill {
    padding: 0.5rem 1rem;
    background: rgba(0, 102, 178, 0.15);
    border: 1px solid rgba(0, 102, 178, 0.3);
    border-radius: 20px;
    color: var(--tech-gray);
    font-size: 0.8rem;
    font-family: 'Space Grotesk', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.25s;
    user-select: none;
}

.filter-pill:hover, .filter-pill.active {
    background: var(--ucr-blue);
    color: #fff;
    border-color: var(--glow-blue);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

/* Grilla de Ejercicios */
.exercises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.2rem;
    margin-top: 1.5rem;
}

.exercise-card {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(0, 102, 178, 0.2);
    border-radius: 0.85rem;
    padding: 1.4rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backdrop-filter: blur(8px);
}

.exercise-card:hover {
    border-color: var(--glow-blue);
    background: rgba(20, 30, 55, 0.7);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 102, 178, 0.2);
}

.exercise-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.exercise-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.35;
}

.exercise-author {
    font-size: 0.75rem;
    color: var(--interface-gray);
    margin-bottom: 1rem;
    font-family: 'Inter', sans-serif;
}

.exercise-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(0, 102, 178, 0.15);
}

.btn-run-exercise {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 0.9rem;
    background: rgba(0, 102, 178, 0.25);
    border: 1px solid var(--glow-blue);
    border-radius: 6px;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s;
}

.btn-run-exercise:hover {
    background: var(--glow-blue);
    color: var(--deep-sea);
    box-shadow: 0 0 14px var(--glow-blue);
}

/* Visor Modal de Ejercicios (HUD Player) */
.exercise-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 25, 0.88);
    backdrop-filter: blur(16px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.exercise-modal-overlay.active {
    display: flex;
    animation: fadeInModal 0.25s ease forwards;
}

@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.exercise-modal-window {
    width: 95vw;
    max-width: 1100px;
    height: 90vh;
    background: var(--deep-sea);
    border: 1px solid var(--glow-blue);
    border-radius: 1.25rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 212, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.exercise-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.8rem;
    background: rgba(0, 18, 38, 0.95);
    border-bottom: 1px solid rgba(0, 102, 178, 0.3);
}

.modal-title-group {
    display: flex;
    flex-direction: column;
}

.modal-exercise-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-exercise-sub {
    font-size: 0.75rem;
    color: var(--glow-blue);
    font-family: 'Space Grotesk', monospace;
    letter-spacing: 1px;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-modal-action {
    padding: 0.45rem 0.9rem;
    background: rgba(0, 102, 178, 0.2);
    border: 1px solid rgba(0, 102, 178, 0.4);
    border-radius: 6px;
    color: var(--tech-gray);
    font-family: 'Space Grotesk', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-modal-action:hover {
    border-color: var(--glow-blue);
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.btn-modal-close {
    background: rgba(239, 65, 53, 0.2);
    border-color: rgba(239, 65, 53, 0.5);
    color: #ff7675;
}

.btn-modal-close:hover {
    background: rgba(239, 65, 53, 0.4);
    border-color: #ef4135;
    color: #fff;
    box-shadow: 0 0 12px rgba(239, 65, 53, 0.4);
}

.exercise-modal-body {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #ffffff;
    position: relative;
}

.exercise-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Audio Player Estilizado */
.custom-audio-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 18, 38, 0.8);
    border: 1px solid rgba(0, 102, 178, 0.4);
    padding: 6px 14px;
    border-radius: 20px;
    margin: 8px 0;
}

.custom-audio-pill audio {
    height: 32px;
    max-width: 240px;
    filter: invert(0.9) hue-rotate(180deg);
}

/* Galería de la Gira a Guanacaste */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2.5rem 0;
}

.gallery-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.35s ease;
    cursor: pointer;
}

.gallery-card:hover {
    border-color: var(--glow-blue);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 102, 178, 0.3);
}

.gallery-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-card:hover .gallery-img {
    transform: scale(1.04);
}

.gallery-caption {
    padding: 1.2rem;
    font-size: 0.85rem;
    color: var(--tech-gray);
    line-height: 1.5;
    border-top: 1px solid rgba(0, 102, 178, 0.15);
}

/* Secciones de Contenido */
.content-section {
    padding: 13rem 12% 5rem 12%;
    position: relative;
    z-index: 2;
    border-bottom: 1px solid rgba(0, 102, 178, 0.2);
}

@media (max-width: 768px) {
    .content-section {
        padding: 10rem 6% 3rem 6%;
    }
    .hero-title {
        font-size: 3rem !important;
    }
}
