@extends('public.layouts.app')

@section('title', 'Resultados ONEM-Aceros Arequipa 2026 - 2° Grado')

@section('styles')
    <style>
        /* ===========================
           ONEM RESULTADOS - ESTILOS
        =========================== */
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Poppins:wght@400;600;700;800&display=swap');

        :root {
            --onem-primary: #1a237e;
            --onem-secondary: #283593;
            --onem-accent: #1565c0;
            --onem-gold: #f9a825;
            --onem-gold-light: #fff9c4;
            --onem-bg: #f0f4f8;
            --onem-card: #ffffff;
            --onem-border: #e0e7ef;
            --onem-text: #1a237e;
            --onem-shadow: 0 4px 24px rgba(26, 35, 126, 0.10);
            --onem-shadow-lg: 0 8px 40px rgba(26, 35, 126, 0.16);
        }

        body {
            font-family: 'Inter', sans-serif;
            background: var(--onem-bg);
        }

        /* ---------- HERO BANNER ---------- */
        .onem-hero {
            background: linear-gradient(135deg, #0d1b6e 0%, #1a237e 40%, #283593 70%, #1565c0 100%);
            padding: 56px 0 40px;
            position: relative;
            overflow: hidden;
        }

        .onem-hero::before {
            content: '';
            position: absolute;
            inset: 0;
            background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
        }

        .onem-hero::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            right: 0;
            height: 40px;
            background: var(--onem-bg);
            clip-path: ellipse(55% 100% at 50% 100%);
        }

        .onem-hero-content {
            position: relative;
            z-index: 2;
            text-align: center;
        }

        .onem-badge {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: rgba(255, 255, 255, 0.12);
            border: 1px solid rgba(255, 255, 255, 0.25);
            border-radius: 50px;
            padding: 6px 20px;
            font-size: 13px;
            font-weight: 600;
            color: #ffe082;
            margin-bottom: 18px;
            backdrop-filter: blur(8px);
            letter-spacing: 0.5px;
        }

        .onem-hero-title {
            font-family: 'Poppins', sans-serif;
            font-size: 2.6rem;
            font-weight: 800;
            color: #ffffff;
            margin: 0 0 10px;
            line-height: 1.15;
            text-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
        }

        .onem-hero-title span {
            color: #ffe082;
        }

        .onem-hero-subtitle {
            color: rgba(255, 255, 255, 0.80);
            font-size: 1.05rem;
            margin-bottom: 28px;
            font-weight: 400;
        }

        .onem-hero-stats {
            display: flex;
            justify-content: center;
            gap: 32px;
            flex-wrap: wrap;
        }

        .onem-stat-pill {
            background: rgba(255, 255, 255, 0.13);
            border: 1px solid rgba(255, 255, 255, 0.20);
            border-radius: 16px;
            padding: 12px 24px;
            color: #fff;
            text-align: center;
            backdrop-filter: blur(6px);
            min-width: 120px;
        }

        .onem-stat-pill .val {
            font-size: 1.8rem;
            font-weight: 800;
            color: #ffe082;
            line-height: 1;
        }

        .onem-stat-pill .lbl {
            font-size: 11px;
            font-weight: 500;
            color: rgba(255, 255, 255, 0.75);
            margin-top: 2px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        /* ---------- CONTROLES ---------- */
        .onem-controls {
            background: var(--onem-card);
            border-radius: 18px;
            box-shadow: var(--onem-shadow);
            padding: 20px 28px;
            margin: 30px 0 18px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 14px;
            border: 1px solid var(--onem-border);
        }

        .onem-filter-group {
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
        }

        .onem-filter-btn {
            padding: 8px 20px;
            border-radius: 50px;
            border: 2px solid var(--onem-border);
            background: #f8fafc;
            color: #555;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            font-family: 'Inter', sans-serif;
        }

        .onem-filter-btn:hover,
        .onem-filter-btn.active {
            background: var(--onem-primary);
            border-color: var(--onem-primary);
            color: #fff;
            box-shadow: 0 2px 12px rgba(26, 35, 126, 0.25);
        }

        .onem-filter-btn.clasificado-btn {
            background: #fff8e1;
            border-color: #f9a825;
            color: #e65100;
        }

        .onem-filter-btn.clasificado-btn.active {
            background: #f9a825;
            border-color: #f9a825;
            color: #fff;
        }

        .onem-search {
            display: flex;
            align-items: center;
            gap: 8px;
            background: #f0f4f8;
            border: 1.5px solid var(--onem-border);
            border-radius: 50px;
            padding: 8px 18px;
        }

        .onem-search input {
            border: none;
            background: transparent;
            outline: none;
            font-size: 14px;
            color: #333;
            font-family: 'Inter', sans-serif;
            width: 200px;
        }

        .onem-search i {
            color: #aaa;
        }

        /* ---------- LEYENDA ---------- */
        .onem-legend {
            display: flex;
            align-items: center;
            gap: 18px;
            flex-wrap: wrap;
            margin-bottom: 14px;
            padding: 0 4px;
        }

        .onem-legend-item {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            color: #555;
            font-weight: 500;
        }

        .legend-dot {
            width: 16px;
            height: 16px;
            border-radius: 4px;
            flex-shrink: 0;
        }

        .legend-dot.clasificado {
            background: #ffe082;
            border: 1px solid #f9a825;
        }

        .legend-dot.normal {
            background: #f0f4f8;
            border: 1px solid #ddd;
        }

        /* ---------- TABLA ---------- */
        .onem-table-wrapper {
            background: var(--onem-card);
            border-radius: 18px;
            box-shadow: var(--onem-shadow-lg);
            border: 1px solid var(--onem-border);
            /* overflow: hidden quitado — lo maneja .onem-scroll-wrapper */
        }

        .onem-table {
            width: 100%;
            min-width: 1120px;
            /* tabla + columna observación */
            border-collapse: collapse;
            font-size: 13.5px;
        }

        .onem-table thead {
            background: linear-gradient(135deg, #0d1b6e, #1a237e, #283593);
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .onem-table thead tr:first-child th {
            padding: 14px 10px 10px;
            color: #ffe082;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1.2px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.10);
            text-align: center;
        }

        .onem-table thead tr:last-child th {
            padding: 10px 8px 14px;
            color: #ffffff;
            font-size: 12px;
            font-weight: 600;
            text-align: center;
            white-space: nowrap;
        }

        .onem-table thead tr:last-child th.col-name {
            text-align: left;
            padding-left: 16px;
        }

        .onem-table th.col-p {
            min-width: 44px;
        }

        .onem-table th.col-nota {
            min-width: 80px;
        }

        /* FILAS */
        .onem-table tbody tr {
            transition: background 0.18s;
        }

        .onem-table tbody tr:hover {
            background: rgba(26, 35, 126, 0.04) !important;
        }

        .onem-table tbody tr.clasificado-row {
            background: #fffde7;
        }

        .onem-table tbody tr.clasificado-row:hover {
            background: #fff9c4 !important;
        }

        .onem-table td {
            padding: 11px 8px;
            border-bottom: 1px solid #f0f4f8;
            text-align: center;
            color: #2d3748;
            vertical-align: middle;
        }

        .onem-table td.col-name {
            text-align: left;
            padding-left: 16px;
            font-weight: 600;
            color: var(--onem-text);
            white-space: nowrap;
        }

        .onem-table tbody tr:last-child td {
            border-bottom: none;
        }

        /* NÚMERO */
        .num-cell {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 28px;
            height: 28px;
            border-radius: 50%;
            font-weight: 700;
            font-size: 12px;
        }

        .num-cell.rank-1 {
            background: linear-gradient(135deg, #f9a825, #ff8f00);
            color: #fff;
            box-shadow: 0 2px 8px rgba(249, 168, 37, 0.5);
        }

        .num-cell.rank-2 {
            background: linear-gradient(135deg, #90a4ae, #607d8b);
            color: #fff;
            box-shadow: 0 2px 8px rgba(96, 125, 139, 0.4);
        }

        .num-cell.rank-3 {
            background: linear-gradient(135deg, #a1887f, #795548);
            color: #fff;
            box-shadow: 0 2px 8px rgba(121, 85, 72, 0.4);
        }

        .num-cell.rank-other {
            background: #eef2f7;
            color: #555;
        }

        /* SECCIÓN BADGE */
        .seccion-badge {
            display: inline-block;
            padding: 3px 12px;
            border-radius: 50px;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.5px;
        }

        .seccion-b {
            background: #e8eaf6;
            color: #3949ab;
        }

        .seccion-a {
            background: #e0f2f1;
            color: #00695c;
        }

        /* NOTA FINAL */
        .nota-badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 50px;
            font-size: 13px;
            font-weight: 800;
            min-width: 48px;
            text-align: center;
        }

        .nota-50 {
            background: linear-gradient(135deg, #1a237e, #283593);
            color: #fff;
            box-shadow: 0 2px 10px rgba(26, 35, 126, 0.3);
        }

        .nota-40 {
            background: linear-gradient(135deg, #0288d1, #0277bd);
            color: #fff;
        }

        .nota-35 {
            background: linear-gradient(135deg, #00acc1, #0097a7);
            color: #fff;
        }

        .nota-30 {
            background: linear-gradient(135deg, #00897b, #00796b);
            color: #fff;
        }

        .nota-20 {
            background: #e3f2fd;
            color: #1565c0;
            border: 1px solid #bbdefb;
        }

        .nota-10 {
            background: #f3e5f5;
            color: #7b1fa2;
            border: 1px solid #ce93d8;
        }

        .nota-0 {
            background: #fafafa;
            color: #999;
            border: 1px solid #eee;
        }

        /* TIEMPO */
        .tiempo-cell {
            font-size: 12px;
            color: #888;
            font-weight: 500;
        }

        .tiempo-cell i {
            color: #b0bec5;
            margin-right: 3px;
        }

        /* CLASIFICADO BADGE (etiqueta compacta) */
        .clasificado-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 3px;
            background: linear-gradient(135deg, #f9a825, #ffca28);
            color: #5d4037;
            font-size: 9px;
            font-weight: 800;
            padding: 2px 6px;
            border-radius: 4px;
            white-space: nowrap;
            letter-spacing: 0.3px;
            text-transform: uppercase;
            vertical-align: middle;
            box-shadow: 0 1px 4px rgba(249, 168, 37, 0.35);
            cursor: default;
        }

        .clasificado-badge i {
            font-size: 8px;
        }

        /* PUNTAJE PREGUNTAS */
        .p-val {
            font-weight: 600;
        }

        .p-high {
            color: #2e7d32;
        }

        .p-mid {
            color: #1565c0;
        }

        .p-low {
            color: #e65100;
        }

        .p-zero {
            color: #ccc;
        }

        .p-invalid {
            color: #e53935;
            font-size: 11px;
            font-weight: 700;
        }

        /* INFO CARDS */
        .onem-info-cards {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 16px;
            margin-bottom: 24px;
        }

        .onem-info-card {
            background: var(--onem-card);
            border-radius: 14px;
            padding: 18px 22px;
            border: 1px solid var(--onem-border);
            box-shadow: var(--onem-shadow);
            display: flex;
            align-items: center;
            gap: 14px;
            animation: fadeSlideIn 0.4s ease both;
        }

        .onem-info-card:nth-child(2) {
            animation-delay: 0.07s;
        }

        .onem-info-card:nth-child(3) {
            animation-delay: 0.14s;
        }

        .onem-info-card:nth-child(4) {
            animation-delay: 0.21s;
        }

        .onem-info-card .icon-wrap {
            width: 46px;
            height: 46px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            flex-shrink: 0;
        }

        .onem-info-card .card-val {
            font-size: 1.6rem;
            font-weight: 800;
            color: var(--onem-text);
            line-height: 1;
        }

        .onem-info-card .card-lbl {
            font-size: 12px;
            color: #888;
            font-weight: 500;
            margin-top: 3px;
        }

        /* GANADORES */
        .onem-winners-section {
            background: linear-gradient(135deg, #fff8e1, #fffde7);
            border: 2px solid #f9a825;
            border-radius: 16px;
            padding: 20px 24px;
            margin-bottom: 22px;
        }

        .onem-winners-title {
            font-size: 16px;
            font-weight: 700;
            color: #e65100;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .onem-winners-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        .winner-chip {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: #fff;
            border: 1.5px solid #f9a825;
            border-radius: 50px;
            padding: 7px 16px;
            font-size: 13px;
            font-weight: 600;
            color: #5d4037;
            box-shadow: 0 2px 8px rgba(249, 168, 37, 0.2);
        }

        .winner-chip .rank-num {
            background: #f9a825;
            color: #fff;
            border-radius: 50%;
            width: 22px;
            height: 22px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 11px;
            font-weight: 800;
            flex-shrink: 0;
        }

        .winner-chip .nota-pts {
            background: var(--onem-primary);
            color: #ffe082;
            border-radius: 50px;
            padding: 2px 8px;
            font-size: 11px;
            font-weight: 700;
        }

        /* SCORE HEADER */
        .onem-score-header {
            padding: 10px 16px;
            background: linear-gradient(90deg, rgba(26, 35, 126, 0.06), transparent);
            border-left: 4px solid var(--onem-primary);
            font-size: 12.5px;
            color: #555;
        }

        .onem-score-header strong {
            color: var(--onem-text);
        }

        /* TABLE FOOTER */
        .onem-table tfoot td {
            padding: 12px 10px;
            background: #f8fafc;
            font-size: 12px;
            color: #888;
            border-top: 2px solid var(--onem-border);
        }

        /* SCROLL WRAPPER */
        .onem-scroll-wrapper {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            /* scroll suave en iOS */
            border-radius: 18px;
            /* Preserva el border-radius mientras se hace scroll */
            -webkit-mask-image: -webkit-radial-gradient(white, black);
        }

        /* Indicador visual de scroll en móvil */
        .onem-scroll-hint {
            display: none;
            align-items: center;
            gap: 6px;
            font-size: 11.5px;
            color: #888;
            margin-bottom: 6px;
            padding: 0 4px;
        }

        .onem-scroll-hint i {
            color: var(--onem-accent);
            animation: swipeLeft 1.5s infinite;
        }

        @keyframes swipeLeft {

            0%,
            100% {
                transform: translateX(0);
            }

            50% {
                transform: translateX(-6px);
            }
        }

        @media (max-width: 768px) {
            .onem-scroll-hint {
                display: flex;
            }
        }

        /* ANIMACIONES */
        @keyframes fadeSlideIn {
            from {
                opacity: 0;
                transform: translateY(18px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .onem-table-wrapper {
            animation: fadeSlideIn 0.5s ease both;
        }

        /* ===================================================
           RESPONSIVE — COMPLETO
        =================================================== */

        /* --- ≤ 1200px (laptop pequeño) --- */
        @media (max-width: 1200px) {
            .onem-hero-title {
                font-size: 2.2rem;
            }

            .onem-stat-pill {
                min-width: 100px;
                padding: 10px 18px;
            }

            .onem-stat-pill .val {
                font-size: 1.6rem;
            }
        }

        /* --- ≤ 992px (tablet landscape) --- */
        @media (max-width: 992px) {
            .onem-hero {
                padding: 40px 0 30px;
            }

            .onem-hero-title {
                font-size: 1.85rem;
            }

            .onem-hero-subtitle {
                font-size: 0.95rem;
                margin-bottom: 20px;
            }

            .onem-hero-stats {
                gap: 14px;
            }

            .onem-stat-pill {
                min-width: 80px;
                padding: 10px 14px;
            }

            .onem-stat-pill .val {
                font-size: 1.4rem;
            }

            .onem-info-cards {
                grid-template-columns: repeat(2, 1fr);
                gap: 12px;
            }

            .onem-info-card {
                padding: 14px 16px;
            }

            .onem-info-card .card-val {
                font-size: 1.3rem;
            }

            .onem-winners-section {
                padding: 16px 18px;
            }

            .onem-winners-grid {
                gap: 8px;
            }

            .winner-chip {
                font-size: 12.5px;
                padding: 6px 13px;
            }

            .onem-controls {
                padding: 16px 20px;
            }
        }

        /* --- ≤ 768px (tablet portrait / móvil grande) --- */
        @media (max-width: 768px) {

            /* HERO */
            .onem-hero {
                padding: 28px 0 20px;
            }

            .onem-hero-title {
                font-size: 1.45rem;
                line-height: 1.2;
            }

            .onem-hero-subtitle {
                font-size: 11.5px;
                margin-bottom: 16px;
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                gap: 4px;
            }

            .onem-hero-stats {
                gap: 8px;
                flex-wrap: wrap;
                justify-content: center;
            }

            .onem-stat-pill {
                min-width: 72px;
                padding: 8px 10px;
                border-radius: 12px;
            }

            .onem-stat-pill .val {
                font-size: 1.2rem;
            }

            .onem-stat-pill .lbl {
                font-size: 9.5px;
            }

            .onem-badge {
                font-size: 10.5px;
                padding: 5px 12px;
            }

            /* INFO CARDS */
            .onem-info-cards {
                grid-template-columns: repeat(2, 1fr);
                gap: 10px;
                margin-bottom: 16px;
            }

            .onem-info-card {
                padding: 12px 14px;
                gap: 10px;
                border-radius: 12px;
            }

            .onem-info-card .icon-wrap {
                width: 38px;
                height: 38px;
                font-size: 16px;
                border-radius: 10px;
            }

            .onem-info-card .card-val {
                font-size: 1.15rem;
            }

            .onem-info-card .card-lbl {
                font-size: 11px;
            }

            /* GANADORES */
            .onem-winners-section {
                padding: 14px 16px;
                margin-bottom: 16px;
                border-radius: 12px;
            }

            .onem-winners-title {
                font-size: 14px;
                margin-bottom: 10px;
                flex-wrap: wrap;
            }

            .onem-winners-grid {
                flex-direction: column;
                gap: 8px;
            }

            .winner-chip {
                font-size: 12px;
                padding: 7px 12px;
                border-radius: 10px;
                flex-wrap: wrap;
            }

            .winner-chip .rank-num {
                width: 20px;
                height: 20px;
                font-size: 10px;
            }

            /* CONTROLES */
            .onem-controls {
                flex-direction: column;
                align-items: stretch;
                padding: 14px 16px;
                gap: 10px;
                margin: 18px 0 12px;
                border-radius: 14px;
            }

            .onem-filter-group {
                flex-wrap: wrap;
                gap: 8px;
            }

            .onem-filter-btn {
                padding: 7px 14px;
                font-size: 12px;
            }

            .onem-search {
                padding: 7px 14px;
            }

            .onem-search input {
                width: 100%;
                font-size: 13px;
            }

            /* LEYENDA */
            .onem-legend {
                gap: 10px;
                margin-bottom: 10px;
                font-size: 12px;
            }

            .onem-legend-item {
                font-size: 12px;
            }

            .onem-legend>div:last-child {
                font-size: 11px;
                width: 100%;
                margin-left: 0;
            }

            /* SCORE HEADER */
            .onem-score-header {
                flex-direction: column !important;
                gap: 8px;
                padding: 10px 12px;
                font-size: 11px;
            }

            /* TABLA */
            .onem-table-wrapper {
                border-radius: 12px;
            }

            .onem-table {
                font-size: 11px;
            }

            .onem-table thead tr:first-child th {
                padding: 10px 6px 7px;
                font-size: 9.5px;
                letter-spacing: 0.7px;
            }

            .onem-table thead tr:last-child th {
                padding: 7px 5px 10px;
                font-size: 10.5px;
            }

            .onem-table td {
                padding: 8px 5px;
            }

            .onem-table td.col-name {
                min-width: 120px !important;
                font-size: 11px;
                padding-left: 10px;
                white-space: normal;
            }

            .onem-table th.col-p {
                min-width: 32px;
            }

            .onem-table th.col-nota {
                min-width: 60px;
            }

            .num-cell {
                width: 24px;
                height: 24px;
                font-size: 10px;
            }

            .nota-badge {
                font-size: 11px;
                padding: 3px 8px;
                min-width: 36px;
            }

            .seccion-badge {
                font-size: 10px;
                padding: 2px 8px;
            }

            .clasificado-badge {
                font-size: 10px;
                padding: 2px 8px;
            }

            .tiempo-cell {
                font-size: 10.5px;
            }

            .obs-cell {
                min-width: 110px;
                font-size: 10.5px;
            }

            .obs-alert {
                font-size: 10px;
                padding: 3px 6px;
            }
        }

        /* --- ≤ 480px (móvil pequeño) --- */
        @media (max-width: 480px) {
            .onem-hero {
                padding: 20px 0 14px;
            }

            .onem-hero-title {
                font-size: 1.1rem;
            }

            .onem-hero-subtitle {
                font-size: 10.5px;
            }

            .onem-stat-pill {
                min-width: 58px;
                padding: 6px 8px;
                border-radius: 10px;
            }

            .onem-stat-pill .val {
                font-size: 1rem;
            }

            .onem-stat-pill .lbl {
                font-size: 8.5px;
            }

            .onem-badge {
                font-size: 9.5px;
                padding: 4px 10px;
            }

            .onem-info-cards {
                grid-template-columns: 1fr 1fr;
                gap: 8px;
            }

            .onem-info-card .icon-wrap {
                width: 32px;
                height: 32px;
                font-size: 14px;
            }

            .onem-info-card .card-val {
                font-size: 1rem;
            }

            .onem-winners-title {
                font-size: 13px;
            }

            .winner-chip {
                font-size: 11.5px;
                padding: 6px 10px;
            }

            .onem-filter-btn {
                padding: 6px 11px;
                font-size: 11.5px;
            }

            .onem-table {
                font-size: 10.5px;
            }

            .onem-table td {
                padding: 6px 4px;
            }

            .onem-table td.col-name {
                min-width: 100px !important;
                font-size: 10.5px;
            }

            .nota-badge {
                font-size: 10px;
                padding: 2px 6px;
                min-width: 30px;
            }

            .obs-cell {
                min-width: 90px;
                font-size: 10px;
            }
        }

        /* PRINT */
        @media print {
            .onem-hero {
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }

            .onem-controls,
            .onem-legend {
                display: none !important;
            }

            .onem-table-wrapper {
                box-shadow: none;
                border: 1px solid #ccc;
            }

            .clasificado-row {
                background: #fffde7 !important;
                -webkit-print-color-adjust: exact;
            }
        }


        /* ---------- RESPUESTA CORRECTA ---------- */
        .resp-ok {
            display: inline-flex;
            align-items: center;
            gap: 2px;
            font-weight: 700;
            font-size: 12.5px;
            color: #1b5e20;
            white-space: nowrap;
        }

        .resp-ok i {
            font-size: 10px;
            color: #2e7d32;
            flex-shrink: 0;
        }

        .resp-vacio {
            color: #ccc;
            font-size: 12px;
        }

        /* ---------- OBSERVACIÓN ---------- */
        .obs-cell {
            font-size: 11.5px;
            color: #555;
            width: 160px;
            min-width: 120px;
            max-width: 160px;
            white-space: normal;
            word-break: break-word;
            line-height: 1.4;
            padding: 6px 8px !important;
            vertical-align: middle;
        }

        .obs-alert {
            display: inline-flex;
            align-items: flex-start;
            gap: 5px;
            background: #fff3e0;
            border: 1px solid #ffb74d;
            border-radius: 6px;
            padding: 4px 7px;
            color: #e65100;
            font-size: 10.5px;
            font-weight: 600;
            line-height: 1.4;
            max-width: 150px;
            word-break: break-word;
            white-space: normal;
        }

        .obs-alert i {
            font-size: 11px;
            margin-top: 2px;
            flex-shrink: 0;
        }

        .obs-empty {
            color: #ccc;
            font-size: 11px;
        }
    </style>
@endsection

@section('content')

    {{-- ============================================================
    HERO BANNER
    ============================================================ --}}
    <section class="onem-hero">
        <div class="container onem-hero-content">
            <div style="display:flex;align-items:center;justify-content:center;gap:14px;margin-bottom:14px;flex-wrap:wrap;">
                <div class="onem-badge">
                    <i class="bi bi-trophy-fill"></i>
                    OLIMPIADA NACIONAL ESCOLAR DE MATEMÁTICA — ONEM
                </div>
                <div
                    style="background:rgba(255,255,255,0.10);border:1px solid rgba(255,220,100,0.40);border-radius:50px;padding:5px 18px;display:flex;align-items:center;gap:8px;">
                    <span style="font-size:13px;font-weight:700;color:#ffe082;letter-spacing:0.5px;">&#9888; Patrocinado por
                        <strong>Aceros Arequipa</strong></span>
                </div>
            </div>
            <h1 class="onem-hero-title">
                ONEM <span>Aceros Arequipa 2026</span><br>
                2° Grado de Secundaria &mdash; Categoría <span>ALFA</span>
            </h1>
            <p class="onem-hero-subtitle">
                Olimpiada Nacional Escolar de Matemática
                &nbsp;&middot;&nbsp; <strong style="color:#ffe082;">Primera Etapa</strong>
                &nbsp;&middot;&nbsp; <strong style="color:#ffe082;">Nivel I</strong>
                &nbsp;&middot;&nbsp; Categoría <strong style="color:#ffe082;">ALFA</strong>
                &nbsp;&middot;&nbsp; Resultados oficiales
            </p>
            <div class="onem-hero-stats">
                <div class="onem-stat-pill">
                    <div class="val">28</div>
                    <div class="lbl">Participantes</div>
                </div>
                <div class="onem-stat-pill">
                    <div class="val">4</div>
                    <div class="lbl">Clasificados</div>
                </div>
                <div class="onem-stat-pill">
                    <div class="val">10</div>
                    <div class="lbl">Preguntas</div>
                </div>
                <div class="onem-stat-pill">
                    <div class="val">100</div>
                    <div class="lbl">Puntaje Máx.</div>
                </div>
                <div class="onem-stat-pill">
                    <div class="val">10</div>
                    <div class="lbl">Pts por Respuesta</div>
                </div>
                <div class="onem-stat-pill" style="border-color:rgba(255,220,100,0.5);">
                    <div class="val" style="font-size:1.1rem;">1ª Etapa</div>
                    <div class="lbl">Nivel I</div>
                </div>
                <div class="onem-stat-pill" style="border-color:rgba(255,220,100,0.5);">
                    <div class="val" style="font-size:1.4rem;">ALFA</div>
                    <div class="lbl">Categoría</div>
                </div>
            </div>
        </div>
    </section>

    {{-- ============================================================
    CONTENIDO PRINCIPAL
    ============================================================ --}}
    <section class="py-4" style="min-height: 60vh;">
        <div class="container">

            {{-- TARJETAS RESUMEN --}}
            <div class="onem-info-cards mt-3">
                <div class="onem-info-card">
                    <div class="icon-wrap" style="background:#e8eaf6;">
                        <i class="bi bi-people-fill" style="color:#3949ab;"></i>
                    </div>
                    <div>
                        <div class="card-val">28</div>
                        <div class="card-lbl">Total Participantes</div>
                    </div>
                </div>
                <div class="onem-info-card">
                    <div class="icon-wrap" style="background:#fff8e1;">
                        <i class="bi bi-star-fill" style="color:#f9a825;"></i>
                    </div>
                    <div>
                        <div class="card-val">4</div>
                        <div class="card-lbl">Clasificados Sig. Etapa</div>
                    </div>
                </div>
                <div class="onem-info-card">
                    <div class="icon-wrap" style="background:#e0f2f1;">
                        <i class="bi bi-bar-chart-fill" style="color:#00897b;"></i>
                    </div>
                    <div>
                        <div class="card-val">50</div>
                        <div class="card-lbl">Puntaje Máximo Logrado</div>
                    </div>
                </div>
                <div class="onem-info-card">
                    <div class="icon-wrap" style="background:#f3e5f5;">
                        <i class="bi bi-clock-fill" style="color:#8e24aa;"></i>
                    </div>
                    <div>
                        <div class="card-val">2°A / 2°B</div>
                        <div class="card-lbl">Secciones Participantes</div>
                    </div>
                </div>
            </div>

            {{-- CLASIFICADOS RESALTADOS --}}
            <div class="onem-winners-section">
                <div class="onem-winners-title">
                    <i class="bi bi-award-fill"></i>
                    Estudiantes Clasificados a la Siguiente Etapa
                    <span style="font-size:12px;font-weight:500;color:#bf360c;margin-left:8px;">( 2 mejores mujeres + 2
                        mejores varones · criterio: mayor puntaje, menor tiempo en empate )</span>
                </div>

                {{-- MUJERES --}}
                <div style="margin-bottom:10px;">
                    <div
                        style="font-size:12px;font-weight:700;color:#880e4f;margin-bottom:8px;display:flex;align-items:center;gap:6px;">
                        <span
                            style="background:#fce4ec;border:1px solid #f48fb1;border-radius:50px;padding:3px 12px;">&#9792;
                            Mujeres Clasificadas</span>
                    </div>
                    <div class="onem-winners-grid">
                        <div class="winner-chip" style="border-color:#f48fb1;">
                            <div class="rank-num" style="background:#e91e63;">1</div>
                            HUAMANI HUAMANI Deissy Rosmery
                            <span class="seccion-badge seccion-b">2°B</span>
                            <span style="font-size:11px;color:#888;"><i class="bi bi-clock"></i> 11:41</span>
                            <span class="nota-pts">50 pts</span>
                        </div>
                        <div class="winner-chip" style="border-color:#f48fb1;">
                            <div class="rank-num" style="background:#e91e63;">2</div>
                            AGUIRRE AGUIRRE Liseth Ashley
                            <span class="seccion-badge seccion-b">2°B</span>
                            <span style="font-size:11px;color:#888;"><i class="bi bi-clock"></i> 11:42</span>
                            <span class="nota-pts">50 pts</span>
                        </div>
                    </div>
                </div>

                {{-- VARONES --}}
                <div>
                    <div
                        style="font-size:12px;font-weight:700;color:#0d47a1;margin-bottom:8px;display:flex;align-items:center;gap:6px;">
                        <span
                            style="background:#e3f2fd;border:1px solid #90caf9;border-radius:50px;padding:3px 12px;">&#9794;
                            Varones Clasificados</span>
                    </div>
                    <div class="onem-winners-grid">
                        <div class="winner-chip" style="border-color:#90caf9;">
                            <div class="rank-num" style="background:#1565c0;">1</div>
                            PALACIOS PALACIOS Jheferson
                            <span class="seccion-badge seccion-b">2°B</span>
                            <span style="font-size:11px;color:#888;"><i class="bi bi-clock"></i> 11:47</span>
                            <span class="nota-pts">40 pts</span>
                        </div>
                        <div class="winner-chip" style="border-color:#90caf9;">
                            <div class="rank-num" style="background:#1565c0;">2</div>
                            PINO PINO Jhossimar Raúl
                            <span class="seccion-badge seccion-a">2°A</span>
                            <span style="font-size:11px;color:#888;"><i class="bi bi-clock"></i> 11:45</span>
                            <span class="nota-pts">30 pts</span>
                        </div>
                    </div>
                </div>
            </div>

            {{-- CONTROLES --}}
            <div class="onem-controls">
                <div class="onem-filter-group">
                    <span style="font-size:13px;font-weight:600;color:#555;">Filtrar:</span>
                    <button class="onem-filter-btn active" onclick="filtrarTabla('todos',this)">Todos</button>
                    <button class="onem-filter-btn clasificado-btn" onclick="filtrarTabla('clasificado',this)">&#11088;
                        Clasificados</button>
                    <button class="onem-filter-btn" onclick="filtrarTabla('2B',this)">Sección 2°B</button>
                    <button class="onem-filter-btn" onclick="filtrarTabla('2A',this)">Sección 2°A</button>
                </div>
                <div class="onem-search">
                    <i class="bi bi-search"></i>
                    <input type="text" id="buscador-onem" placeholder="Buscar estudiante..." oninput="buscarEstudiante()" />
                </div>
            </div>

            {{-- LEYENDA --}}
            <div class="onem-legend">
                <div class="onem-legend-item">
                    <div class="legend-dot clasificado"></div> Clasificado a siguiente etapa
                </div>
                <div class="onem-legend-item">
                    <div class="legend-dot normal"></div> Participante
                </div>
                <div style="margin-left:auto; font-size:12px; color:#999;">
                    <i class="bi bi-info-circle"></i>
                    Respuesta de cada alumno por pregunta &nbsp;|&nbsp;
                    <strong>&#10003; = 10 pts</strong> &nbsp;|&nbsp;
                    <strong>&#10007; = 0 pts</strong> &nbsp;|&nbsp;
                    Nota Final = N° respuestas correctas × 10
                </div>
            </div>

            {{-- TABLA PRINCIPAL --}}
            <div class="onem-scroll-hint">
                <i class="bi bi-arrow-left-right"></i>
                Desliza horizontalmente para ver todas las columnas
            </div>
            <div class="onem-scroll-wrapper">
                <div class="onem-table-wrapper">
                    <div class="onem-score-header"
                        style="display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;">
                        <div>
                            <strong>Respuestas Correctas Oficiales:</strong>
                            &nbsp; P1: <strong>3</strong>
                            &nbsp;|&nbsp; P2: <strong>153</strong>
                            &nbsp;|&nbsp; P3: <strong>5</strong>
                            &nbsp;|&nbsp; P4: <strong>225</strong>
                            &nbsp;|&nbsp; P5: <strong>5</strong>
                            &nbsp;|&nbsp; P6: <strong>585</strong>
                            &nbsp;|&nbsp; P7: <strong>174</strong>
                            &nbsp;|&nbsp; P8: <strong>12</strong>
                            &nbsp;|&nbsp; P9: <strong>1484</strong>
                            &nbsp;|&nbsp; P10: <strong>35</strong>
                        </div>
                        <div
                            style="font-size:12px;background:#e8eaf6;border-radius:8px;padding:4px 12px;color:#3949ab;font-weight:600;">
                            <i class="bi bi-check-circle-fill me-1"></i> Cada respuesta correcta = 10 puntos &nbsp;|&nbsp;
                            Máximo: 100 pts
                        </div>
                    </div>
                    <table class="onem-table" id="tablaOnem">
                        <thead>
                            <tr>
                                <th colspan="2" style="text-align:left;padding-left:16px;">Estudiante</th>
                                <th>SECCIÓN</th>
                                <th colspan="10">Respuesta del alumno por pregunta (✓ = correcto · ✗ = incorrecto)</th>
                                <th colspan="2">Resultado</th>
                                <th style="width:160px;min-width:120px;">Observación</th>
                            </tr>
                            {{-- Fila clave de respuestas correctas --}}
                            <tr style="background:rgba(0,0,0,0.18);">
                                <th colspan="3"
                                    style="text-align:right;padding-right:12px;font-size:11px;color:#ffe082;font-style:italic;letter-spacing:0.5px;">
                                    Resp. correcta →</th>
                                <th class="col-p" style="color:#ffe082;font-size:12px;">3</th>
                                <th class="col-p" style="color:#ffe082;font-size:12px;">153</th>
                                <th class="col-p" style="color:#ffe082;font-size:12px;">5</th>
                                <th class="col-p" style="color:#ffe082;font-size:12px;">225</th>
                                <th class="col-p" style="color:#ffe082;font-size:12px;">5</th>
                                <th class="col-p" style="color:#ffe082;font-size:12px;">585</th>
                                <th class="col-p" style="color:#ffe082;font-size:12px;">174</th>
                                <th class="col-p" style="color:#ffe082;font-size:12px;">12</th>
                                <th class="col-p" style="color:#ffe082;font-size:12px;">1484</th>
                                <th class="col-p" style="color:#ffe082;font-size:12px;">35</th>
                                <th class="col-nota" style="color:#ffe082;font-size:11px;">/ 100 pts</th>
                                <th></th>
                                <th></th>
                            </tr>
                            <tr>
                                <th style="width:42px;">N°</th>
                                <th class="col-name" style="min-width:230px;text-align:left;padding-left:16px;">Apellidos y
                                    Nombres</th>
                                <th style="min-width:80px;">GRADO</th>
                                <th class="col-p">P1</th>
                                <th class="col-p">P2</th>
                                <th class="col-p">P3</th>
                                <th class="col-p">P4</th>
                                <th class="col-p">P5</th>
                                <th class="col-p">P6</th>
                                <th class="col-p">P7</th>
                                <th class="col-p">P8</th>
                                <th class="col-p">P9</th>
                                <th class="col-p">P10</th>
                                <th class="col-nota">NOTA FINAL</th>
                                <th style="min-width:80px;">Tiempo</th>
                                <th style="width:160px;min-width:120px;">Observación</th>
                            </tr>
                        </thead>
                        <tbody id="cuerpoTabla">

                            {{-- ===== Nº 1 - CLASIFICADO ===== --}}
                            <tr class="clasificado-row" data-seccion="2B" data-clasificado="1">
                                <td><span class="num-cell rank-1">1</span></td>
                                <td class="col-name">
                                    HUAMANI HUAMANI Deissy Rosmery
                                    <span class="clasificado-badge ms-1" title="Clasificada a la siguiente etapa"><i class="bi bi-star-fill"></i></span>
                                </td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">153</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-high">225</td>
                                <td class="p-val p-zero">0</td>
                                <td class="p-val p-high">585</td>
                                <td class="p-val p-mid">6</td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-high">960</td>
                                <td class="p-val p-high">35</td>
                                <td><span class="nota-badge nota-50">50</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 11:41:00</td>
                            </tr>

                            {{-- ===== Nº 2 - CLASIFICADO ===== --}}
                            <tr class="clasificado-row" data-seccion="2B" data-clasificado="1">
                                <td><span class="num-cell rank-2">2</span></td>
                                <td class="col-name">
                                    AGUIRRE AGUIRRE Liseth Ashley
                                    <span class="clasificado-badge ms-1" title="Clasificada a la siguiente etapa"><i class="bi bi-star-fill"></i></span>
                                </td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">153</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-high">225</td>
                                <td class="p-val p-zero">0</td>
                                <td class="p-val p-high">585</td>
                                <td class="p-val p-mid">6</td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-high">960</td>
                                <td class="p-val p-high">35</td>
                                <td><span class="nota-badge nota-50">50</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 11:42:00</td>
                            </tr>

                            {{-- ===== Nº 3 ===== --}}
                            <tr data-seccion="2B" data-clasificado="0">
                                <td><span class="num-cell rank-3">3</span></td>
                                <td class="col-name">
                                    OREJON OREJON Enma Luz
                                </td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">152</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-high">225</td>
                                <td class="p-val p-zero">0</td>
                                <td class="p-val p-high">585</td>
                                <td class="p-val p-low">2</td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-high">960</td>
                                <td class="p-val p-high">35</td>
                                <td><span class="nota-badge nota-40">40</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 11:43:00</td>
                            </tr>

                            {{-- ===== Nº 4 - CLASIFICADO ===== --}}
                            <tr class="clasificado-row" data-seccion="2B" data-clasificado="1">
                                <td><span class="num-cell rank-other">4</span></td>
                                <td class="col-name">
                                    PALACIOS PALACIOS Jheferson
                                    <span class="clasificado-badge ms-1" title="Clasificado a la siguiente etapa"><i class="bi bi-star-fill"></i></span>
                                </td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">152</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-high">225</td>
                                <td class="p-val p-zero">0</td>
                                <td class="p-val p-high">585</td>
                                <td class="p-val p-mid">6</td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-high">960</td>
                                <td class="p-val p-high">35</td>
                                <td><span class="nota-badge nota-40">40</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 11:47:00</td>
                            </tr>

                            {{-- ===== Nº 5 ===== --}}
                            <tr data-seccion="2B" data-clasificado="0">
                                <td><span class="num-cell rank-other">5</span></td>
                                <td class="col-name">
                                    TORRE TORRE Nahely Yandl
                                </td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">152</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-zero">0.09</td>
                                <td class="p-val p-high">585</td>
                                <td class="p-val p-mid">6</td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-high">960</td>
                                <td class="p-val p-high">35</td>
                                <td class="p-val p-zero">40</td>
                                <td><span class="nota-badge nota-40">40</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 11:49:00</td>
                            </tr>

                            {{-- ===== Nº 6 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">6</span></td>
                                <td class="col-name">
                                    SOTO SOTO Abigail
                                </td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">153</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-high">225</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-high">35</td>
                                <td><span class="nota-badge nota-35">35</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 12:00:00</td>
                            </tr>

                            {{-- ===== Nº 7 - CLASIFICADO ===== --}}
                            <tr class="clasificado-row" data-seccion="2A" data-clasificado="1">
                                <td><span class="num-cell rank-other">7</span></td>
                                <td class="col-name">
                                    PINO PINO Jhossimar Raúl
                                    <span class="clasificado-badge ms-1" title="Clasificado a la siguiente etapa"><i class="bi bi-star-fill"></i></span>
                                </td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-low">3</td>
                                <td class="p-val p-mid">7</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-mid">26</td>
                                <td class="p-val p-mid">26</td>
                                <td class="p-val p-mid">7</td>
                                <td class="p-val p-high">197</td>
                                <td class="p-val p-mid">13</td>
                                <td class="p-val p-high">35</td>
                                <td><span class="nota-badge nota-30">30</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 11:45:00</td>
                            </tr>

                            {{-- ===== Nº 8 ===== --}}
                            <tr data-seccion="2B" data-clasificado="0">
                                <td><span class="num-cell rank-other">8</span></td>
                                <td class="col-name">ARMAS ARMAS Deysi</td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">152</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-zero">0</td>
                                <td class="p-val p-low">2</td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-mid">60</td>
                                <td class="p-val p-mid">35</td>
                                <td class="p-val p-mid">30</td>
                                <td><span class="nota-badge nota-30">30</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 12:00:00</td>
                            </tr>

                            {{-- ===== Nº 9 ===== --}}
                            <tr data-seccion="2B" data-clasificado="0">
                                <td><span class="num-cell rank-other">9</span></td>
                                <td class="col-name">LANDEO LANDEO Karina</td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">152</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-zero">0</td>
                                <td class="p-val p-mid">6</td>
                                <td class="p-val p-high">585</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-mid">60</td>
                                <td class="p-val p-high">35</td>
                                <td><span class="nota-badge nota-30">30</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 12:00:00</td>
                            </tr>

                            {{-- ===== Nº 10 ===== --}}
                            <tr data-seccion="2B" data-clasificado="0">
                                <td><span class="num-cell rank-other">10</span></td>
                                <td class="col-name">VELASQUE VELASQUE Jhon Angel</td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">152</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-zero">0</td>
                                <td class="p-val p-zero">0.09</td>
                                <td class="p-val p-high">585</td>
                                <td class="p-val p-mid">6</td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-high">960</td>
                                <td class="p-val p-high">35</td>
                                <td><span class="nota-badge nota-30">30</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 12:00:00</td>
                            </tr>

                            {{-- ===== Nº 11 ===== --}}
                            <tr data-seccion="2B" data-clasificado="0">
                                <td><span class="num-cell rank-other">11</span></td>
                                <td class="col-name">MUÑOZ MUÑOZ Rosmery</td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">152</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-zero">0</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-high">500</td>
                                <td class="p-val p-mid">6</td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">35</td>
                                <td><span class="nota-badge nota-20">20</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 12:00:00</td>
                            </tr>

                            {{-- ===== Nº 12 ===== --}}
                            <tr data-seccion="2B" data-clasificado="0">
                                <td><span class="num-cell rank-other">12</span></td>
                                <td class="col-name">QUISPE QUISPE Yurfa Luz</td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">152</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-zero">0</td>
                                <td class="p-val p-zero">0.9</td>
                                <td class="p-val p-high">500</td>
                                <td class="p-val p-mid">6</td>
                                <td class="p-val p-mid">8</td>
                                <td class="p-val p-mid">92</td>
                                <td class="p-val p-high">35</td>
                                <td><span class="nota-badge nota-20">20</span></td>
                                <td class="tiempo-cell"><i class="bi bi-clock"></i> 12:00:00</td>
                            </tr>

                            {{-- ===== Nº 13 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">13</span></td>
                                <td class="col-name">SOTO SOTO Jack</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-low">2</td>
                                <td class="p-val p-mid">60</td>
                                <td class="p-val p-low">2</td>
                                <td class="p-val p-mid">8</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-mid">8</td>
                                <td class="p-val p-mid">6</td>
                                <td class="p-val p-high">197</td>
                                <td class="p-val p-mid">28</td>
                                <td class="p-val p-mid">15</td>
                                <td><span class="nota-badge nota-10">10</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 14 ===== --}}
                            <tr data-seccion="2B" data-clasificado="0">
                                <td><span class="num-cell rank-other">14</span></td>
                                <td class="col-name">SOTO SOTO Melisa</td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-high">152</td>
                                <td class="p-val p-mid">23</td>
                                <td class="p-val p-zero">0</td>
                                <td class="p-val p-mid">19</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-high">35</td>
                                <td><span class="nota-badge nota-10">10</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 15 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">15</span></td>
                                <td class="col-name">ARECHE ARECHE Yorny Neymar</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-mid">10</td>
                                <td class="p-val p-high">152</td>
                                <td class="p-val p-mid">12</td>
                                <td class="p-val p-mid">10</td>
                                <td class="p-val p-high">39</td>
                                <td class="p-val p-low">2</td>
                                <td class="p-val p-mid">15</td>
                                <td class="p-val p-high">200</td>
                                <td class="p-val p-mid">20</td>
                                <td class="p-val p-mid">12</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 16 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">16</span></td>
                                <td class="col-name">CAPCHA CAPCHA Maribel Severina</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-low">1</td>
                                <td class="p-val p-mid">55</td>
                                <td class="p-val p-mid">12</td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-mid">11</td>
                                <td class="p-val p-mid">15</td>
                                <td class="p-val p-mid">17</td>
                                <td class="p-val p-mid">5</td>
                                <td class="p-val p-mid">14</td>
                                <td class="p-val p-mid">54</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 17 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">17</span></td>
                                <td class="col-name">CISNEROS CISNEROS Xiomara</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-mid">15</td>
                                <td class="p-val p-mid">15</td>
                                <td class="p-val p-mid">24</td>
                                <td class="p-val p-mid">10</td>
                                <td class="p-val p-high">39</td>
                                <td class="p-val p-mid">14</td>
                                <td class="p-val p-mid">13</td>
                                <td class="p-val p-mid">15</td>
                                <td class="p-val p-mid">14</td>
                                <td class="p-val p-mid">54</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 18 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">18</span></td>
                                <td class="col-name">CISNEROS CISNEROS Yhamelinda</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-mid">14</td>
                                <td class="p-val p-mid">21</td>
                                <td class="p-val p-mid">15</td>
                                <td class="p-val p-mid">16</td>
                                <td class="p-val p-mid">15</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 19 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">19</span></td>
                                <td class="col-name">GUTIERREZ GUTIERREZ Sebastián</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 20 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">20</span></td>
                                <td class="col-name">HUAMANI HUAMANI Wilfredo</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-high">50</td>
                                <td class="p-val p-high">148</td>
                                <td class="p-val p-high">39</td>
                                <td class="p-val p-mid">23</td>
                                <td class="p-val p-low">2</td>
                                <td class="p-val p-mid">90</td>
                                <td class="p-val p-high">40</td>
                                <td class="p-val p-high">199</td>
                                <td class="p-val p-mid">12</td>
                                <td class="p-val p-high">140</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 21 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">21</span></td>
                                <td class="col-name">HUAMANI HUAMANI Yarita Lizeth</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-mid">55</td>
                                <td class="p-val p-high">39</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-mid">21</td>
                                <td class="p-val p-mid">24</td>
                                <td class="p-val p-mid">15</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-mid">12</td>
                                <td class="p-val p-high">160</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 22 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">22</span></td>
                                <td class="col-name">LANDEO LANDEO Jhon Cristian</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-mid">13</td>
                                <td class="p-val p-high">152</td>
                                <td class="p-val p-mid">16</td>
                                <td class="p-val p-mid">12</td>
                                <td class="p-val p-mid">25</td>
                                <td class="p-val p-mid">14</td>
                                <td class="p-val p-mid">13</td>
                                <td class="p-val p-high">200</td>
                                <td class="p-val p-mid">24</td>
                                <td class="p-val p-mid">15</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 23 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">23</span></td>
                                <td class="col-name">LANDEO LANDEO Ruth</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-mid">10</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-mid">21</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-mid">14</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 24 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">24</span></td>
                                <td class="col-name">QUISPE QUISPE Adriana</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-high">158</td>
                                <td class="p-val p-mid">81</td>
                                <td class="p-val p-mid">15</td>
                                <td class="p-val p-mid">10</td>
                                <td class="p-val p-mid">80</td>
                                <td class="p-val p-low">2</td>
                                <td class="p-val p-mid">15</td>
                                <td class="p-val p-mid">14</td>
                                <td class="p-val p-mid">14</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 25 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">25</span></td>
                                <td class="col-name">QUISPE QUISPE Javier</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-invalid">####</td>
                                <td class="p-val p-high">155</td>
                                <td class="p-val p-mid">12</td>
                                <td class="p-val p-invalid">ABCD</td>
                                <td class="p-val p-high">183</td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-mid">13</td>
                                <td class="p-val p-high">113</td>
                                <td class="p-val p-mid">4</td>
                                <td class="p-val p-mid">6</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 26 ===== --}}
                            <tr data-seccion="2A" data-clasificado="0">
                                <td><span class="num-cell rank-other">26</span></td>
                                <td class="col-name">ARMAS ARMAS Dina</td>
                                <td><span class="seccion-badge seccion-a">2°A</span></td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 27 ===== --}}
                            <tr data-seccion="2B" data-clasificado="0">
                                <td><span class="num-cell rank-other">27</span></td>
                                <td class="col-name">LANDEO LANDEO Moris Soomer</td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-low">2</td>
                                <td class="p-val p-mid">9</td>
                                <td class="p-val p-mid">15</td>
                                <td class="p-val p-mid">7</td>
                                <td class="p-val p-mid">6</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                            {{-- ===== Nº 28 ===== --}}
                            <tr data-seccion="2B" data-clasificado="0"
                                data-obs="Estudiante no entregó cartilla de respuesta">
                                <td><span class="num-cell rank-other">28</span></td>
                                <td class="col-name">LANDEO LANDEO Nayeli Jhasmin</td>
                                <td><span class="seccion-badge seccion-b">2°B</span></td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td class="p-val p-zero">—</td>
                                <td><span class="nota-badge nota-0">0</span></td>
                                <td class="tiempo-cell">—</td>
                            </tr>

                        </tbody>
                        <tfoot>
                            <tr>
                                <td colspan="16" style="text-align:center;">
                                    <i class="bi bi-info-circle me-1"></i>
                                    Total: <strong>28 participantes</strong> &nbsp;|&nbsp;
                                    Clasificados: <strong>4 estudiantes</strong> (2 mujeres + 2 varones) &nbsp;|&nbsp;
                                    Grado: <strong>2° Secundaria</strong> &nbsp;|&nbsp;
                                    Secciones: <strong>2°A y 2°B</strong> &nbsp;|&nbsp;
                                    ⭐ Fila amarilla = Clasificado a la siguiente etapa
                                </td>
                            </tr>
                        </tfoot>
                    </table>
                </div>
            </div>

            {{-- NOTA INFORMATIVA --}}
            <div class="mt-4 p-3 d-flex gap-2 align-items-start"
                style="background:#fff;border-radius:12px;border:1px solid #e0e7ef;font-size:13px;color:#666;">
                <i class="bi bi-exclamation-triangle-fill text-warning mt-1 flex-shrink-0"></i>
                <div>
                    <strong>Nota informativa:</strong>
                    Los valores marcados con <span class="p-invalid" style="font-weight:700;color:#e53935;">####</span> o
                    <span class="p-invalid" style="font-weight:700;color:#e53935;">ABCD</span> corresponden a datos no
                    válidos o errores en el registro de puntaje.
                    Los guiones (<strong>—</strong>) indican preguntas no respondidas o sin puntaje registrado.
                    Las filas resaltadas en <span
                        style="background:#fffde7;border:1px solid #f9a825;padding:2px 8px;border-radius:4px;font-weight:600;">amarillo
                        ⭐</span> corresponden a los estudiantes seleccionados para la <strong>siguiente etapa de la
                        ONEM</strong>.
                </div>
            </div>

        </div>
    </section>

@endsection

@section('scripts')
    <script>
        // =====================================================
        // FILTRO POR SECCIÓN / CLASIFICADOS
        // =====================================================
        function filtrarTabla(tipo, btnEl) {
            const filas = document.querySelectorAll('#cuerpoTabla tr');
            const btns = document.querySelectorAll('.onem-filter-btn');

            btns.forEach(b => b.classList.remove('active'));
            btnEl.classList.add('active');
            document.getElementById('buscador-onem').value = '';

            filas.forEach(fila => {
                const seccion = fila.getAttribute('data-seccion') || '';
                const clasificado = fila.getAttribute('data-clasificado') || '0';
                let mostrar = false;

                if (tipo === 'todos') mostrar = true;
                else if (tipo === 'clasificado') mostrar = clasificado === '1';
                else if (tipo === '2B') mostrar = seccion === '2B';
                else if (tipo === '2A') mostrar = seccion === '2A';

                fila.style.display = mostrar ? '' : 'none';
            });
        }

        // =====================================================
        // BUSCADOR EN TIEMPO REAL
        // =====================================================
        function buscarEstudiante() {
            const query = document.getElementById('buscador-onem').value.toLowerCase().trim();
            const filas = document.querySelectorAll('#cuerpoTabla tr');

            if (query.length > 0) {
                document.querySelectorAll('.onem-filter-btn').forEach(b => b.classList.remove('active'));
            }

            filas.forEach(fila => {
                const nombre = fila.querySelector('.col-name')?.textContent?.toLowerCase() || '';
                fila.style.display = nombre.includes(query) ? '' : 'none';
            });
        }

        // =====================================================
        // MARCAR RESPUESTAS CORRECTAS CON ✓ (al costado, compacto)
        // =====================================================
        document.addEventListener('DOMContentLoaded', function () {

            // Clave de respuestas correctas (P1 → P10)
            const claveCorrecta = [3, 153, 5, 225, 5, 585, 174, 12, 1484, 35];

            const filas = document.querySelectorAll('#cuerpoTabla tr');

            filas.forEach(function (fila) {
                // col 0=Nº, col 1=Nombre, col 2=Sección, col 3..12=P1..P10
                const celdas = fila.querySelectorAll('td');
                if (celdas.length < 13) return;

                for (let i = 0; i < 10; i++) {
                    const celda = celdas[i + 3];
                    const textoRaw = celda.textContent.trim();

                    // Sin respuesta → dejar guión gris
                    if (textoRaw === '' || textoRaw === '—') {
                        celda.innerHTML = '<span class="resp-vacio">—</span>';
                        continue;
                    }

                    // Datos inválidos → dejar como está, sin icono
                    const num = parseFloat(textoRaw);
                    if (isNaN(num)) continue;

                    if (num === claveCorrecta[i]) {
                        // ✓ CORRECTO: icono pequeño al costado
                        celda.innerHTML =
                            '<span class="resp-ok">' +
                            textoRaw +
                            '<i class="bi bi-check-circle-fill"></i>' +
                            '</span>';
                    }
                    // INCORRECTO: sin cambio (queda como texto plano)
                }
            });

            // =====================================================
            // COLUMNA OBSERVACIÓN — poblar celdas dinámicamente
            // =====================================================
            document.querySelectorAll('#cuerpoTabla tr').forEach(function (fila) {
                const obs = fila.getAttribute('data-obs') || '';
                const td = document.createElement('td');
                td.className = 'obs-cell';

                if (obs) {
                    td.innerHTML =
                        '<span class="obs-alert">' +
                        '<i class="bi bi-exclamation-triangle-fill"></i>' +
                        obs +
                        '</span>';
                } else {
                    td.innerHTML = '<span class="obs-empty">—</span>';
                }

                fila.appendChild(td);
            });

        });
    </script>
@endsection