/* ========================================
   VARIABLES CSS - PALETA DE COLORES
   ======================================== */
   :root {
    /* Colores principales */
    --primary-color: #FFD93D;
    --primary-light: #FFF4CC;
    --secondary-color: #6BCB77;
    --accent-color: #4D96FF;
    
    /* Colores de texto */
    --text-dark: #2D3142;
    --text-light: #5A6277;
    
    /* Colores de fondo */
    --bg-main: #F8F9FE;
    --bg-white: #FFFFFF;
    
    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.15);
    
    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* ========================================
   RESET Y ESTILOS BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--primary-light) 0%, #E8F5E9 100%);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.6;
}


/* ========================================
   ENCABEZADO
   ======================================== */
   .header {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--bg-white);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    position: relative;
}

.header-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.header-main {
    flex: 1;
    text-align: center;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}


/* ========================================
   CONTENEDOR PRINCIPAL
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

/* ========================================
   SECCIÓN DE CONTROLES
   ======================================== */
.controls {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

/* Barra de búsqueda */
.search-container {
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-family: 'Quicksand', sans-serif;
    border: 2px solid #E0E5F0;
    border-radius: 12px;
    background: var(--bg-main);
    color: var(--text-dark);
    transition: all var(--transition-normal);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--bg-white);
    box-shadow: 0 0 0 4px rgba(77, 150, 255, 0.1);
}

.search-input::placeholder {
    color: var(--text-light);
}

/* Botones de ordenamiento */
.sort-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sort-btn {
    flex: 1;
    min-width: 140px;
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Quicksand', sans-serif;
    border: 2px solid #E0E5F0;
    border-radius: 10px;
    background: var(--bg-white);
    color: var(--text-dark);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sort-btn:hover {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.sort-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* ========================================
   CONTADOR DE PALABRAS
   ======================================== */
.word-count {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 600;
}

/* ========================================
   GRID DE PALABRAS
   ======================================== */
.words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Tarjeta de palabra individual */
.word-card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.word-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.word-card:active {
    transform: translateY(-2px);
}

/* Número de orden en la tarjeta */
.word-number {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-color);
    background: rgba(77, 150, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    margin-bottom: 0.75rem;
}

/* Texto de la palabra */
.word-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: 0.3px;
}

/* Icono de sonido */
.sound-icon {
    font-size: 1.5rem;
    margin-top: 0.5rem;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.word-card:hover .sound-icon {
    opacity: 1;
}

/* Animación al reproducir sonido */
.word-card.playing {
    background: linear-gradient(135deg, var(--primary-light) 0%, #FFF9E6 100%);
    border-color: var(--primary-color);
    animation: pulse 0.4s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Estado cuando no hay resultados */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

/* ========================================
   PIE DE PÁGINA
   ======================================== */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    .header {
        padding: 1rem 1rem; /* Reducido de 1.25rem */
    }
    
    .header-wrapper {
        flex-direction: row; /* Mantener horizontal en móvil */
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .header-main {
        flex: 1;
        text-align: left; /* Alinear a la izquierda */
    }
    .title {
        font-size: 1.75rem; /* Más compacto */
        margin-bottom: 0.25rem; /* Menos espacio */
        line-height: 1.2;
    }
    
    .subtitle {
        font-size: 0.9rem; /* Más pequeño */
        line-height: 1.3;
    }
    .teacher-access-btn {
        width: auto; /* No ocupar todo el ancho */
        padding: 0.75rem 1rem; /* Más compacto */
        font-size: 1.5rem; /* Solo el icono grande */
        min-width: auto;
        flex-shrink: 0; /* No se encoge */
        align-self: flex-start;
    }
    
    
    .words-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .word-card {
        padding: 1.25rem;
    }
    
    .sort-buttons {
        flex-direction: column;
    }
    
    .sort-btn {
        min-width: 100%;
    }
    .grade-selector {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
        gap: 1rem;
    }
    
    .grade-dropdown {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.875rem 1rem; /* Aún más compacto */
    }
    
    .title {
        font-size: 1.5rem; /* Más pequeño en móviles pequeños */
        margin-bottom: 0.2rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .teacher-access-btn {
        padding: 0.65rem 0.85rem; /* Más pequeño */
        font-size: 1.4rem;
    }
    .words-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    
    .word-text {
        font-size: 1.1rem;
    }
    .grade-label {
        font-size: 1.1rem;
    }
    
    .grade-dropdown {
        font-size: 1rem;
        min-width: 100%;
    }
}

/* Botón de acceso al panel del profesor - Mejorado */
.teacher-access-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    white-space: nowrap;
    border: 2px solid transparent;
}

.teacher-access-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
    border-color: rgba(255, 255, 255, 0.3);
}

.teacher-access-btn:active {
    transform: translateY(-1px) scale(1.02);
}

/* ========================================
   SELECTOR DE GRADO - Mejorado
   ======================================== */
   .grade-selector {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.grade-label {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.grade-dropdown {
    position: relative;
    padding: 1rem 2.5rem 1rem 1.5rem;
    font-size: 1.1rem;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    border: 3px solid white;
    border-radius: 50px;
    background: white;
    color: #667eea;
    cursor: pointer;
    transition: all var(--transition-normal);
    min-width: 180px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.grade-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 217, 61, 0.3), 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.grade-dropdown:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.grade-dropdown option {
    padding: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    background: white;
}