/* ============================================
   CONFIGURACIÓN GLOBAL Y VARIABLES
   ============================================ */

:root {
    /* Paleta de colores vibrantes y educativos */
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --success-color: #51CF66;
    --error-color: #FF6B6B;
    --dark-blue: #1A535C;
    --light-blue: #E8F4F8;
    --purple: #9D4EDD;
    --orange: #FF9F1C;
    
    /* Colores de fondo */
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-light: #F8F9FA;
    --bg-white: #FFFFFF;
    
    /* Sombras y efectos */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    
    /* Bordes redondeados */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    /* Tipografía */
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-display: 'Comic Sans MS', 'Trebuchet MS', cursive;
}

/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, #e3f2fd 0%, #fce4ec 50%, #fff9c4 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: #333;
}

/* ============================================
   ENCABEZADO
   ============================================ */

header {
    background: var(--bg-gradient);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    box-shadow: var(--shadow-md);
    z-index: 100;
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

header h1 {
    font-size: 2rem;
    font-family: var(--font-display);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

.student-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.student-name {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1rem;
}

.score-badge {
    background: var(--accent-color);
    color: var(--dark-blue);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1rem;
    animation: pulse 2s infinite;
}

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

/* ============================================
   BARRA DE PROGRESO
   ============================================ */

.progress-container {
    max-width: 1000px;
    margin: 2rem auto 1rem;
    padding: 0 1rem;
}

.progress-bar {
    height: 12px;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    border-radius: 10px;
    width: 20%;
    transition: width 0.5s ease;
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.4);
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-weight: 600;
    color: var(--dark-blue);
    font-size: 1rem;
}

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */

main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ============================================
   ACTIVIDADES
   ============================================ */

/* Pantalla de Bienvenida */
.welcome-container {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.welcome-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(20deg);
    }
    75% {
        transform: rotate(-20deg);
    }
}

.welcome-container h2 {
    color: var(--dark-blue);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.welcome-text {
    font-size: 1.2rem;
    color: #495057;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.name-registration {
    margin: 2rem 0;
}

.name-registration label {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark-blue);
    margin-bottom: 1rem;
}

.name-registration input {
    width: 100%;
    max-width: 400px;
    padding: 1.2rem;
    font-size: 1.1rem;
    border: 3px solid var(--secondary-color);
    border-radius: var(--radius-md);
    text-align: center;
    transition: all 0.3s ease;
}

.name-registration input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.2);
    transform: scale(1.02);
}

.name-error {
    color: var(--error-color);
    font-weight: 600;
    margin-top: 0.5rem;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

.info-box ul {
    list-style: none;
    padding: 0;
    text-align: left;
    margin-top: 1rem;
}

.info-box li {
    padding: 0.5rem 0;
    font-size: 1rem;
}

.activity {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.activity.hidden {
    display: none;
}

.activity-header {
    margin-bottom: 2rem;
    border-left: 5px solid var(--primary-color);
    padding-left: 1rem;
}

.activity-number {
    display: inline-block;
    background: var(--accent-color);
    color: var(--dark-blue);
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.activity-header h2 {
    color: var(--dark-blue);
    font-size: 1.8rem;
    margin-top: 0.5rem;
}

.points-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #664d00;
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 0.5rem;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.instruction {
    background: var(--light-blue);
    border-left: 4px solid var(--secondary-color);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-sm);
}

.instruction p {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--dark-blue);
}

/* ============================================
   ACTIVIDAD 1: DRAG AND DROP
   ============================================ */

.numbers-display {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.number-badge {
    background: linear-gradient(135deg, var(--purple), var(--primary-color));
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: var(--shadow-md);
}

.classification-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.drop-zone {
    background: #f8f9fa;
    border: 3px dashed #dee2e6;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.drop-zone.drag-over {
    background: #e7f5ff;
    border-color: var(--secondary-color);
    transform: scale(1.02);
}

.drop-zone h3 {
    text-align: center;
    color: var(--dark-blue);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.drop-container {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.draggable-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--light-blue);
    border-radius: var(--radius-md);
}

.draggable-number {
    background: linear-gradient(135deg, var(--orange), #ff6b35);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: grab;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.draggable-number:hover {
    transform: translateY(-5px) rotate(2deg);
    box-shadow: var(--shadow-lg);
}

.draggable-number:active {
    cursor: grabbing;
}

.draggable-number.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.dropped-number {
    background: var(--success-color);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 1.3rem;
    font-weight: 600;
    animation: dropIn 0.4s ease-out;
}

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

/* ============================================
   ACTIVIDAD 2 Y 4: FORMULARIOS
   ============================================ */

.question-box {
    margin-bottom: 2rem;
}

.question-box label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-blue);
    margin-bottom: 0.8rem;
}

textarea, input[type="text"] {
    width: 100%;
    padding: 1rem;
    border: 2px solid #dee2e6;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-main);
    transition: all 0.3s ease;
    resize: vertical;
}

textarea:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.2);
}

.info-box {
    background: linear-gradient(135deg, #fff9e6, #ffe6cc);
    border-left: 5px solid var(--orange);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    margin: 2rem 0;
}

.info-box p {
    margin: 0;
    color: #664d00;
}

/* ============================================
   ACTIVIDAD 3: TABLA
   ============================================ */

.table-container {
    overflow-x: auto;
    margin: 2rem 0;
}

.classification-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.classification-table thead {
    background: var(--bg-gradient);
    color: white;
}

.classification-table th {
    padding: 1.2rem;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
}

.classification-table tbody tr {
    background: white;
    transition: background 0.3s ease;
}

.classification-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.classification-table tbody tr:hover {
    background: var(--light-blue);
}

.classification-table td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}

.number-cell {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--dark-blue);
}

.classification-table input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--secondary-color);
}

/* ============================================
   ACTIVIDAD 4: EJEMPLOS
   ============================================ */

.examples-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.examples-grid > div {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.examples-grid input[type="text"] {
    flex: 2;
}

.examples-grid select {
    flex: 1;
    padding: 1rem;
    border: 2px solid #dee2e6;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.examples-grid select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.2);
}

/* ============================================
   ACTIVIDAD 5: CONTEO
   ============================================ */

.count-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.count-grid > div {
    background: var(--light-blue);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.count-grid label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: var(--dark-blue);
}

.count-grid input[type="number"] {
    width: 80px;
    padding: 0.8rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid var(--secondary-color);
    border-radius: var(--radius-sm);
}

/* ============================================
   RETROALIMENTACIÓN
   ============================================ */

.feedback {
    margin: 2rem 0;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-align: center;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.feedback.success {
    background: linear-gradient(135deg, #d3f9d8, #b2f2bb);
    border: 3px solid var(--success-color);
    color: #2b8a3e;
}

.feedback.error {
    background: linear-gradient(135deg, #ffe3e3, #ffc9c9);
    border: 3px solid var(--error-color);
    color: #c92a2a;
}

.feedback.info {
    background: linear-gradient(135deg, #e7f5ff, #d0ebff);
    border: 3px solid var(--secondary-color);
    color: #1864ab;
}

/* ============================================
   BOTONES
   ============================================ */

button {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem;
    font-family: var(--font-main);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #ee5a6f);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #45b8b0);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-large {
    padding: 1.5rem 3rem;
    font-size: 1.2rem;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   RESULTADOS FINALES
   ============================================ */

.results-container {
    text-align: center;
    padding: 3rem 2rem;
}

.results-container h2 {
    font-size: 2.5rem;
    color: var(--dark-blue);
    margin-bottom: 1rem;
    animation: bounce 1s ease-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-30px);
    }
    60% {
        transform: translateY(-15px);
    }
}

.results-message {
    font-size: 1.3rem;
    color: #495057;
    margin-bottom: 2rem;
}

.score-display {
    margin: 3rem 0;
}

.score-circle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 200px;
    background: var(--bg-gradient);
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.8s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

#scoreValue {
    font-size: 4rem;
    font-weight: 700;
    color: white;
}

.score-label {
    font-size: 1.2rem;
    color: white;
    opacity: 0.9;
}

.score-display p {
    margin-top: 1.5rem;
    font-size: 1.2rem;
    color: var(--dark-blue);
    font-weight: 600;
}

.motivational-message {
    background: linear-gradient(135deg, #fff9e6, #ffe6cc);
    border-left: 5px solid var(--orange);
    padding: 2rem;
    border-radius: var(--radius-md);
    margin: 2rem 0;
    font-size: 1.2rem;
    color: #664d00;
}

.detailed-scores {
    background: var(--light-blue);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin: 2rem 0;
    text-align: left;
}

.detailed-scores h3 {
    color: var(--dark-blue);
    margin-bottom: 1.5rem;
    text-align: center;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: var(--radius-sm);
    margin-bottom: 0.8rem;
    box-shadow: var(--shadow-sm);
}

.score-item-name {
    font-weight: 600;
    color: var(--dark-blue);
}

.score-item-points {
    font-weight: 700;
    font-size: 1.1rem;
}

.score-item-points.earned {
    color: var(--success-color);
}

.score-item-points.not-earned {
    color: #adb5bd;
}

/* ============================================
   PIE DE PÁGINA
   ============================================ */

footer {
    background: var(--dark-blue);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
}

footer p {
    margin: 0;
    opacity: 0.9;
}

/* ============================================
   UTILIDADES
   ============================================ */

.hidden {
    display: none !important;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .student-info {
        gap: 1rem;
    }
    
    .student-name,
    .score-badge {
        font-size: 0.9rem;
        padding: 0.4rem 1rem;
    }
    
    .welcome-container h2 {
        font-size: 2rem;
    }
    
    .welcome-icon {
        font-size: 4rem;
    }
    
    .welcome-text {
        font-size: 1rem;
    }
    
    .activity {
        padding: 1.5rem;
    }
    
    .activity-header h2 {
        font-size: 1.4rem;
    }
    
    .classification-area {
        grid-template-columns: 1fr;
    }
    
    .numbers-display {
        gap: 0.8rem;
    }
    
    .number-badge {
        padding: 0.8rem 1.2rem;
        font-size: 1.2rem;
    }
    
    .draggable-number {
        padding: 0.8rem 1.2rem;
        font-size: 1.2rem;
    }
    
    button {
        width: 100%;
        margin: 0.5rem 0;
    }
    
    .score-circle {
        width: 150px;
        height: 150px;
    }
    
    #scoreValue {
        font-size: 3rem;
    }
    
    .examples-grid > div {
        flex-direction: column;
    }
    
    .examples-grid input[type="text"],
    .examples-grid select {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .activity {
        padding: 1rem;
    }
    
    .classification-table {
        font-size: 0.85rem;
    }
    
    .classification-table th,
    .classification-table td {
        padding: 0.8rem 0.5rem;
    }
}
